There are two easy ways to make a lowpass filter demonstration.
The first way is to use the example sketch called “LowpassFilter_FD” which is under the Arduino IDE’s “File” menu, under “Examples”, under “Tympan_Library”, under “04-FrequencyDomain”. In this example, the thumbwheel will change the frequency of the lowpass filter. So, while you’re listening, you can move the cutoff frequency up and down.
If you prefer to fix the value at 1000 Hz. Look for the line:
Then, change it to
A benefit of this approach is that the filter will be fairly steep, meaning the higher frequencies will be very attenuated. There will be very little bleed-through of the unwanted high frequencies. The negative of this approach is that the example sketch is mono not stereo. The sketch could be extended to operate in stereo, but you’ll have to put in a little effort…and if you’re new, it’ll be still more effort.
A second way to demonstrate lowpass filtering is to slightly modify one of the simpler examples. In this case, try the “TrebleBoost” example under “Examples”, under “Tympan_Libraray”, under “01-Basic”. This example uses high pass filters instead of the low pass filters that you want. To change them to low-pass, simply find these two lines:
hp_filt1.setHighpass(0, cutoff_Hz); //biquad IIR filter. left channel
hp_filt2.setHighpass(0, cutoff_Hz); //biquad IIR filter. right channel
and change them to read
hp_filt1.setLowpass0, cutoff_Hz); //biquad IIR filter. left channel
hp_filt2.setLowpass(0, cutoff_Hz); //biquad IIR filter. right channel
The benefit of this approach is that the example sketch is stereo, not mono. The negative is that the filter is not very steep. You could easily cascade additional lowpass filters to make the response more sharp, but that you will have to modify the code to do so.