How to Use the FFmpeg Haas Filter for Audio Width

This article provides a practical guide on how to use the haas audio filter in FFmpeg to create a wider stereo soundstage. You will learn the basic principles of the Haas effect, the specific syntax and parameters used by the FFmpeg filter, and step-by-step command-line examples to apply this psychoacoustic effect to your audio files.


What is the Haas Effect?

The Haas effect, also known as the precedence effect, is a psychoacoustic phenomenon where the human brain perceives the spatial location of a sound based on the first-arriving wave. When two identical sounds are played out of different speakers with a very short delay (typically between 1 and 35 milliseconds), the listener perceives them as a single, wide sound coming from the direction of the first speaker. FFmpeg’s haas filter automates this process to convert mono sources into wide stereo or to enhance existing stereo tracks.

Basic FFmpeg Haas Filter Syntax

The simplest way to apply the Haas effect to an audio file in FFmpeg is by using the default settings of the haas filter. This automatically handles the channel splitting and delay configuration.

ffmpeg -i input.mp3 -af haas output.mp3

This command takes a mono or stereo input file, applies a default delay to create a widened stereo image, and outputs the processed file.

Customizing Haas Filter Parameters

FFmpeg allows you to fine-tune the Haas effect by adjusting specific parameters. The most commonly adjusted options include:

To pass these parameters, use the key=value syntax separated by colons inside the filter argument.

Example: Creating a Distinct Left-to-Right Delay

To create a natural-sounding stereo widening effect, you can keep the left channel dry (0 ms delay) and delay the right channel by 20 milliseconds:

ffmpeg -i input.wav -af "haas=left_delay=0:right_delay=20" output.wav

Example: Modifying Phase and Balance

For an even wider, more dramatic spatial effect, you can invert the phase of one of the channels. The following command sets a 15 ms delay on the right channel and inverts its phase:

ffmpeg -i input.wav -af "haas=left_delay=0:right_delay=15:right_phase=inverted" output.wav

Precautions When Using the Haas Effect

While the Haas effect creates an impressive sense of width, it can cause phase cancellation issues when the stereo track is summed back to mono (for example, when played on a single phone speaker). Always test your output in mono to ensure that the delay time and phase settings do not make the audio sound hollow or cause key frequencies to disappear. Keep delay times under 30 milliseconds to prevent the listener from hearing the delay as a distinct echo.