This Lazarus/Delphi project demonstrates the biquad filters described by Robert Bristow-Johnson. In addition, the software generates a Fast Fourier Transform (FFT) and shows the signal energy after the filter is applied. This allows you to observe how the filters tend to have roll-off near their target frequency (e.g. a 60 Hz notch filter will also attentuate signals at 50 Hz and 70Hz, though to a lesser extent). The source code includes both graphical and console terminal applications that compile with Delphi, FreePascal or Lazarus, allowing you to create programs for Windows, Linux and OSX.
When you launch the program, you will see a sine wave in the top graph and the filtered data in the lower graph. Adjusting the three sliders in the Input panel allows you to set the frequencies of the input signal. The panel on the right allows you to select which filter to apply to the input data in order to generate the output signal. You can tune the following parameters:
- Type: This specifies the kind of filter to apply. Your options are Low Pass, High Pass, Band Pass CSG, Band Pass CZPG, Notch, All Pass, Peaking, Low Shelf and High Shelf. A low pass filter attenuates signals above the target frequency, a high-pass filter dampens signals below the target, band pass filters dampen all frequencies except those near the target, an all pass filter amplifies or dampens all frequencies evenly (though it influences phase), a peak filter preserves all frequencies but amplifies those near the target frequency, shelf filters preserve all frequencies, but somewhat increases or decreases frequencies below (low shelf or above (high shelf) the target frequency.
- Hz: Specify target frequency. Center Frequency or Corner Frequency, or shelf midpoint frequency, depending on filter type.
- Gain dB: Used only for peaking and shelving filters. These filters pass all frequencies, but will increase or decrease the intensity of the target frequencies by this amount.
- Q: By default, this value specifies the Quality factor, tuning the selectivity of the filter. However, if “Q is bandwidth” is checked, this value sets the bandwidth in octaves.
- Q is bandwidth: See above.
- Filter both forward and reverse: Many filters cause shift signals such that they appear to occur later in time. Running the filters in both directions minimizes this effect.
- Jean-Pierre Moreau provides a Pascal implementation of the Butterworth low pass filter.
- DSPLab for Delphi is a shareware component that includes many filters.
- ACS is an open source Delphi and Lazarus project that includes code for many filters.
- My software uses the implementation of the translation of the RBJ filters found here.
- My project was inspired by Gary Darby’s elegant Oscilloscope and Sound Generator projects.
- EFG’s Engineering web page includes references for implementing FIR and IIR filters using Delphi.