Wolfram Language

Computational Audio

Equalization Using Biquadratic Filters

Filter an audio object using an analog transfer function.

In[1]:=
Click for copyable input
a = AudioNormalize[Import["ExampleData/rule30.wav"]]
Out[1]=
In[2]:=
Click for copyable input
filterModel = BiquadraticFilterModel[{\[Omega], q}]
Out[2]=
In[3]:=
Click for copyable input
RecurrenceFilter[ ToDiscreteTimeModel[filterModel, 1/44100, z] /. {\[Omega] -> 1000 2 Pi, q -> 10}, a]
Out[3]=

Build an equalizer using analog transfer functions.

show complete Wolfram Language input
In[4]:=
Click for copyable input
eq[g1_, g2_, g3_] := SystemsModelSeriesConnect[ SystemsModelSeriesConnect[ ToDiscreteTimeModel[ BiquadraticFilterModel[{"LowShelf", {{Quantity[5000, "Hz"], 2}}, Quantity[g1, "decibel"]}], 1/44100, z, Method -> {"BilinearTransform", "CriticalFrequency" -> 5000 2 Pi}], ToDiscreteTimeModel[ BiquadraticFilterModel[{"Peaking", {{Quantity[10000, "Hz"], 2}}, Quantity[g2, "decibel"]}], 1/44100, z, Method -> {"BilinearTransform", "CriticalFrequency" -> 10000 2 Pi}]], ToDiscreteTimeModel[ BiquadraticFilterModel[{"HighShelf", {{Quantity[15000, "Hz"], 2}}, Quantity[g3, "decibel"]}], 1/44100, z, Method -> {"BilinearTransform", "CriticalFrequency" -> 15000 2 Pi}]]; white = RandomReal[{-1, 1}, 44100]; Manipulate[ Periodogram[ RecurrenceFilter[eq[gainLow, gainPeak, gainHigh], Audio@white], 4000, PlotRange -> {-35, 20}, ImageSize -> 300], {{gainLow, 0}, -20, 20}, {{gainPeak, 0}, -20, 20}, {{gainHigh, 0}, -20, 20}, SaveDefinitions -> True]
Out[4]=
Play Animation
Stop Animation

Related Examples

de es fr ja ko pt-br ru zh