How to Use FFmpeg apulsator Filter for Auto-Pan

This article explains how to use the apulsator filter in FFmpeg to apply dynamic auto-pan effects to your audio files. You will learn the core parameters of the filter—such as frequency, amount, and modulation mode—and how to implement them using practical command-line examples to shift audio seamlessly between the left and right stereo channels.

Understanding the apulsator Filter

The apulsator filter is an audio channel modulator that alters the volume of the left and right channels over time. This creates a psychoacoustic "panning" effect, making the sound feel as though it is physically moving back and forth between the left and right speakers or headphones.

Key Parameters of apulsator

To customize the auto-pan effect, you can configure several parameters:

  • hz: Defines the frequency of the panning modulation in Hertz (cycles per second). The default is 2 Hz. Higher values create faster panning, while lower values make the pan slower and more gradual.
  • amount: Controls the modulation depth (range 0.0 to 1.0). A value of 1.0 (default) means full panning (completely left to completely right), while lower values keep the sound closer to the center.
  • mode: Sets the waveform shape of the modulation. Options include sine (smooth transition), triangle (linear transition), square (instant switching), sawup, and sawdown. The default is sine.
  • offset_l and offset_r: Sets the left and right channel phase offsets (range 0.0 to 1.0). By default, offset_l is 0.0 and offset_r is 0.5, which creates the alternating left-to-right effect.
  • width: Sets the stereo width (range 0.0 to 2.0). The default is 1.0.

Practical FFmpeg Command Examples

1. Basic Auto-Pan Effect

To apply a standard, smooth sine-wave pan at a rate of 1 Hz (one full cycle per second):

ffmpeg -i input.mp3 -af "apulsator=hz=1" output.mp3

2. Fast, Intense Panning with Triangle Wave

If you want a sharper, faster transition back and forth, you can increase the frequency to 5 Hz and change the modulation mode to a triangle wave:

ffmpeg -i input.mp3 -af "apulsator=hz=5:mode=triangle:amount=0.8" output.mp3

3. Subtle Ambient Panning

For a subtle spatial effect where the sound gently drifts without fully silencing either channel, lower the modulation amount and frequency:

ffmpeg -i input.mp3 -af "apulsator=hz=0.3:amount=0.4" output.mp3