The Audio Hacker shield for Arduino lets you do some cool things with digital signal processing. This new project shows how a fairly simple Arduino sketch can implement a low-pass filter, high-pass filter and band-pass filter.
A low-pass filter allows low frequencies to pass through (makes sense, right?) while attenuating or cutting out the frequencies that are higher than a specified cutoff frequency.
A high-pass filter is the opposite. It lets high frequencies through while attenuating frequencies below the cutoff frequency.
A band-pass filter lets frequencies that are near the cutoff frequency to pass through but attenuates the frequencies above and below it.
There is a new example sketch included in the Audio Hacker library called “Filter” that implements these 3 filters. In the video below I’m using the DJ Shield to make it easy to provide inputs but it is not strictly required. An audio source is plugged into the Audio Hacker input. A pot connected to A0 controls the cutoff frequency. A button on digital pin 5 starts/stops the audio processing, and a button on digital pin 4 controls the filter selection. I’m lighting up the red LED for low-pass filter, blue LED for high-pass filter, and both LEDs for band-pass filter.
Now shown in the video is the effect of the filter resonance. The pot conntected to A1 controls the resonance of the filter. Resonance amplifies the frequencies around the cutoff frequency, and has an especially cool effect when using a low-pass filter.
The resonant filter implemented here is adapted from the code here. I hope this simple project lets you hear how different filters sound and gives you something new to explore with your Audio Hacker shield!
Nice!
Do you have code for a bandstop filter?
I don’t but you might look here: https://www.musicdsp.org/en/latest/Filters/29-resonant-filter.html
Hi, your project is very interesting and I would like to have the relative sketch for Arduino. I’m sorry but at the link suggested it does not appear. The page is blank. I thank you so much if you are so nice to let me know the sketch for the 3 type of filters.
Many thanks, best regards.
Gian
Gian, I updated the links to musicdsp.org. The Arduino sketch for this project is here: https://github.com/nootropicdesign/audio-hacker/tree/master/examples/Filter
Michael, I looked through the sketch and I understand some of it, my Arduino coding could use some refreshing, it has been a while. My main question is if I know a specific frequency that I want to hear can I enter that frequency somewhere and have it act as the target for the band pass filter? Say 7.75 kHz? I was trying to follow how the frequency for the filter is calculated but got a little lost. Thanks.
To be honest, I don’t see any correlation between the filter algorithm and a particular frequency for the bandpass filter. I adapted the code from here: https://www.musicdsp.org/en/latest/Filters/29-resonant-filter.html
I’m not really an expert on filtering, so the algorith is a bit mysterious to me.
Hello I have a question if I can in the project connect a microphone and headphones to constantly listen to the microphone and change the frequency at the same time.
And is it possible to order the product including Arduino when the code is in Arduino
The Audio hacker has an input and output jack, so you can connect anything that has a stereo plug. A microphone must be powered, though, as shown in one of the projects. No, we do not sell Arduino boards.