Professional Documents
Culture Documents
Matlab Audio Equalizer GUI
Matlab Audio Equalizer GUI
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.
4.
5.
6.
7.
8.
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);
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));
Master Volume
Master_gain=gain2=get(handles.Volume,'valu
e');
y = y*Master_gain;
Wavplay(y,Fs);
axes(handles.axes1)
plot(t,fft_orig);
Similarly, for axes2
axes(handles.axes2)
Test Example