‹›Computational AudioEqualization Using Biquadratic Filters
Filter an audio object using an analog transfer function.
a = AudioNormalize[Import["ExampleData/rule30.wav"]]
filterModel = BiquadraticFilterModel[{\[Omega], q}]
RecurrenceFilter[
ToDiscreteTimeModel[filterModel, 1/44100,
z] /. {\[Omega] -> 1000 2 Pi, q -> 10}, a]
Build an equalizer using analog transfer functions.
show complete Wolfram Language 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]