Tuple Format
EQ chains can be represented in the tuple format, allowing them to be converted to DSP.jl-filters as well as sampling rate-independent EQ APO configuration strings.
Possible tuple formats are:
([:PK|:LS|:HS], f, dbGain, Q)
([:LP|:HP|:BP|:NO|:AP], f, Q)
([:G|:D|:Ds], parameter)The filter types have the more or less intuitive meanings of:
:PKfor peaking filter:LSfor low shelf filter:HSfor high shelf filter:LPfor lowpass filter:HPfor high pass filter:BPfor band pass filter:NOfor notch filter:APfor all pass filter:Gfor gain filter with gain in dB:Dfor delay filter with delay in ms:Dsfor delay filter with delay in samples.
Delay Filters cannot be converted to DSP.jl-filters as they do not have a proper coefficient representation.
The tuples can be arranged in arrays like this:
[(:LS, 60, 6, .707), (:PK, 9e3, -5, 2)]The single tuples can be converted to a DSP.jl-Biquad by calling the constructor Biquad(tuple).
Arrays of Tuples can be converted to DSP.jl-SecondOrderSections with the constructor SecondOrderSections(tupleArray).
If you want to convert the filter tuple or filter tuple array to the corresponding string in Equalizer APO configuration file format, use eqAPOstring(tupleArray).
eqAPOString can also be used to convert an arbitrary DSP.jl-filter to Equalizer APO by using second order IIRs with custom coefficients.
Function Reference
DSP.jl-filters
DSP.Filters.Biquad — TypeBiquad(filterType::Symbol, f, dbGain, Q)Return peak, low shelf or high shelf biquad depending on respective filterType :PK, :LS or :HS. Parameters are center frequency f in Hz, Gain dbGain in dB and the quality factor Q.
The sampling rate defaults to 48 kHz or can be set with EqualizerFilters.sampling_rate.
Biquad(filterType::Symbol, f, Q)Return lowpass, highpass, bandpass, notch or allpass biquad depending on respective filterType :LP, :HP, :BP, :NO or :AP. Parameters are frequency f in Hz and the quality factor Q.
The sampling rate defaults to 48 kHz or can be set with EqualizerFilters.sampling_rate.
Biquad(filterType::Symbol, dbGain)When filterType is :G for Gain return the field level ratio given by the parameter dbGain in dB. Throw error for other filterType.
Biquad(x::Tuple{Symbol, Vararg})Return Biquad of a filter specified in a tuple format, where the first argument is a symbol and defines the filter type: ([:LP, :HP, :BP, :NO, :AP, :PK, :LS, :HS, :G], f, dbGain, Q)
For non-gain filter types [:LP, :HP, :BP, :NO, :AP] the argument dbGain is to be omitted. For the simple gain-filter :G the arguments f and Q shall be omitted.
f is in Hz and dbGain in dB. The quality factor Q is dimensionless.
The filter types refert to a lowpass, highpass, bandpass, notch, allpass, peaking, low shelf, high shelf and gain filter respectively.
The sampling rate defaults to 48 kHz or can be set with EqualizerFilters.sampling_rate.
DSP.Filters.SecondOrderSections — TypeSecondOrderSections(x::Tuple{Symbol, Vararg})Return a filter specified in a tuple format as SecondOrderSections, where the first argument is a symbol and defines the filter type: ([:LP, :HP, :BP, :NO, :AP, :PK, :LS, :HS, :G], f, dbGain, Q)
For non-gain filter types [:LP, :HP, :BP, :NO, :AP] the argument dbGain is to be omitted. For the simple gain-filter :G the arguments f and Q shall be omitted.
f is in Hz and dbGain in dB. The quality factor Q is dimensionless.
The filter types refert to a lowpass, highpass, bandpass, notch, allpass, peaking, low shelf, high shelf and gain filter respectively.
The sampling rate defaults to 48 kHz or can be set with EqualizerFilters.sampling_rate.
SecondOrderSections(x::Array{T} where {T <: Tuple{Symbol, Vararg}})Return SecondOrderSections that represent the filters defined in the array in a tuple format. For details of the tuple format see Biquad(x::Tuple{Symbol, Vararg}).
EQ APO config strings
EqualizerFilters.eqAPOstring — FunctioneqAPOstring(filterType::Symbol, f, dbGain, Q)Convert a three-parameter filter to a string in Equalizer APO configuration file format.
As filterType use:
:PKfor peaking filter:LSfor low shelf filter:HSfor high shelf filter
Parameters are the center frequency f in Hz, the Gain dbGain in dB and the quality factor Q.
eqAPOstring(filterType::Symbol, f, Q)Convert a two-parameter filter to a string in Equalizer APO configuration file format.
As filterType use:
:LPfor lowpass filter:HPfor high pass filter:BPfor band pass filter:NOfor notch filter:APfor all pass filter
Parameters are the frequency f in Hz and the quality factor Q.
eqAPOstring(filterType::Symbol, param)Covert a gain or delay filter to a string in Equalizer APO configuration file format.
As filterType use:
:Gfor gain filter with gain in dB:Dfor delay filter with delay in ms:Dsfor delay filter with delay in samples.
eqAPOstring(x::Array{T} where {T <: Tuple{Symbol, Vararg}})Convert an array of filters in a tuple format to a string in Equalizer APO configuration file format.
The tuples in the array shall constructed according to:
([:G|:D|:Ds|:LP|:HP|:BP|:NO|:AP|:PK|:LS|:HS], f, dbGain, Q)
Depending on the filter please omit the unneeded arguments. See other methods of eqAPOstring for details.
eqAPOstring(x::FilterCoefficients)Convert the given DSP.jl Filter to a string in Equalizer APO configuration file format.
The conversion uses second order sections and spreads the gain evenly among all biquads.