Well, wadda ya know? I got basic filtering to work!
There’s a lot of great information out on the web about digital signal processing, so you would think that might make it easy. However there’s almost too much; you need some basic prior knowledge to filter the information before you can filter your signals.
That said, most basic filters boil down to some fairly straightforward implementations involving no math more complex than trigonometry, exponentials and algebra – and that’s only needed for calculating the coefficients, the actual filtering operation on sample data is just multiplies and adds. But I did have to go and make my life a little more difficult by insisting on using fixed point, so have to contend with avoiding overflows and correcting precision here and there.
So, I have a two-pole filter that can be switched between low and high pass modes, with base frequency and Q controls. Thanks to the snappily named “Cookbook formulae for audio EQ biquad filter coefficients”, it should be easily extended to more filter types (see http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt). But first there’s some quality issues to address; clicks when changing filter parameters and some instability leading to unpleasant distortion when the high-pass filter is set low and low frequencies played. The built-in oscilloscope display has come in very useful!
The filter is also being applied globally to the synth’s output, and is currently “all or nothing”. So there’s plenty of more stuff to try, such as adding a gain control, driving filter parameters from envelopes or applying a filter for each voice.
(c) 2013 Nicholas Tuckett.