Skip to content

Biquad filters code & examples

Biquad high shelf filter (0.3, +9dB)

Code

1
2
3
4
5
6
const std::string options = "phaseresp=True";
univector<fbase, 128> output;

biquad_section<fbase> bq[] = { biquad_highshelf(0.3, +9.0) };
output                     = iir(unitimpulse(), iir_params{ bq });
plot_save("biquad_highshelf", output, options + ", title='Biquad high shelf filter (0.3, +9)'");
Result

biquad_highshelf

Biquad Low pass filter (0.2, 0.9)

Code

1
2
3
4
5
6
const std::string options = "phaseresp=True";
univector<fbase, 128> output;

biquad_section<fbase> bq[] = { biquad_lowpass(0.2, 0.9) };
output                     = iir(unitimpulse(), iir_params{ bq });
plot_save("biquad_lowpass", output, options + ", title='Biquad Low pass filter (0.2, 0.9)'");
Result

biquad_lowpass

Biquad low shelf filter (0.3, -1dB)

Code

1
2
3
4
5
6
const std::string options = "phaseresp=True";
univector<fbase, 128> output;

biquad_section<fbase> bq[] = { biquad_lowshelf(0.3, -1.0) };
output                     = iir(unitimpulse(), iir_params{ bq });
plot_save("biquad_lowshelf", output, options + ", title='Biquad low shelf filter (0.3, -1)'");
Result

biquad_lowshelf

Four Biquad Notch filters

Code

1
2
3
4
5
6
7
const std::string options = "phaseresp=True";
univector<fbase, 128> output;

biquad_section<fbase> bq[] = { biquad_notch(0.1, 0.5), biquad_notch(0.2, 0.5), biquad_notch(0.3, 0.5),
                                biquad_notch(0.4, 0.5) };
output                     = iir(unitimpulse(), iir_params{ bq });
plot_save("biquad_notch", output, options + ", title='Four Biquad Notch filters'");
Result

biquad_notch

Biquad Peak filter (0.2, 0.5, +9dB)

Code

1
2
3
4
5
const std::string options = "phaseresp=True";
univector<fbase, 128> output;
biquad_section<fbase> bq[] = { biquad_peak(0.3, 0.5, +9.0) };
output                     = iir(unitimpulse(), iir_params{ bq });
plot_save("biquad_peak", output, options + ", title='Biquad Peak filter (0.2, 0.5, +9)'");
Result

biquad_peak

Biquad Peak filter (0.3, 3, -2dB)

Code

1
2
3
4
5
6
const std::string options = "phaseresp=True";
univector<fbase, 128> output;

biquad_section<fbase> bq[] = { biquad_peak(0.3, 3.0, -2.0) };
output                     = iir(unitimpulse(), iir_params{ bq });
plot_save("biquad_peak2", output, options + ", title='Biquad Peak filter (0.3, 3, -2)'");
Result

biquad_peak2

Biquad band pass (0.25, 0.2)

Code

1
2
3
4
5
6
const std::string options = "phaseresp=True";
univector<fbase, 128> output;

biquad_section<fbase> bq[] = { biquad_bandpass(0.25, 0.2) };
output                     = iir(unitimpulse(), iir_params{ bq });
plot_save("biquad_bandpass", output, options + ", title='Biquad band pass (0.25, 0.2)'");
Result

biquad_bandpass

Biquad High pass filter (0.3, 0.1)

Code

1
2
3
4
5
6
const std::string options = "phaseresp=True";
univector<fbase, 128> output;

biquad_section<fbase> bq[] = { biquad_highpass(0.3, 0.1) };
output                     = iir(unitimpulse(), iir_params{ bq });
plot_save("biquad_highpass", output, options + ", title='Biquad High pass filter (0.3, 0.1)'");
Result

biquad_highpass