Commit b70ea49c authored by Paul B Mahol's avatar Paul B Mahol

Port biquads filters from SoX

Adds allpass, bass, bandpass, bandreject, biquad,
equalizer, highpass, lowpass and treble filter.
Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent ff23b768
......@@ -10,6 +10,8 @@ version <next>:
- EVRC decoder
- audio fade filter
- filtering audio with unknown channel layout
- allpass, bass, bandpass, bandreject, biquad, equalizer, highpass, lowpass
and treble audio filter
version 1.1:
......
......@@ -282,6 +282,274 @@ aconvert=u8:auto
@end example
@end itemize
@section allpass
Apply a two-pole all-pass filter with central frequency (in Hz)
@var{frequency}, and filter-width @var{width}.
An all-pass filter changes the audio's frequency to phase relationship
without changing its frequency to amplitude relationship.
The filter accepts parameters as a list of @var{key}=@var{value}
pairs, separated by ":".
A description of the accepted parameters follows.
@table @option
@item frequency, f
Set frequency in Hz.
@item width_type
Set method to specify band-width of filter.
@table @option
@item @var{h} (Hz)
@item @var{q} (Q-Factor)
@item @var{o} (octave)
@item @var{s} (slope)
@end table
@item width, w
Specify the band-width of a filter in width_type units.
@end table
@section highpass
Apply a high-pass filter with 3dB point frequency.
The filter can be either single-pole, or double-pole (the default).
The filter roll off at 6dB per pole per octave (20dB per pole per decade).
The filter accepts parameters as a list of @var{key}=@var{value}
pairs, separated by ":".
A description of the accepted parameters follows.
@table @option
@item frequency, f
Set frequency in Hz. Default is 3000.
@item poles, p
Set number of poles. Default is 2.
@item width_type
Set method to specify band-width of filter.
@table @option
@item @var{h} (Hz)
@item @var{q} (Q-Factor)
@item @var{o} (octave)
@item @var{s} (slope)
@end table
@item width, w
Specify the band-width of a filter in width_type units.
Applies only to double-pole filter.
The default is 0.707q and gives a Butterworth response.
@end table
@section lowpass
Apply a low-pass filter with 3dB point frequency.
The filter can be either single-pole or double-pole (the default).
The filter roll off at 6dB per pole per octave (20dB per pole per decade).
The filter accepts parameters as a list of @var{key}=@var{value}
pairs, separated by ":".
A description of the accepted parameters follows.
@table @option
@item frequency, f
Set frequency in Hz. Default is 500.
@item poles, p
Set number of poles. Default is 2.
@item width_type
Set method to specify band-width of filter.
@table @option
@item @var{h} (Hz)
@item @var{q} (Q-Factor)
@item @var{o} (octave)
@item @var{s} (slope)
@end table
@item width, w
Specify the band-width of a filter in width_type units.
Applies only to double-pole filter.
The default is 0.707q and gives a Butterworth response.
@end table
@section bass
Boost or cut the bass (lower) frequencies of the audio using a two-pole
shelving filter with a response similar to that of a standard
hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
The filter accepts parameters as a list of @var{key}=@var{value}
pairs, separated by ":".
A description of the accepted parameters follows.
@table @option
@item gain, g
Give the gain at 0 Hz. Its useful range is about -20
(for a large cut) to +20 (for a large boost).
Beware of clipping when using a positive gain.
@item frequency, f
Set the filter's central frequency and so can be used
to extend or reduce the frequency range to be boosted or cut.
The default value is @code{100} Hz.
@item width_type
Set method to specify band-width of filter.
@table @option
@item @var{h} (Hz)
@item @var{q} (Q-Factor)
@item @var{o} (octave)
@item @var{s} (slope)
@end table
@item width, w
Determine how steep is the filter's shelf transition.
@end table
@section treble
Boost or cut treble (upper) frequencies of the audio using a two-pole
shelving filter with a response similar to that of a standard
hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
The filter accepts parameters as a list of @var{key}=@var{value}
pairs, separated by ":".
A description of the accepted parameters follows.
@table @option
@item gain, g
Give the gain at whichever is the lower of ~22 kHz and the
Nyquist frequency. Its useful range is about -20 (for a large cut)
to +20 (for a large boost). Beware of clipping when using a positive gain.
@item frequency, f
Set the filter's central frequency and so can be used
to extend or reduce the frequency range to be boosted or cut.
The default value is @code{3000} Hz.
@item width_type
Set method to specify band-width of filter.
@table @option
@item @var{h} (Hz)
@item @var{q} (Q-Factor)
@item @var{o} (octave)
@item @var{s} (slope)
@end table
@item width, w
Determine how steep is the filter's shelf transition.
@end table
@section bandpass
Apply a two-pole Butterworth band-pass filter with central
frequency @var{frequency}, and (3dB-point) band-width width.
The @var{csg} option selects a constant skirt gain (peak gain = Q)
instead of the default: constant 0dB peak gain.
The filter roll off at 6dB per octave (20dB per decade).
The filter accepts parameters as a list of @var{key}=@var{value}
pairs, separated by ":".
A description of the accepted parameters follows.
@table @option
@item frequency, f
Set the filter's central frequency. Default is @code{3000}.
@item csg
Constant skirt gain if set to 1. Defaults to 0.
@item width_type
Set method to specify band-width of filter.
@table @option
@item @var{h} (Hz)
@item @var{q} (Q-Factor)
@item @var{o} (octave)
@item @var{s} (slope)
@end table
@item width, w
Specify the band-width of a filter in width_type units.
@end table
@section bandreject
Apply a two-pole Butterworth band-reject filter with central
frequency @var{frequency}, and (3dB-point) band-width @var{width}.
The filter roll off at 6dB per octave (20dB per decade).
The filter accepts parameters as a list of @var{key}=@var{value}
pairs, separated by ":".
A description of the accepted parameters follows.
@table @option
@item frequency, f
Set the filter's central frequency. Default is @code{3000}.
@item width_type
Set method to specify band-width of filter.
@table @option
@item @var{h} (Hz)
@item @var{q} (Q-Factor)
@item @var{o} (octave)
@item @var{s} (slope)
@end table
@item width, w
Specify the band-width of a filter in width_type units.
@end table
@section biquad
Apply a biquad IIR filter with the given coefficients.
Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
are the numerator and denominator coefficients respectively.
@section equalizer
Apply a two-pole peaking equalisation (EQ) filter. With this
filter, the signal-level at and around a selected frequency can
be increased or decreased, whilst (unlike bandpass and bandreject
filters) that at all other frequencies is unchanged.
In order to produce complex equalisation curves, this filter can
be given several times, each with a different central frequency.
The filter accepts parameters as a list of @var{key}=@var{value}
pairs, separated by ":".
A description of the accepted parameters follows.
@table @option
@item frequency, f
Set the filter's central frequency in Hz.
@item width_type
Set method to specify band-width of filter.
@table @option
@item @var{h} (Hz)
@item @var{q} (Q-Factor)
@item @var{o} (octave)
@item @var{s} (slope)
@end table
@item width, w
Specify the band-width of a filter in width_type units.
@item gain, g
Set the required gain or attenuation in dB.
Beware of clipping when using a positive gain.
@end table
@section afade
Apply fade-in/out effect to input audio.
......
......@@ -53,6 +53,7 @@ OBJS-$(CONFIG_SWSCALE) += lswsutils.o
OBJS-$(CONFIG_ACONVERT_FILTER) += af_aconvert.o
OBJS-$(CONFIG_AFADE_FILTER) += af_afade.o
OBJS-$(CONFIG_AFORMAT_FILTER) += af_aformat.o
OBJS-$(CONFIG_ALLPASS_FILTER) += af_biquads.o
OBJS-$(CONFIG_AMERGE_FILTER) += af_amerge.o
OBJS-$(CONFIG_AMIX_FILTER) += af_amix.o
OBJS-$(CONFIG_ANULL_FILTER) += af_anull.o
......@@ -68,14 +69,22 @@ OBJS-$(CONFIG_ASPLIT_FILTER) += split.o
OBJS-$(CONFIG_ASTREAMSYNC_FILTER) += af_astreamsync.o
OBJS-$(CONFIG_ASYNCTS_FILTER) += af_asyncts.o
OBJS-$(CONFIG_ATEMPO_FILTER) += af_atempo.o
OBJS-$(CONFIG_BANDPASS_FILTER) += af_biquads.o
OBJS-$(CONFIG_BANDREJECT_FILTER) += af_biquads.o
OBJS-$(CONFIG_BASS_FILTER) += af_biquads.o
OBJS-$(CONFIG_BIQUAD_FILTER) += af_biquads.o
OBJS-$(CONFIG_CHANNELMAP_FILTER) += af_channelmap.o
OBJS-$(CONFIG_CHANNELSPLIT_FILTER) += af_channelsplit.o
OBJS-$(CONFIG_EARWAX_FILTER) += af_earwax.o
OBJS-$(CONFIG_EBUR128_FILTER) += f_ebur128.o
OBJS-$(CONFIG_EQUALIZER_FILTER) += af_biquads.o
OBJS-$(CONFIG_HIGHPASS_FILTER) += af_biquads.o
OBJS-$(CONFIG_JOIN_FILTER) += af_join.o
OBJS-$(CONFIG_LOWPASS_FILTER) += af_biquads.o
OBJS-$(CONFIG_PAN_FILTER) += af_pan.o
OBJS-$(CONFIG_RESAMPLE_FILTER) += af_resample.o
OBJS-$(CONFIG_SILENCEDETECT_FILTER) += af_silencedetect.o
OBJS-$(CONFIG_TREBLE_FILTER) += af_biquads.o
OBJS-$(CONFIG_VOLUME_FILTER) += af_volume.o
OBJS-$(CONFIG_VOLUMEDETECT_FILTER) += af_volumedetect.o
......
This diff is collapsed.
......@@ -47,6 +47,7 @@ void avfilter_register_all(void)
REGISTER_FILTER(ACONVERT, aconvert, af);
REGISTER_FILTER(AFADE, afade, af);
REGISTER_FILTER(AFORMAT, aformat, af);
REGISTER_FILTER(ALLPASS, allpass, af);
REGISTER_FILTER(AMERGE, amerge, af);
REGISTER_FILTER(AMIX, amix, af);
REGISTER_FILTER(ANULL, anull, af);
......@@ -62,14 +63,22 @@ void avfilter_register_all(void)
REGISTER_FILTER(ASTREAMSYNC, astreamsync, af);
REGISTER_FILTER(ASYNCTS, asyncts, af);
REGISTER_FILTER(ATEMPO, atempo, af);
REGISTER_FILTER(BANDPASS, bandpass, af);
REGISTER_FILTER(BANDREJECT, bandreject, af);
REGISTER_FILTER(BASS, bass, af);
REGISTER_FILTER(BIQUAD, biquad, af);
REGISTER_FILTER(CHANNELMAP, channelmap, af);
REGISTER_FILTER(CHANNELSPLIT, channelsplit, af);
REGISTER_FILTER(EARWAX, earwax, af);
REGISTER_FILTER(EBUR128, ebur128, af);
REGISTER_FILTER(EQUALIZER, equalizer, af);
REGISTER_FILTER(HIGHPASS, highpass, af);
REGISTER_FILTER(JOIN, join, af);
REGISTER_FILTER(LOWPASS, lowpass, af);
REGISTER_FILTER(PAN, pan, af);
REGISTER_FILTER(RESAMPLE, resample, af);
REGISTER_FILTER(SILENCEDETECT, silencedetect, af);
REGISTER_FILTER(TREBLE, treble, af);
REGISTER_FILTER(VOLUME, volume, af);
REGISTER_FILTER(VOLUMEDETECT, volumedetect, af);
......
......@@ -29,8 +29,8 @@
#include "libavutil/avutil.h"
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 34
#define LIBAVFILTER_VERSION_MICRO 101
#define LIBAVFILTER_VERSION_MINOR 35
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment