Академический Документы
Профессиональный Документы
Культура Документы
Assignment 03-04
2014
Audio Equalizer
Short
Report
SIDRA FAHIM
Fa-2012-MSEE-056
Sidra Fahim
Fa2012 MSEE 056
Table of Contents
Problem Statement.......................................................................................................... 3
Deliverables .................................................................................................................... 4
Requirements .................................................................................................................. 4
1.
2.
3.
Bibliography ........................................................................................................... 15
Sidra Fahim
Fa2012 MSEE 056
Table of Figures
Sidra Fahim
Fa2012 MSEE-056
Problem Statement
Make a software audio equalizer with the following frequency bands
[0 60 Hz], [60 Hz 170 Hz], [170 Hz 310 Hz], [310 Hz 600 Hz], [600 Hz 1 kHz],
[1 kHz 3kHz], [3 kHz 6 kHz], [6 kHz 12 kHz], [12 kHz 14 kHz], [14 kHz 16 kHz]
Deliverables
1. A software with GUI of an audio equalizer.
2. A short report containing problem statement and the methodology used. Explain all
the steps in methodology.
Requirements
1. Variable range of gain for all bands (-20dB to 20dB)
2. Read audio file from computer
3. Equalization in real-time
4. Play audio file. Button to play file.
5. Sliders to change frequency level.
6. Figure showing the frequency response of a multiband equalizer based on the
values of sliders
7. GUI in MATLAB.
Sidra Fahim
Fa2012 MSEE 056
1. AUDIO EQUALIZATION
Theory:-
It is a process to deliberately alter the tonal quality of audio passing through it. It does
this by using a number of filter circuits, which are capable of applying gain to audio
signals within specific frequency ranges both positive gain, referred to a 'boost', and
negative gain, referred to as 'cut'. [1]
1. Graphic Equalizers
In the graphic equalizer, the input signal is sent to a bank of filters. Each filter passes
the portion of the signal present in its own frequency range or band. The amplitude
passed by each filter is adjusted using a slide control to boost or cut frequency
components passed by that filter. The vertical position of each slider thus indicates the
gain applied at that frequency band, so that the knobs resemble a graph of the
equalizer's response plotted versus frequency. [2]
Sidra Fahim
Fa2012 MSEE 056
2. Parametric Equalizer
Parametric equalizers are multi-band variable equalizers which allow users to control
the three primary parameters: amplitude, center frequency and bandwidth. [2]The
amplitude of each band can be controlled, and the center frequency can be shifted, and
bandwidth ("Q") can be widened or narrowed.
Sidra Fahim
Fa2012 MSEE 056
1. Push buttons
Browse the .*wav files from computer to read and equalized.
After selecting the file, process button plots the frequency response of the
speech/audio file.
Play sound button for playing audio selected.
Gains can be set to zero by pressing Reset Gains button.
2. Panel
Process, Play Sound and Reset Gains options are grouped into an Option panel for the
user accessibility.
Sidra Fahim
Fa2012 MSEE 056
3. Sliders
10 different sliders with required cutoff frequencies are placed which can be changed by
user in real time.
4. Static Text
Few static texts are introduces such as Select, Frequencies, -20dB and 20dB. These
texts cant be edited in run-time.
5. Edit Texts
When users vary the gain of the sliders, the gain values appear in the edit text gadget
below each slider. Also, when user select the audio file from computer its path also
appear in an edit text box.
6. Tools
Following tools are added in tool bar:
Save figure, Legend, Print, Color Bar, Data cursor
Sidra Fahim
Fa2012 MSEE 056
3. M-file editing
Now click on open editor to see m-file related to the project. Audio_equalizer_sidra.m
contains a variety of functions related to sliders, push button, edit text buttons etc
Functions which are edited are shown below:
1. Browsing function
Figure 6 Browsing
Sidra Fahim
Fa2012 MSEE 056
end
2. Processing Function
This function reads and plots the sound wave as shown below:
% eventdata
% handles
global s Fs fs
Y=fftshift(fft(s));
% plot spectrum of bottom 5000Hz
hzFs=Fs*length(Y)/fs;
f=(0:hzFs)*fs/length(Y);
plot(handles.axes3,f,20*log10(abs(Y(1:length(f)))+eps));
legend('Spectrum');
xlabel('Frequency (Hz)');
ylabel('Magnitude (dB)');
drawnow;
Sidra Fahim
Fa2012 MSEE 056
Figure 7 Processing
function edit4_Callback(hObject,
eventdata, handles)
Figure 9 Editing sliders
get(handles.edit4,'string');
Sidra Fahim
Fa2012 MSEE 056
4. Update Filters
Two more functions are called inside sliders function:1. updategains.m
2. update_filters.m
function updategains
function update_filters
global hdls g
global g hdls Fs s fs
g(1)=get(hdls.slider12,'value');
g1=-10;
g(2)=get(hdls.slider13,'value');
g2=10;
g(3)=get(hdls.slider14,'value');
g(4)=get(hdls.slider15,'value');
f=[60
g(5)=get(hdls.slider16,'value');
Q=1*ones(1,n); % Q-factors
g(6)=get(hdls.slider17,'value');
filts_type=[1 2*ones(1,n-2) 3]; % filt types: 1-low shelving, 2peak, 3-high shelving
g(7)=get(hdls.slider18,'value');
g(8)=get(hdls.slider19,'value');
g(9)=get(hdls.slider20,'value');
170 310
6e3
12e3
14e3
16e3]; % frequencies
Y=zeros(size(s));
for nc=1:n
switch filts_type(nc)
g(10)=get(hdls.slider21,'value');
case 1
end
[b a]=get_low_shelving_filter(g(nc),Q(nc),f(nc),Fs);
y=filter(b, a, s);
case 2
[b a]=get_peak_filter(g(nc),Q(nc),f(nc),Fs);
y=filter(b, a, s);
case 3
[b a]=get_high_shelving_filter(g(nc),Q(nc),f(nc),Fs);
y=filter(b, a, s);
end
Y=Y+y;
end
Sidra Fahim
Fa2012 MSEE 056
Update_filter is the core part of equalizer. Filters used in equalizer are
1. Low/High shelving filter
A filter designed to alter the level of all signals beyond a certain frequency by a userdefinable amount.
function [b a]=
get_high_shelving_filter(g,Q,f,Fs)
function [b a]=
get_low_shelving_filter(g,Q,f,Fs)
A=10^(g/40);
A=10^(g/40);
w=2*pi*f/Fs;
w=2*pi*f/Fs;
sn=sin(w);
sn=sin(w);
cs=cos(w);
cs=cos(w);
bt=sqrt(A)/Q;
bt=sqrt(A)/Q;
b=A*[(A+1)+(A-1)*cs+bt*sn,...
b=A*[(A+1)-(A-1)*cs+bt*sn,...
-2*((A-1)+(A+1)*cs),...
2*((A-1)-(A+1)*cs),...
(A+1)+(A-1)*cs-bt*sn];
(A+1)-(A-1)*cs-bt*sn];
a=[(A+1)-(A-1)*cs+bt*sn,...
a=[(A+1)+(A-1)*cs+bt*sn,...
2*((A-1)-(A+1)*cs),...
-2*((A-1)+(A+1)*cs),...
(A+1)-(A-1)*cs-bt*sn];
(A+1)+(A-1)*cs-bt*sn];
b=b/a(1);
b=b/a(1);
a=a/a(1);
a=a/a(1);
Sidra Fahim
Fa2012 MSEE 056
2. Peak Filter:It boosts a specific band of frequencies. Q is a measure of the width of the frequency
range altered by a peaking filter.
function [b a]=
get_peak_filter(g,Q,f,Fs)
A=10^(g/40);
w=2*pi*f/Fs;
sn=sin(w);
cs=cos(w);
al=sn/(2*Q);
b=[1+al*A
-2*cs
1-al*A];
a=[1+al/A
-2*cs
1-al/A];
b=b/a(1);
Figure 11 Peak Filtering
a=a/a(1);
5. Play Sound
This button reads the file from the path given in the browse window.
% --- Executes on button press in Play Sound.
function pushbutton13_Callback(hObject, eventdata, handles)
global s fs;
sound(s,fs);
6. Reset Gains
This button set all the gains of the frequency bands to zero.
% --- Executes on button press in Reset.
function Reset_Callback(hObject, eventdata, handles)
global g n;
n=10;
g=zeros(n,1);
set(handles.slider12,'value',0);
set(handles.edit4,'string',0);
get(handles.edit4,'string');
Sidra Fahim
Fa2012 MSEE 056
3. Bibliography
[1] "Equalizer
Explained,"
1985.
[Online].
Available: