Implementing a basic EQ

Status
Not open for further replies.

Nolebrain

Member
Hi all,

I need some project guidance how to implement an equalizer using Teensy. As a preface I am not an audio expert, so my apologies in advance. My project reads audio through the ADC and passes the audio through to an external speaker, but I need the ability to manually tune and gain up specific frequencies. I am aware that the STGL5000 stereo codec has a 5-band EQ, but I need much more than 5 bands. I looked around and only need "graphic" equalizers, which provide a DC response for specific frequency bands. I do not need this, instead I am wondering if it is possible to add a gain to specific frequencies or manipulate the signal to make certain frequencies more prominent. This would need to happen quickly and process it in real-time.

The frequency range I am using is between 100-700 Hz. I am curious if I need to use a dedicated DSP chip which can be controlled from the Teensy's processor to achieve this or can it be done through FIR filtering.

Finite Impulse Response filters take the FFT of the signal and multiply a filter (such as a band pass) to preform a convolution of the signal. This result is then converted back to the time domain using an IFFT, then the output as a filtered signal.

The structure of this project is to mimic how a hearing aid works. I assume that modern hearing aids use a DSP and FIR filtering to achieve gaining up frequencies that the hear loses (17-20 kHz). Can anyone shed some light on how this is done and is Teensy capable of achieving this?

-NB
 
Paul,

Thanks for replying to the thread. I was hoping FFT objects could be the answer. I have no idea how modern hearing-aids work. Could you give me a direction on how to implement this? I have done the FFT tutorial, and can store the data in an array. I assume that I need to perform some sort of computation on the FFT data then create an IFFT to play it through the stereo codec.
 
Researching a bit more I found Paul's post on using Teensy to make an active Equalizer.

The Teensy Audio Library can probably help you with this. You'll probably want to get the new Teensy 3.6 for more processing power if you wish to implement a large number of bands.

FFT is probably not a good approach. The idea is seductive: just turn the samples into frequencies, adjust them, and then use inverse FFT to turn back to time domain samples. But FFT works in blocks, giving you the spectrum as if the signal within the block repeats infinitely. Music changes, rather than repeating waveforms for long times, where those variations over time are what creates the musically pleasing qualities we humans perceive. Discontinuities at the block boundaries tend to become audible artifacts, no matter how well the FFT works within each block. Those artifacts can sound pretty terrible.

The common approach is to run the audio into many bandpass filters. Then adjust the gain of each, and sum them back to form the output signal. If using FIR filters, you might also add delay elements on the higher bands. The audio library has all these features in the design tool, so you can just drag the input, filters, mixers and output onto the canvas, wire them up, export code into Arduino, and add just a bit of code to read pots or sensors and alter the mixer channel gains while the library processes sound.

This tutorial (31 page PDF, or 48 minute video) is the place to start, if you're not familiar with the system. It's very easy to use with the design tool and small amounts of Arduino code to control the audio objects.

Sounds much easier than I imagined. I will give this a shot!
 
Using this approach I carried the analog signal into 16 different band-pass filters ranging from 80-1280 Hz. Then summed them with a series of mixers, then play them back through i2s1.

Here is a picture of my audio sketch. I am sure there are a few things incorrect about it, can anyone proof check this? I am still quite new to using the audio design tool.

https://imgur.com/a/iwBlu
 
Status
Not open for further replies.
Back
Top