<< Chapter < Page Chapter >> Page >
Description of how to use frequency binning to apply frequency gains analogous to a graphic equalizer in MATLAB.

The main focus of a graphic equalizer is to manipulate different bands of frequencies, and then reconstruct them. Therefore, to manipulate the frequencies, a group of samples were taken, and the Fast Fourier Transform of the sample set was computed. In order to maximize the efficiency of the FFT, a sample set of a power of two was used. FFTs maximize symmetry in the Discrete Fourier Transforms and are best able to do that for signals of power of two lengths. Hence a refresh rate such that 2048 samples were taken in was chosen.

Once the signal is put into the Fourier domain, we then need to separate the frequencies into the desired bands so that they can be displayed, operated on, and then be displayed in their updated state. To do this we used a binning matrix. The matrix binned according to a logarithmic Q binning pattern. This means it puts the first and 2048th frequency in the first bin, the second, third, 2047th and 2046th frequencies in the second bin and so on and so forth. The matrix below is an example of how a bin matrix would look for an eight bit Fast Fourier Transform.

Example of a bin matrix for a length 8 FFT.

The code to generate matrices of this form is below.

[n, bin] = histc(freqs, freqbins);

bin = bin(:,1:spt/2);

binmatrixa0 = zeros(length(n)-1, length(bin));

for k = 1:(length(n)-1)

binmatrixa0(k,:) = bin == k ;

end

binmatrixb0 = fliplr(binmatrixa0);

binmatrix0 = [binmatrixa0, binmatrixb0]

Once the bins are generated by multiplying the bin matrix with the FFT vector, the bins’L2 norms are generated and displayed in bar graph form. Then, all the contents of all the bins are multiplied by what the user inputs in the GUI slide bars. The L2 norms are taken again and displayed in a bar graph as well.

The multiplying the frequency bins by a constant, it is the equivalent of passing the signal through several different ideal band pass filters. This is possible, because the signals are of finite length. Therefore, a discrete sinc of this length can create a perfect discrete band pass filter.

Once these gains have been applied, the vectors representing each of the bins are recombined to reform a 2048 Fast Fourier Transform vector. The signal is then Inverse Fast Fourier Transformed to allow for the display of the time wave form, and to allow for the application of time domain effects.

The last problem that needs to be taken into account is the phase. Due to the application of non-uniform gain to the bins, there is phase added to the output waveform. This phase needs to be removed, because the equalizer is supposed to output to speakers, and speakers can only interpret real signals.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Elec 301 projects fall 2007. OpenStax CNX. Dec 22, 2007 Download for free at http://cnx.org/content/col10503/1.1
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Elec 301 projects fall 2007' conversation and receive update notifications?

Ask