Configure Haas Filter Delay and Balance in FFmpeg
The FFmpeg haas audio filter synthesizes spatial depth
and stereo widening by applying the Haas effect (precedence effect),
where small time delays between channels create the illusion of width.
This guide covers how to set the delay times and adjust channel balance
using specific parameter values to achieve clean stereo separation
without unwanted phase cancellation.
Understanding the Key Parameters
The haas filter allows you to configure delays and
balances for both channels independently using the following
parameters:
left_delay/right_delay: Sets the channel delay in milliseconds. The Haas effect is most effective between 1.0 ms and 35.0 ms. Values below 1 ms may cause comb filtering, while values above 40 ms will sound like distinct echoes rather than stereo width.left_balance/right_balance: Sets the stereo balance of each delayed signal, ranging from-1.0(fully left) to1.0(fully right).left_gain/right_gain: Adjusts the output volume multiplier for each delayed channel (default is1).
Basic Command Syntax
The cleanest way to configure the filter is by explicitly naming the
parameters in your -af (audio filter) argument:
ffmpeg -i input.mp3 -af "haas=left_delay=15:right_delay=2:left_balance=-0.8:right_balance=0.8" output.mp3In this command:
- The left channel is delayed by
15ms and panned toward the left (-0.8). - The right channel is delayed by
2ms and panned toward the right (0.8).
Configuring Delay and Balance for a Subtle Widening Effect
For natural room expansion without drastic panning, apply a slight delay difference while keeping the channels balanced across the stereo field:
ffmpeg -i input.wav -af "haas=left_delay=12:right_delay=0:left_balance=-1:right_balance=1:left_gain=0.9:right_gain=0.9" output.wavSetting right_delay=0 keeps the right ear as the anchor
while the 12 ms delay on the left creates an immediate
sensation of space. Slightly reducing left_gain and
right_gain prevents digital clipping caused by summing
signals.
Positional Syntax Alternative
You can also define values positionally instead of using parameter names. The positional parameter order is:
haas=level_in:level_out:side_gain:middle_source:middle_phase:left_delay:left_balance:left_gain:right_delay:right_balance:right_gain
Example using positional parameters:
ffmpeg -i input.wav -af "haas=1:1:1:mid:0:20:-1:1:0:1:1" output.wavThis configuration sets:
left_delay: 20 msleft_balance: -1 (hard left)left_gain: 1right_delay: 0 msright_balance: 1 (hard right)right_gain: 1