Overview
A loudspeaker converts sound from its electric form to an audible form. In doing so it introduces notable distortions (in both magnitude and phase) in the sound thus leading to poor sound quality. Loudspeaker Equalization has been developed to deal with such distortions and minimize them to a great extent. Loudspeaker equalization involves processing and correcting the frequency response of a loudspeaker so that the spectrum of the resulting output is close to the spectrum of the input. We implemented loudspeaker equalization by using MATLAB fir design tools and the TI 3245 EVM which has a built in 5 point adaptive filter.
To find the frequency response of our speaker we played white noise through the loudspeaker and recorded it onto a computer. The recording was then processed in MATLAB with the attached code to generate the frequency response of the white noise. Next we inverted the frequency response to find an ideal inverse filter to correct for the distortion of our speaker and give our system a flat overall frequency response. Finally we used MATLAB’s fir2 design tool to create a length 64 fir filter which we implemented on the chip.
![]() |
Objectives:
1. Find an accurate frequency response for the loudspeaker.
2. Invert this frequency response to get the inverse filter.
3. Implement it on the chip.
Procedure:
1. Frequency response:
The frequency response of the speaker describes everything from low frequency resonance to high frequency distortion. One of the ways to find a frequency response of a speaker is to blast white noise through the speaker and record the result. White noise contains all frequencies and thus can be used to describe the speaker’s response to any input signal. We generated white noise and recorded the response and then used Matlab’s fft command and a log log plot to view the response.
![]() |
The resulting frequency response describes the speaker but is very noisy.
2. Sampling and Smoothing the Response.
Next we sampled the frequency response logarithmically so that low frequencies would be weighted more importantly by our filter. This allows the logarithmic plot of our ideal inverse filter and the inverse filter implemented by our FIR coefficients to match (rather than matching only high frequencies). We then used MATLAB’s built in Savitzky Golay [ y = sgolayfilt(x,k,f)] filter to smooth the curve so as to reduce the noise of the response. The motivation behind this was to prevent the fir2 algorithm from trying to create an inverse filter with the inverse of the noise of our original filter.
![]() |
sampfft=thisfft(round(10.^(linspace(0,log10(length(thisfft)),1000)))); %sample fft logrithmicly at 1000 points
smoothfft=sgolayfilt(sampfft, 3, 71);
smoothfft(smoothfft<0)=0; %fix smoothing errors
semilogy(smoothfft)
title('Smoothed Frequency Response');
xlabel('Frequency');
ylabel('Response (dB)');
3. Low Frequency resonance:
The resonant frequency of a loudspeaker is the frequency at which it is most susceptible to an electric response and any departure from this frequency causes the response to drop sharply. Because it is difficult to flatten such large peaks and valleys located next to one another it’s necessary to highpass filter the input to remove all frequencies at and below the resonant frequency. The resonant frequency zone was identified by a small bump followed by sharp drop in the frequency response at ~500 Hz.
4. Inverting the Response
Inverting the response will yield the required inverse filter to equalize the speaker. This was achieved by simply flipping the frequency response of the loudspeaker over the frequency axis and scaling it appropriately.
![]() |
targetfft=(1./smoothfft);
semilogy(targetfft)
title('Ideal Inverse Filter');
xlabel('Frequency');
ylabel('Response (dB)');
5. Adaptive Filter on the TI chip.
To create a FIR filter which matched our desired inverse filter, we used the built in MATLAB filter design program called fir2 [b = fir2(n,f,m)]. This designs an n order FIR filter whose frequency response is characterized by the points in m and whose frequency is contained in the vector f. We entered these coefficients into the TI chip and produced an FIR filter.
![]() |
h=fir2(62, ((10.^(linspace(0,1,length(targetfft))'))-1)/9,targetfft);
![]() |
6. Verification
Finally to verify that the inverse filter is works, we played white noise through the speaker again and recorded the response.
![]() |
Our filter isn’t able to completely flatten the frequency response but it does smooth it significantly, especially at higher frequencies.
Conclusion
Using white noise and MATLAB’s FIR design tools we were able to successfully implement an inverse filter on TI’s 3245 EVM which flattened the systems frequency response. Unfortunately, when we played music through our speaker, various high frequency would be over-amplified, creating hissing. Throughout our experiment we recorded using a relatively low end microphone designed primarily to pick up speech signals. After comparing what the frequency response of our system looks like compared to how it actually sounds, we determined it was the microphone itself that was causing the attenuation of higher frequencies. Thus by amplifying higher frequencies, we flattened the frequency response of the system but spoilt the frequency response of our speakers.











