Only pass through frequencies below 1kHz

Hi there,

I recently received my Tympan Rev D and am very excited to put it to use. I’ve already tried a few of the examples but I’m pretty new to Arduino IDE.

What I’m hoping to do is apply a low pass filter at 1kHz (pass through) and silence everything >1kHz. I’m trying to make a demo of what it’s like to have high-frequency hearing loss. I was planning to plug my Bose noise cancelling headphones in to the Tympan to help facilitate the demo.

Anyone have any ideas on the most efficient way to write the code for that?
Thanks so much!

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.

Good luck!