Report
Report
ON
EQUALIZER IN MATLAB
BACHELOR OF TECHNOLOGY
The submission of this project gives both of us an opportunity to convey our gratitude to
all those who have helped us reach a stage where we have immense confidence to launch
We have no second thought in admitting that it is our respected lecturers who have
played a significant role in shaping our career and we would be miserably failing in our
duty if we don’t extend our heart filled gratitude and sincere acknowledgement to our
project guide ER. SATINDER GILL, who has been a source of perpetual inspiration to
us, gently guiding and paving our way towards a bright career. Both were ever willing to
give us all kind of support and encouragement. We are very thankful to both for being an
inspired project in charge and for providing necessary help throughout our project work.
And in the end we would like to thank our parents and almighty GOD for all the things
2
List of Figures
No.
1. Logo 07
2. How to open Matlab 09
3. Working Layout of Guide 10
4 New file of Guide 11
5 Block Diagram 14
6 Flow Chart 16
7 GUI appearance to us when we run program 18
8 Effect of Equalizer-1 19
9 Effect of Equalizer-2 20
10 Effect of Equalizer-3 21
Table of Contents
No.
3
1 Objective 5
2 Inspiration 6
3 Hardware and software requirements 7
4 System description 13
5 System block diagram 14-15
6 System flow chart 16-17
7 Result 18
8 Conclusion 22
9 Discussion 23
10 Bibliography 24
11 Appendix 25-41
Objective
This basic objective of this project is to detect the sound wave loaded in it and it Equalize
it. This project uses the WAVE READ function to read the input file. We give the input
in the form of wave file in the .wav format which can be analyzed and can be adjusted
according to our ear comfort. The basic platform to make this application is GUI on the
MATLAB. This project is applicable wherever we need to equalize any wave file in such
way that it could be listened clearly and noise free. This project is very helpful and is
very easy to use. This project can be used by our one finger only. By just clicking
different buttons we can remove noise and adjust our input sound according to our wish.
4
Inspiration
Once I was sitting and listening music but I was not comfortable with the sound of the
head phone. Then I used the equalizers provided in my phone and I set that equalizer
which suits my ears best. Then suddenly an idea of making my own equalizer stroked
into my mind and I discussed this topic of designing equalizer with my friends and they
found it very interesting and at that time only we searched on internet that how can we
make or design our own equalizer. Then we found several software on which we can
make or design our own equalizer. Now we were little bit confused that which software
we should use for designing equalizer. We consult our friends about this then they
recommended us to design in flash 8 but that was quite difficult for us because we
5
haven’t done any work on flash 8 and even we haven’t heard about it before. So we went
to our project in-charge, Er. Satinder Singh Gill. He suggested us to design the equalizer
in Matlab. As we have already done Matlab in our previous semester thus we decided to
design our own equalizer in Matlab only. But now the big problem was to make it easy so
that it can be used on clicks only, so we decided to make a GUI application on Matlab .
Hardware:-
Laptop / Desktop
Software:-
6
FIG. 1
Best of all, it also provides easy extensibility with its own high-level programming
Matlab’s built-in functions provide excellent tools for linear algebra computations, data
Most of these functions use state-of-the-art algorithms. These are numerous functions for
2-D and 3-D graphics, as well as for animations. Also, for those who cannot do without
their FORTRAN or C codes, Matlab even provides an external interface to run those
7
programs from within the Matlab. The user, however, is not limited to the built in
functions; he can write his own functions in the Matlab language. Once written, these
functions behave just like the built-in functions. Matlab’s language is very easy to learn
What Is GUIDE?
set of tools for creating graphical user interfaces (GUIs). These tools greatly simplify the
Opening GUIDE
There are several ways to open GUIDE from the MATLAB Command line.
Command Result
Guide Opens GUIDE with a choice of GUI templates
guide FIG-file name Opens FIG-file name in GUIDE
You can also right-click a FIG-file in the Current Folder Browser and select Open in
8
FIG. 2
When you right-click a FIG-file in this way, the figure opens in the GUIDE Layout
9
FIG. 3
All tools in the tool palette have tool tips. Setting a GUIDE preference lets you display
the palette in GUIDE with tool names or just their icons. See GUIDE Preferences for
more information.
10
Getting Help in GUIDE
When you open GUIDE to create a new GUI, a gridded layout area displays. It has a
menu bar and toolbar above it, a tool palette to its left, and a status bar below it, as shown
below. See GUIDE Tools Summary for a full description. At any point, you can access
help topics from the GUIDE Help menu, shown in the following illustration.
FIG. 4
The first three options lead you to topics in the GUIDE documentation that can help you
get started using GUIDE. The Example GUIs option opens a list of complete examples
of GUIs built using GUIDE that you can browse, study, open in GUIDE, and run.
11
The bottom option, Online Video Demos, opens a list of GUIDE- and related GUI-
building video tutorials on MATLAB Central. You can access MATLAB video demos,
as well as the page on MATLAB Central by clicking links in the following table.
Demos min, 31 s)
min, 47 s)
7 (4 min, 24 s)
MATLAB Central Video Archive for the "GUI or GUIDE" Category from 2005 to
Tutorials present.
Most of the MATLAB Central video tutorials are informal and brief, lasting 5 min. or
less. Each covers a specific topic, such as "Accessing data from one widget to another in
GUIDE." See the following static screen shot of one such video. (The video does not play
12
System Description
The equalizer will receive various inputs; namely, frequencies, which will be
targeted to improve or distort the sound. Upto 31 bands will be available in order
equalizer will feature graphic sliders for the bands and will indicate appropriate
decibel ranges. But in this project we have designed an GUI application on matlab using
5 graphic sliders by which we can adjust the sound of the loaded wave file according to
`Bass Booster,' where the user adds gain to the low frequencies and thereby
increases the `bass' of a song. Generally, equalizers have ten different bands that a
person is able to manipulate. But in this project we are filtering the input wave
signal by 5 bands
13
System Block Diagram
LPF
BPF1
BPF2
Load *.wav Choic
Play
file e
BPF3
HPF
Plot Stop
Reset
Fig. 5
14
As we have said that our project is so simple to operate as to click buttons only. The
block diagram is shown above which is very simple to understand. Now let us explain the
3. If the sound of the wave file is ok to your ears then you can listen it without any
change but if the sound is not ok the you can adjust the voice of file by changing the
4. Now again its your choice if you want to plot the changes you made to sound you can
5. If you want to listen another song you can click on reset button and repeat the steps.
6. Otherwise you can stop the program and come out of it.
using Matlab in way of flow chart also. So for the sake of convenience we represent the
15
Flow Chart
Start
Open Matlab
Select file
Play
Yes
Want to
Change freq.
Using filters
equalize?
No
Plot
Stop playing
Yes
Reset?
No
Stop
Fig.6
16
The equalization of any wave file is so easy that it could be done by just clicking some
buttons or by following some steps. This can be explained as the above flow diagram. By
just following the steps according to the flow diagram one can easily equalize *.wav file
and listen to it at that sound which suites his/her ears best. Steps cab be explained as
follows:-
• If the sound is ok then keep listening but the sound is not comfortable then
• Now if you want to plot the wave file frequencies then click on the plot button.
• Otherwise its your choice now if you want to listen the next song you can stop the
previous one and again by clicking load button you can load the next file and
follow the steps ahead or you can exit the Matlab software.
17
Results
We are able to design our own equalizer through which we can adjust the sound output
Also the main aim that the equalizer should be as simple as it can be operated on clicks
FIG. 7
18
FIG. 8
19
FIG. 9
20
FIG. 10
21
Conclusion
After completing our project we conclude that this Matlab software is such a tool which
can be used to simplify our daily used application and it can be used to design our own
application also. Matlab is software that provides a very user friendly environment with
As in our this project Matlab help us a lot to achieve the success in our mission by
providing the GUI platform and in this function that support us to make this project in
22
Discussion
The block diagram and flow chart of equalizer using Matlab is shown in fig.1 and fig.2.
Block diagram shows the complete working about equalizers using Matlab. In this we can
easily sort out the noise from the signal and provides the desirable output. In this we need
a wave file which we want to play. Equalizer is used to remove noise from the signal and
equalize the output as per desired. In our equalizer we use five filters in which one is low
pass filter one is high pass filter and the rest three are band pass filters. The low pass
filters are using frequencies below 4 kHz whereas the three band pass filters using
frequencies between 4 kHz to 19 kHz. Above frequencies of 19 kHz is used by high pass
filter in equalizer. We use Matlab for equalizing our song and we obtain the desired
output which we want. However, a desirable output is achieved with better music
But the major drawback of this program is that it can read only wave file we have already
discussed that the *.mp3 file can also be used in this project but the functions (Matlab
The above discussion conclude that the Matlab is very simple to use and can be
23
Bibliography
www.google.com
www.mathswork.com.
www.dsprelated.com
www.matlabconsultants.com
www.matlabforum.com
24
Appendix
gui_Singleton = 1;
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
else
gui_mainfcn(gui_State, varargin{:});
end
25
% --- Executes just before MyEqualizer is made visible.
stop=1;
Fs=44100;
C=zeros(1,5);
set(handles.C1_var,'min',-20);
set(handles.C1_var,'max',20);
set(handles.C1_var,'value',0);
set(handles.C1_var,'SliderStep',[0.025,0.05]);
set(handles.C1_val,'string',num2str(0));
set(handles.C2_var,'min',-20);
set(handles.C2_var,'max',20);
set(handles.C2_var,'value',0);
set(handles.C2_var,'SliderStep',[0.025,0.05]);
set(handles.C2_val,'string',num2str(0));
set(handles.C3_var,'min',-20);
set(handles.C3_var,'max',20);
set(handles.C3_var,'value',0);
set(handles.C3_var,'SliderStep',[0.025,0.05]);
26
set(handles.C3_val,'string',num2str(0));
set(handles.C4_var,'min',-20);
set(handles.C4_var,'max',20);
set(handles.C4_var,'value',0);
set(handles.C4_var,'SliderStep',[0.025,0.05]);
set(handles.C4_val,'string',num2str(0));
set(handles.C5_var,'min',-20);
set(handles.C5_var,'max',20);
set(handles.C5_var,'value',0);
set(handles.C5_var,'SliderStep',[0.025,0.05]);
set(handles.C5_val,'string',num2str(0));
equalizer_plot();
handles.output = hObject;
guidata(hObject, handles);
27
varargout{1} = handles.output;
global C;
C(1)=get(hObject,'value');
set(handles.C1_val,'string',num2str(C(1)));
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
global C;
28
C(2)=get(hObject,'value');
set(handles.C2_val,'string',num2str(C(2)));
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
global C;
C(3)=get(hObject,'value');
set(handles.C3_val,'string',num2str(C(3)));
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
29
end
global C;
C(4)=get(hObject,'value');
set(handles.C4_val,'string',num2str(C(4)));
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
global C;
C(5)=get(hObject,'value');
30
set(handles.C5_val,'string',num2str(C(5)));
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
global C Fs;
equalizer_plot();
function equalizer_plot()
global C Fs;
[a,b]=coef();
H=0;
for i=1:5
H=H+10^(C(i)/20)*abs(freqz(b{i},a{i},1024));
end
31
plot(1e-3*Fs*[0:1023]/2048,20*log10(H));
xlabel('Frequency [kHz]');
ylabel('Magnitude [dB]');
grid on;
function [a,b]=coef()
global Fs;
%Filtrul 1
Rp1=0.5;
Rs1=30;
Fp1=4.1e3/(Fs/2);
Fs1=4.5e3/(Fs/2);
n1=cheb1ord(Fp1,Fs1,Rp1,Rs1);
[b1,a1]=cheby1(n1,Rp1,Fp1,'low');
%Filtrul 2
Rp2=0.5;
Rs2=30;
Fp2=1e3*[4.25,8.75]/(Fs/2);
Fs2=1e3*[3.9,9.35]/(Fs/2);
n2=cheb1ord(Fp2,Fs2,Rp2,Rs2);
[b2,a2]=cheby1(n2,Rp2,Fp2);
32
%Filtrul 3
Rp3=0.5;
Rs3=30;
Fp3=1e3*[8.95,13.25]/(Fs/2);
Fs3=1e3*[8.35,13.65]/(Fs/2);
n3=cheb1ord(Fp3,Fs3,Rp3,Rs3);
[b3,a3]=cheby1(n3,Rp3,Fp3);
%Filtrul 4
Rp4=0.5;
Rs4=30;
Fp4=1e3*[13.4,16.8]/(Fs/2);
Fs4=1e3*[13,17.5]/(Fs/2);
n4=cheb1ord(Fp4,Fs4,Rp4,Rs4);
[b4,a4]=cheby1(n4,Rp4,Fp4);
%Filtrul 5
Rp5=0.5;
Rs5=30;
Fp5=1e3*17/(Fs/2);
Fs5=1e3*17.4/(Fs/2);
n5=cheb1ord(Fp4,Fs4,Rp4,Rs4);
[b5,a5]=cheby1(n5,Rp5,Fp5,'high');
a={a1,a2,a3,a4,a5};
b={b1,b2,b3,b4,b5};
33
% --- Executes on button press in reset_H.
global Fs C;
C=zeros(1,5);
Fs=44100;
set(handles.C1_val,'string',num2str(0));
set(handles.C2_val,'string',num2str(0));
set(handles.C3_val,'string',num2str(0));
set(handles.C4_val,'string',num2str(0));
set(handles.C5_val,'string',num2str(0));
set(handles.C1_var,'value',0);
set(handles.C2_var,'value',0);
set(handles.C3_var,'value',0);
set(handles.C4_var,'value',0);
set(handles.C5_var,'value',0);
equalizer_plot();
34
global C;
C(1)=str2num(get(hObject,'string'));
minn=get(handles.C1_var,'min');
maxx=get(handles.C1_var,'max');
if(C(1)<minn || C(1)>maxx)
C(1)=get(handles.C1_var,'value');
set(hObject,'string',num2str(0));
else
set(handles.C1_var,'value',C(1));
end
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
35
function C2_val_Callback(hObject, eventdata, handles)
global C;
C(2)=str2num(get(hObject,'string'));
minn=get(handles.C2_var,'min');
maxx=get(handles.C2_var,'max');
if(C(2)<minn || C(2)>maxx)
C(2)=get(handles.C2_var,'value');
set(hObject,'string',num2str(0));
else
set(handles.C2_var,'value',C(2));
end
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
36
function C3_val_Callback(hObject, eventdata, handles)
global C;
C(3)=str2num(get(hObject,'string'));
minn=get(handles.C3_var,'min');
maxx=get(handles.C3_var,'max');
if(C(3)<minn || C(3)>maxx)
C(3)=get(handles.C3_var,'value');
set(hObject,'string',num2str(0));
else
set(handles.C3_var,'value',C(3));
end
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
37
function C4_val_Callback(hObject, eventdata, handles)
global C;
C(4)=str2num(get(hObject,'string'));
minn=get(handles.C4_var,'min');
maxx=get(handles.C4_var,'max');
if(C(4)<minn || C(4)>maxx)
C(4)=get(handles.C4_var,'value');
set(hObject,'string',num2str(0));
else
set(handles.C4_var,'value',C(4));
end
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
38
function C5_val_Callback(hObject, eventdata, handles)
global C;
C(5)=str2num(get(hObject,'string'));
minn=get(handles.C5_var,'min');
maxx=get(handles.C5_var,'max');
if(C(5)<minn || C(5)>maxx)
C(5)=get(handles.C5_var,'value');
set(hObject,'string',num2str(0));
else
set(handles.C5_var,'value',C(5));
end
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
39
function load_Callback(hObject, eventdata, handles)
global file_name;
stop=1;
equalizer_play();
function equalizer_play()
[x,Fs]=wavread(file_name);
[a,b]=coef();
l_bucata=2*Fs;
Nb=round(length(x)/l_bucata);
y=0;
for i=1:floor(Nb)
bucata=x((i-1)*l_bucata+1:i*l_bucata);
for k=1:5
40
y=y+filter(10^(C(k)/20)*b{k},a{k},bucata);
if(stop==0)
break;
end
end
wavplay(y,Fs,'async');
y=0;
if(stop==0)
break;
end
end
global stop;
stop=0;
41