Você está na página 1de 41

PROJECT REPORT

ON
EQUALIZER IN MATLAB

BACHELOR OF TECHNOLOGY

(ELECTRONICS AND COMMUNICATION ENGINEERING)

Report Submitted By:

Tanuj Kohli :- 7210406906


Saloni Sharma :- 7210406890
Yogesh Dixit :- 80107508018

BHUTTA COLLEGE OF ENGINEERING & TECHNOLOGY


LUDHIANA, PUNJAB
Acknowledgement

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

our career in the competitive world of technology.

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

that they did to us.

Tanuj Kohli – 7210406906

Saloni Sharma – 7210406890

Yogesh Dixit - 80107508018

2
List of Figures

S . NO. Figures Page

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

S . NO. Table of Contents Page

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 and Software Requirements

Hardware:-

Laptop / Desktop

Disk space of 4.5GB or 4,211.00MB needed

Software compatible operating system

Minimum ram of 512MB needed

Minimum graphic card of 256MB needed

Software:-

Matlab (version 7.9.0 (R2009b) )

6
FIG. 1

Matlab is a software package for high-performance numerical computation and

visualizations. It provides an interactive environment with hundreds of built-in functions

for technical computation, graphics, and animation.

Best of all, it also provides easy extensibility with its own high-level programming

language. The name MATLAB stands for Matrix Laboratory.

Matlab’s built-in functions provide excellent tools for linear algebra computations, data

analysis, signal processing, optimization, numerical solution of ordinary differential

equations, quadrature and many other types of scientific computations.

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

and to use.GUIDE: A Brief Introduction

What Is GUIDE?

GUIDE, the MATLAB Graphical User Interface Development Environment, provides a

set of tools for creating graphical user interfaces (GUIs). These tools greatly simplify the

process of laying out and programming GUIs.

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

GUIDE from the context menu.

8
FIG. 2

When you right-click a FIG-file in this way, the figure opens in the GUIDE Layout

Editor, where you can work on it.

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.

Type of Video Video Content


MATLAB New Feature New Graphics and GUI Building Features in Version 7.6 (9

Demos min, 31 s)

New Graphics and GUI Building Features in Version 7.5 (2

min, 47 s)

New Creating Graphical User Interfaces features in Version

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

when you click this illustration.)

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

to increase/decrease volume, noise, or intensity of the input frequencies. The

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

our ears comfort.

In audio processing, equalization is the process of changing the spectrum of a

sound. Equalizers employ low-pass, band-pass, and high-pass filters to modify

different portions of a sound's spectrum. By changing the gains on these filters an

operator is able to modify the sound. An easy example to understand would be a

`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

The above block diagram is explained on next page.

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

block diagram in steps.

1. Load the desired wave file which you have to listen.

2. Now click the play button.

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

gain of the 5 filters used in the program(by varying slider).

4. Now again its your choice if you want to plot the changes you made to sound you can

otherwise you can continue listening to music.

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.

We can also represent our block diagram of equalizer

using Matlab in way of flow chart also. So for the sake of convenience we represent the

above block diagram in flow chart as shown on next page.

15
Flow Chart

Start

Open Matlab

Select file

Load *.wave 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:-

• Start the Matlab software.

• Open the Matlab directory.

• Select Equalizer.m file.

• Load the *.wav file by just clicking load button.

• Play the file by clicking play button.

• If the sound is ok then keep listening but the sound is not comfortable then

change the filters frequencies by just changing the sliding bars.

• 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

according to our ear comfort.

Also the main aim that the equalizer should be as simple as it can be operated on clicks

only is also achieved.

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

accuracy and versatility.

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

such a short time span only.

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

performance using Matlab.

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

function) should be used for the mp3 compatible.

The above discussion conclude that the Matlab is very simple to use and can be

implemented in real life also.

23
Bibliography

www.google.com

www.mathswork.com.

www.dsprelated.com

www.matlabconsultants.com

www.matlabforum.com

24
Appendix

function varargout = MyEqualizer(varargin)

gui_Singleton = 1;

gui_State = struct('gui_Name', mfilename, ...

'gui_Singleton', gui_Singleton, ...

'gui_OpeningFcn', @MyEqualizer_OpeningFcn, ...

'gui_OutputFcn', @MyEqualizer_OutputFcn, ...

'gui_LayoutFcn', [] , ...

'gui_Callback', []);

if nargin && ischar(varargin{1})

gui_State.gui_Callback = str2func(varargin{1});

end

if nargout

[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});

else

gui_mainfcn(gui_State, varargin{:});

end

% End initialization code

25
% --- Executes just before MyEqualizer is made visible.

function MyEqualizer_OpeningFcn(hObject, eventdata, handles, varargin)

global stop C Fs;

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();

% Choose default command line output

handles.output = hObject;

% Update handles structure

guidata(hObject, handles);

function varargout = MyEqualizer_OutputFcn(hObject, eventdata, handles)

27
varargout{1} = handles.output;

% --- Executes on slider movement.

function C1_var_Callback(hObject, eventdata, handles)

global C;

C(1)=get(hObject,'value');

set(handles.C1_val,'string',num2str(C(1)));

% --- Executes during object creation, after setting all properties.

function C1_var_CreateFcn(hObject, eventdata, handles)

if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor',[.9 .9 .9]);

end

% --- Executes on slider movement.

function C2_var_Callback(hObject, eventdata, handles)

global C;

28
C(2)=get(hObject,'value');

set(handles.C2_val,'string',num2str(C(2)));

% --- Executes during object creation, after setting all properties.

function C2_var_CreateFcn(hObject, eventdata, handles)

if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor',[.9 .9 .9]);

end

% --- Executes on slider movement.

function C3_var_Callback(hObject, eventdata, handles)

global C;

C(3)=get(hObject,'value');

set(handles.C3_val,'string',num2str(C(3)));

% --- Executes during object creation, after setting all properties.

function C3_var_CreateFcn(hObject, eventdata, handles)

if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor',[.9 .9 .9]);

29
end

% --- Executes on slider movement.

function C4_var_Callback(hObject, eventdata, handles)

global C;

C(4)=get(hObject,'value');

set(handles.C4_val,'string',num2str(C(4)));

% --- Executes during object creation, after setting all properties.

function C4_var_CreateFcn(hObject, eventdata, handles)

if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor',[.9 .9 .9]);

end

% --- Executes on slider movement.

function C5_var_Callback(hObject, eventdata, handles)

global C;

C(5)=get(hObject,'value');

30
set(handles.C5_val,'string',num2str(C(5)));

% --- Executes during object creation, after setting all properties.

function C5_var_CreateFcn(hObject, eventdata, handles)

if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor',[.9 .9 .9]);

end

% --- Executes on button press in plot_H.

function plot_H_Callback(hObject, eventdata, handles)

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]');

title('Caracteristica egalizorului audio');

axis([0 1e-3*Fs/2 -21 21]);

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.

function reset_H_Callback(hObject, eventdata, handles)

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();

function C1_val_Callback(hObject, eventdata, handles)

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

% --- Executes during object creation, after setting all properties.

function C1_val_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),

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

% --- Executes during object creation, after setting all properties.

function C2_val_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),

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

% --- Executes during object creation, after setting all properties.

function C3_val_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),

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

% --- Executes during object creation, after setting all properties.

function C4_val_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),

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

% --- Executes during object creation, after setting all properties.

function C5_val_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),

get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white');

end

% --- Executes on button press in load.

39
function load_Callback(hObject, eventdata, handles)

global file_name;

file_name=uigetfile('*wav','select .wav file');

% --- Executes on button press in play.

function play_Callback(hObject, eventdata, handles)

global stop file_name C;

stop=1;

equalizer_play();

function equalizer_play()

global stop file_name C;

[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

% --- Executes on button press in stop.

function stop_Callback(hObject, eventdata, handles)

global stop;

stop=0;

41

Você também pode gostar