Skip to content Skip to navigation

Connexions

You are here: Home » Content » Loud Speaker Equalization Project

Navigation

Recently Viewed

This feature requires Javascript to be enabled.
 

Loud Speaker Equalization Project

Module by: Chris Metzler, Abhijit Navlekar. E-mail the authorsEdited By: Chris Metzler, Abhijit Navlekar

Summary: Use the frequency response of a loud speaker to design and implement an inverse filter which equalizes the output.

Loudspeaker Equalization

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.

Figure 1
Figure 1 (graphics1.png)

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.

Figure 2
Figure 2 (graphics2.jpg)

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.

Figure 3
Figure 3 (graphics3.jpg)

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.

Figure 4
Figure 4 (graphics4.jpg)

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.

Figure 5
Figure 5 (graphics5.png)

h=fir2(62, ((10.^(linspace(0,1,length(targetfft))'))-1)/9,targetfft);

Figure 6
Figure 6 (graphics6.jpg)
The FIR2 command with 64 coefficients does an acceptable job of matching the shape of our ideal inverse filter. However, given more memory and more coefficients we could do any even better job of matching the ideal.

6. Verification

Finally to verify that the inverse filter is works, we played white noise through the speaker again and recorded the response.

Figure 7
Figure 7 (graphics7.jpg)

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.

Content actions

Download module as:

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks