A simple XML model for filter networks

For the HiFiBerry DSP project we need a compact, but flexible configuration of a network of filters. Therefore I created an XML configuration that models the different parts of the filter network.

<network samplerate="48000">
<input name="input1"/>
<biquad name="bq1" input="input1" type="allpass" frequency="200" q="1" />
<biquad name="bq2" input="bq1" type="lowpass" frequency="1000" q="0.7" />
<biquad name="bq3" input="bq2" type="highpass" frequency="100" q="0.7" />
<biquad name="bq4" input="bq3" type="notch" frequency="400" q=".1" />
<biquad name="bq5" input="bq4" type="peaking_eq" frequency="700" q="4" dbgain="3" />
<output name="out1" input="bq5" />

Here you see a simple DSP configuration with one input and one output and 5 biquad filters processing the data. Today, no other filters are supported, but I will add other types soon. I plan to also support FIR filters.

Using our software you can now calculate the frequency response of this filter chain:

  Freq       Mag   Phase
    10  -40.27db  151.26°
    15  -33.54db  137.31°
    20  -28.95db  123.77°
    30  -22.92db   98.07°
    40  -19.11db   73.96°
    50  -16.52db   51.02°
    75  -13.06db   -3.32°
   100  -12.19db  -54.31°
   150  -13.86db -148.08°
   200  -16.87db -232.90°
   300  -24.77db -340.74°
   400 -298.86db -480.46°
   500  -26.91db -242.30°
   750  -16.50db -310.78°
  1000  -16.52db -346.21°
  1500  -17.48db -391.49°
  2000  -19.60db  -58.47°
  3000  -23.71db  -89.23°
  4000  -27.23db -107.29°
  5000  -30.26db -119.52°
  7500  -36.41db -137.98°
 10000  -41.23db -148.30°
 15000  -48.77db -159.52°
 20000  -54.92db -165.64°

Now let’s do a nice graph from it using Matplotlib.
Note, this is not the filter that we used before, because the response of that filter is really nasty – it was just for demonstration of the different biquad filters.

Now, we only have to merge this with our DSP upload software with this code and we already have a simple command line tool to upload and modify filters on the HiFiBerry DSP.

Leave a Reply