Apply an arbitrary Finite Impulse Response filter.
This filter is designed for applying long FIR filters, up to 60 seconds long.
It can be used as component for digital crossover filters, room equalization, cross talk cancellation, wavefield synthesis, auralization, ambiophonics, ambisonics and spatialization.
This filter uses the streams higher than first one as FIR coefficients. If the non-first stream holds a single channel, it will be used for all input channels in the first stream, otherwise the number of channels in the non-first stream must be same as the number of channels in the first stream.
It accepts the following parameters:
- dry
-
Set dry gain. This sets input gain.
- wet
-
Set wet gain. This sets final output gain.
- length
-
Set Impulse Response filter length. Default is 1, which means whole IR is processed.
- gtype
-
Enable applying gain measured from power of IR.
Set which approach to use for auto gain measurement.
- none
-
Do not apply any gain.
- peak
-
select peak gain, very conservative approach. This is default value.
- dc
-
select DC gain, limited application.
- gn
-
select gain to noise approach, this is most popular one.
- ac
-
select AC gain.
- rms
-
select RMS gain.
- irgain
-
Set gain to be applied to IR coefficients before filtering. Allowed range is 0 to 1. This gain is applied after any gain applied with gtype option.
- irfmt
-
Set format of IR stream. Can be
mono
orinput
. Default isinput
. - maxir
-
Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds. Allowed range is 0.1 to 60 seconds.
- response
-
Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream. By default it is disabled.
- channel
-
Set for which IR channel to display frequency response. By default is first channel displayed. This option is used only when response is enabled.
- size
-
Set video stream size. This option is used only when response is enabled.
- rate
-
Set video stream frame rate. This option is used only when response is enabled.
- minp
-
Set minimal partition size used for convolution. Default is 8192. Allowed range is from 1 to 65536. Lower values decreases latency at cost of higher CPU usage.
- maxp
-
Set maximal partition size used for convolution. Default is 8192. Allowed range is from 8 to 65536. Lower values may increase CPU usage.
- nbirs
-
Set number of input impulse responses streams which will be switchable at runtime. Allowed range is from 1 to 32. Default is 1.
- ir
-
Set IR stream which will be used for convolution, starting from 0, should always be lower than supplied value by
nbirs
option. Default is 0. This option can be changed at runtime via commands. - precision
-
Set which precision to use when processing samples.
- auto
-
Auto pick internal sample format depending on other filters.
- float
-
Always use single-floating point precision sample format.
- double
-
Always use double-floating point precision sample format.
Default value is auto.
Examples
-
Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
-
Apply true stereo processing given input stereo stream, and two stereo impulse responses for left and right channel, the impulse response files are files with names l_ir.wav and r_ir.wav:
"pan=4C|c0=FL|c1=FL|c2=FR|c3=FR[a];amovie=l_ir.wav[LIR];amovie=r_ir.wav[RIR];[LIR][RIR]amerge[ir];[a][ir]afir=irfmt=input:gtype=gn:irgain=-5dB,pan=stereo|FL<c0+c2|FR<c1+c3"