Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 19

Graphicl Audio Equalizer in

GUI Matlab
M. Junaid Iqbal

UIGETFILE()
[FileName,PathName] = uigetfile('*.m','Select the M-file');
[filename, pathname] = ...
uigetfile({'*.m';'*.mdl';'*.mat';'*.*'},'File Selector');
[filename, pathname] = uigetfile( ...
{'*.m;*.fig;*.mat;*.mdl','MATLAB Files (*.m,*.fig,*.mat,*.mdl)';
'*.m', 'M-files (*.m)'; ...
'*.fig','Figures (*.fig)'; ...
'*.mat','MAT-files (*.mat)'; ...
'*.mdl','Models (*.mdl)'; ...
'*.*', 'All Files (*.*)'}, ...
'Pick a file');

ISEQUAL()
[filename, pathname] = uigetfile('*.m', 'Pick an M-file');
if isequal (filename,0) | isequal(pathname,0)
disp('User selected Cancel')
else
disp(['User selected',fullfile(pathname,filename)])
end

UIPUTFILE()
[filename, pathname] = uiputfile( ...
{'*.m';'*.mdl';'*.mat';'*.*'}, ...
'Save as');

FULLFILE()
Builds a full filename from the directories
and filename specified.
f = fullfile('C:','Applications','matlab','myfun.m')

f =C:\Applications\matlab\myfun.m

GET()
Z=get(handles.slider_1,Value);
Gets the value of a slider using its handles
and updates the variable Z.
Note:
Get() function is used to get the value from GUI.

SET()
Z=set(handles.edit1,'String',num2str(slider1));
Sets the value of a slider using its handles and updates
the variable Z.

Note:
set() function is used to get the value from function
to GUI.

ISEMPTY
Test if array is empty
True=1; else 0
E.g
if isempty(file)
return
else
do this

guidata
guidata(object_handle, data)
stores the variable data in the figure's
application data.

Design Example 3-Band Eq


1. Browse file.
2. Read it and then play.
3. Filter it using different filters. (3 filters).

4.
5.
6.
7.
8.

Filter 1300 low pass


Filter 2 0.3-3 KHz bandpass
Filter 3 3 KHz High Pass
Master volume control
Plot the original and filtered signal.

Step 1
[filename, pathname] = uigetfile({'*.wav';'*.*'},'File
Selector');
if isequal([filename,pathname],[0,0])
return
% Otherwise construct the fullfilename and Check and load
the file.

else
File = fullfile(pathname,filename)
handles.play=File
guidata(hObject,handles)
end

Step 2
[X,Fs]=wavread(z);

Step 3
%Implementing Filters
h2=fir1(100,2*300/Fs,'low');
h3=fir1(100,[2*300/Fs 2*3000/Fs],'bandpass');
h4=fir1(100,[2*3000/Fs 2*6000/Fs],'bandpass');

Step 3 Cont
% Filtering
y2=filter(h2,1,X);
y3=filter(h3,1,X);
y4=filter(h4,1,X);

Getting the values of the silder bars


gain2=get(handles.s1,'value');

set(handles.edit1,'String',num2str(gain2));
gain3=get(handles.s2,'value');
set(handles.edit2,'String',num2str(gain2));

gain4=get(handles.s3,'value');
set(handles.edit3,'String',num2str(gain2));

Creating the filtered signal

y = y2*gain2 + y3*gain3 + y4*gain4;

Master Volume
Master_gain=gain2=get(handles.Volume,'valu
e');

y = y*Master_gain;
Wavplay(y,Fs);

Plots (axes control)


t=-pi:2*pi/1023:pi;
fft_orig=fftshift(abs(fft(X,1024)));

axes(handles.axes1)
plot(t,fft_orig);
Similarly, for axes2

axes(handles.axes2)

Test Example

You might also like