100% found this document useful (1 vote)
1K views

Matlab Audio Equalizer GUI

This document describes how to create a graphical audio equalizer in MATLAB. It discusses functions like uigetfile() to select audio files, isequal() to check if a file was selected, uiputfile() to save files, and fullfile() to build full file paths. It then provides an example of a 3-band equalizer design that uses filters, slider bars to control gain, and plots the original and filtered signals. The equalizer loads an audio file, applies low-pass, band-pass, and high-pass filters, allows adjusting the filter gains, and plays the output.

Uploaded by

junaid_256
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
1K views

Matlab Audio Equalizer GUI

This document describes how to create a graphical audio equalizer in MATLAB. It discusses functions like uigetfile() to select audio files, isequal() to check if a file was selected, uiputfile() to save files, and fullfile() to build full file paths. It then provides an example of a 3-band equalizer design that uses filters, slider bars to control gain, and plots the original and filtered signals. The equalizer loads an audio file, applies low-pass, band-pass, and high-pass filters, allows adjusting the filter gains, and plays the output.

Uploaded by

junaid_256
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 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