0% found this document useful (0 votes)
30 views27 pages

Code For SSP

This document contains MATLAB code for a GUI that filters an audio signal into different frequency bands and allows the user to adjust the gains of each band. The GUI allows the user to load an audio file, play, pause, resume and stop the processed audio, and contains sliders to adjust the gain of each frequency band.

Uploaded by

reymarinda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views27 pages

Code For SSP

This document contains MATLAB code for a GUI that filters an audio signal into different frequency bands and allows the user to adjust the gains of each band. The GUI allows the user to load an audio file, play, pause, resume and stop the processed audio, and contains sliders to adjust the gain of each frequency band.

Uploaded by

reymarinda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 27

function varargout = GUIEq(varargin)

% GUIEQ MATLAB code for GUIEq.fig

% GUIEQ, by itself, creates a new GUIEQ or raises the existing

% singleton*.

% H = GUIEQ returns the handle to a new GUIEQ or the handle to

% the existing singleton*.

% GUIEQ('CALLBACK',hObject,eventData,handles,...) calls the local

% function named CALLBACK in GUIEQ.M with the given input arguments.

% GUIEQ('Property','Value',...) creates a new GUIEQ or raises the

% existing singleton*. Starting from the left, property value pairs are

% applied to the GUI before GUIEq_OpeningFcn gets called. An

% unrecognized property name or invalid value makes property application

% stop. All inputs are passed to GUIEq_OpeningFcn via varargin.

% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one

% instance to run (singleton)".

% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help GUIEq

% Last Modified by GUIDE v2.5 27-Nov-2017 16:22:08

% Begin initialization code - DO NOT EDIT

gui_Singleton = 1;

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


'gui_Singleton', gui_Singleton, ...

'gui_OpeningFcn', @GUIEq_OpeningFcn, ...

'gui_OutputFcn', @GUIEq_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 - DO NOT EDIT

% --- Executes just before GUIEq is made visible.

function GUIEq_OpeningFcn(hObject, eventdata, handles, varargin)

% This function has no output args, see OutputFcn.

% hObject handle to figure

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% varargin command line arguments to GUIEq (see VARARGIN)

global C;

C=ones(1,5);

axes(handles.axes);

xlabel('Time');

ylabel('Magnitude');
axes(handles.axes8);

title('Input Signal');

xlabel('Frequency')

ylabel('Magnitude');

axes(handles.axes7);

title('Output Signal');

xlabel('Frequency');

ylabel('Magnitude');

set(handles.slider1,'min',-20);

set(handles.slider1,'max',20);

set(handles.slider1,'value',1);

set(handles.slider1,'SliderStep',[0.025,0.05]);

set(handles.edit3,'string',num2str(1));

set(handles.slider6,'min',-20);

set(handles.slider6,'max',20);

set(handles.slider6,'value',1);

set(handles.slider6,'SliderStep',[0.025,0.05]);

set(handles.edit4,'string',num2str(1));

set(handles.slider7,'min',-20);

set(handles.slider7,'max',20);

set(handles.slider7,'value',1);

set(handles.slider7,'SliderStep',[0.025,0.05]);

set(handles.edit5,'string',num2str(1));

set(handles.slider8,'min',-20);

set(handles.slider8,'max',20);

set(handles.slider8,'value',1);
set(handles.slider8,'SliderStep',[0.025,0.05]);

set(handles.edit6,'string',num2str(1));

set(handles.slider9,'min',-20);

set(handles.slider9,'max',20);

set(handles.slider9,'value',1);

set(handles.slider9,'SliderStep',[0.025,0.05]);

set(handles.edit7,'string',num2str(1));

% Choose default command line output for GUIEq

handles.output = hObject;

% Update handles structure

guidata(hObject, handles);

% UIWAIT makes GUIEq wait for user response (see UIRESUME)

% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.

function varargout = GUIEq_OutputFcn(hObject, eventdata, handles)

% varargout cell array for returning output args (see VARARGOUT);

% hObject handle to figure

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure

varargout{1} = handles.output;
% --- Executes on key press with focus on pushbutton1 and none of its controls.

function pushbutton1_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton1 (see GCBO)

% eventdata structure with the following fields (see MATLAB.UI.CONTROL.UICONTROL)

% Key: name of the key that was pressed, in lower case

% Character: character interpretation of the key(s) that was pressed

% Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed

% handles structure with handles and user data (see GUIDATA)

global filename;

global y2;

global y3;

global y4;

global y5;

global y6;

global Fs;

global X;

[filename, pathname] = uigetfile({'*.wav';'*.*'},'File Selector');

set(handles.edit9,'string',filename);

[X,Fs]=audioread(filename);

h2=fir1(100,250/Fs,'low');

h3=fir1(100,[250/Fs 500/Fs],'bandpass');

h4=fir1(100,[500/Fs 2000/Fs],'bandpass');

h5=fir1(100,[2000/Fs 4000/Fs],'bandpass');

h6=fir1(100,4000/Fs,'high');

y2=filter(h2,1,X);

y3=filter(h3,1,X);

y4=filter(h4,1,X);

y5=filter(h5,1,X);
y6=filter(h6,1,X);

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

% --- Executes on button press in pushbutton2.

function pushbutton2_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton2 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

global filename;

global player;

global y;

global C;

global y2;

global y3;

global y4;

global y5;
global y6;

global X;

[X,Fs]=audioread(filename);

y=y2*C(1)+y3*C(2)+y4*C(3)+y5*C(4)+y6*C(5);

player = audioplayer(y,Fs);

play(player)

% --- Executes on button press in pushbutton3.

function pushbutton3_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton3 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

global player;

pause(player)

% --- Executes on button press in pushbutton4.

function pushbutton4_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton4 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

global player;
resume(player)

% --- Executes on button press in pushbutton5.

function pushbutton5_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton5 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

global player;

stop(player)

% --- Executes on slider movement.

function slider1_Callback(hObject, eventdata, handles)

% hObject handle to slider1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider

% get(hObject,'Min') and get(hObject,'Max') to determine range of slider

global C;

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

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

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

function slider1_CreateFcn(hObject, eventdata, handles)


% hObject handle to slider1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

%gain2=get(hObject,'value');

%set(handles.slider1,'String',num2str(gain2));

% set(handles.slider1,'Min',f(1));

% set(handles.slider1,'Max',f(501));

% set(handles.slider1,'SliderStep',[1/501,10/501]);

% a=get(handles.slider1,'Value');

% set(handles.text1,'string',num2str(a));

% guidata(hObject,handles);

% Hint: slider controls usually have a light gray background.

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

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

end

% --- Executes on slider movement.

function slider6_Callback(hObject, eventdata, handles)

% hObject handle to slider6 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider

% get(hObject,'Min') and get(hObject,'Max') to determine range of slider

global C;

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

set(handles.edit4,'string',num2str(C(2)));
% --- Executes during object creation, after setting all properties.

function slider6_CreateFcn(hObject, eventdata, handles)

% hObject handle to slider6 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.

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

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

end

% --- Executes on slider movement.

function slider7_Callback(hObject, eventdata, handles)

% hObject handle to slider7 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider

% get(hObject,'Min') and get(hObject,'Max') to determine range of slider

global C;

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

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

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

function slider7_CreateFcn(hObject, eventdata, handles)


% hObject handle to slider7 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.

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

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

end

% --- Executes on slider movement.

function slider8_Callback(hObject, eventdata, handles)

% hObject handle to slider8 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider

% get(hObject,'Min') and get(hObject,'Max') to determine range of slider

global C;

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

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

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

function slider8_CreateFcn(hObject, eventdata, handles)

% hObject handle to slider8 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.

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

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

end

% --- Executes on slider movement.

function slider9_Callback(hObject, eventdata, handles)

% hObject handle to slider9 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider

% get(hObject,'Min') and get(hObject,'Max') to determine range of slider

global C;

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

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

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

function slider9_CreateFcn(hObject, eventdata, handles)

% hObject handle to slider9 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.

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

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

end
function edit3_Callback(hObject, eventdata, handles)

% hObject handle to edit3 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit3 as text

% str2double(get(hObject,'String')) returns contents of edit3 as a double

global C;

C(1)=str2num(get(hObject,'string'));

minn=get(handles.slider1,'min');

maxx=get(handles.slider1,'max');

if(C(1)<minn || C(1)>maxx)

C(1)=get(handles.slider1,'value');

set(hObject,'string',num2str(0));

else

set(handles.slider1,'value',C(1));

end

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

function edit3_CreateFcn(hObject, eventdata, handles)

% hObject handle to edit3 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.

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

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

end

function edit4_Callback(hObject, eventdata, handles)

% hObject handle to edit4 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit4 as text

% str2double(get(hObject,'String')) returns contents of edit4 as a double

global C;

C(2)=str2num(get(hObject,'string'));

minn=get(handles.slider6,'min');

maxx=get(handles.slider6,'max');

if(C(2)<minn || C(2)>maxx)

C(2)=get(handles.slider6,'value');

set(hObject,'string',num2str(0));

else

set(handles.slider6,'value',C(2));

end

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

function edit4_CreateFcn(hObject, eventdata, handles)


% hObject handle to edit4 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.

% See ISPC and COMPUTER.

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

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

end

function edit5_Callback(hObject, eventdata, handles)

% hObject handle to edit5 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit5 as text

% str2double(get(hObject,'String')) returns contents of edit5 as a double

global C;

C(3)=str2num(get(hObject,'string'));

minn=get(handles.slider7,'min');

maxx=get(handles.slider7,'max');

if(C(3)<minn || C(3)>maxx)

C(3)=get(handles.slider7,'value');

set(hObject,'string',num2str(0));

else

set(handles.slider7,'value',C(3));

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

function edit5_CreateFcn(hObject, eventdata, handles)

% hObject handle to edit5 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.

% See ISPC and COMPUTER.

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

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

end

function edit6_Callback(hObject, eventdata, handles)

% hObject handle to edit6 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit6 as text

% str2double(get(hObject,'String')) returns contents of edit6 as a double

global C;

C(4)=str2num(get(hObject,'string'));

minn=get(handles.slider8,'min');

maxx=get(handles.slider8,'max');

if(C(4)<minn || C(4)>maxx)

C(4)=get(handles.slider8,'value');
set(hObject,'string',num2str(0));

else

set(handles.slider8,'value',C(4));

end

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

function edit6_CreateFcn(hObject, eventdata, handles)

% hObject handle to edit6 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.

% See ISPC and COMPUTER.

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

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

end

function edit7_Callback(hObject, eventdata, handles)

% hObject handle to edit7 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit7 as text

% str2double(get(hObject,'String')) returns contents of edit7 as a double

global C;

C(5)=str2num(get(hObject,'string'));
minn=get(handles.slider9,'min');

maxx=get(handles.slider9,'max');

if(C(5)<minn || C(5)>maxx)

C(5)=get(handles.slider9,'value');

set(hObject,'string',num2str(0));

else

set(handles.slider9,'value',C(5));

end

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

function edit7_CreateFcn(hObject, eventdata, handles)

% hObject handle to edit7 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.

% See ISPC and COMPUTER.

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

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

end

% --- Executes on button press in pushbutton7.

function pushbutton7_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton7 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

global C;
global y2;

global y3;

global y4;

global y5;

global y6;

global y;

y=y2*C(1)+y3*C(2)+y4*C(3)+y5*C(4)+y6*C(5);

% if(C(1)||C(2)||C(3)C(4)||C(5)==0

axes(handles.axes);

plot(y);

xlabel('Time');

ylabel('Magnitude');

function edit9_Callback(hObject, eventdata, handles)

% hObject handle to edit9 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

global filename;

set(hObject,'string',filename);

% Hints: get(hObject,'String') returns contents of edit9 as text

% str2double(get(hObject,'String')) returns contents of edit9 as a double

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

function edit9_CreateFcn(hObject, eventdata, handles)

% hObject handle to edit9 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.

% See ISPC and COMPUTER.

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

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

end

% --- Executes when figure1 is resized.

function figure1_SizeChangedFcn(hObject, eventdata, handles)

% hObject handle to figure1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes on selection change in listbox2.

function listbox2_Callback(hObject, eventdata, handles)

% hObject handle to listbox2 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns listbox2 contents as cell array

% contents{get(hObject,'Value')} returns selected item from listbox2

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

function listbox2_CreateFcn(hObject, eventdata, handles)

% hObject handle to listbox2 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB


% handles empty - handles not created until after all CreateFcns called

% Hint: listbox controls usually have a white background on Windows.

% See ISPC and COMPUTER.

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

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

end

% --- Executes on button press in pushbutton8.

function pushbutton8_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton8 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes on selection change in listbox3.

function listbox3_Callback(hObject, eventdata, handles)

% hObject handle to listbox3 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns listbox3 contents as cell array

% contents{get(hObject,'Value')} returns selected item from listbox3

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

function listbox3_CreateFcn(hObject, eventdata, handles)

% hObject handle to listbox3 (see GCBO)


% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: listbox controls usually have a white background on Windows.

% See ISPC and COMPUTER.

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

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

end

% --- Executes on selection change in popupmenu3.

function popupmenu3_Callback(hObject, eventdata, handles)

% hObject handle to popupmenu3 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu3 contents as cell array

% contents{get(hObject,'Value')} returns selected item from popupmenu3

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

function popupmenu3_CreateFcn(hObject, eventdata, handles)

% hObject handle to popupmenu3 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.

% See ISPC and COMPUTER.

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


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

end

% --- Executes on selection change in popupmenu4.

function popupmenu4_Callback(hObject, eventdata, handles)

% hObject handle to popupmenu4 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu4 contents as cell array

% contents{get(hObject,'Value')} returns selected item from popupmenu4

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

function popupmenu4_CreateFcn(hObject, eventdata, handles)

% hObject handle to popupmenu4 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.

% See ISPC and COMPUTER.

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

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

end

% --- Executes on selection change in popupmenu5.

function popupmenu5_Callback(hObject, eventdata, handles)


% hObject handle to popupmenu5 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu5 contents as cell array

% contents{get(hObject,'Value')} returns selected item from popupmenu5

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

function popupmenu5_CreateFcn(hObject, eventdata, handles)

% hObject handle to popupmenu5 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.

% See ISPC and COMPUTER.

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

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

end

% --- Executes on button press in pushbutton9.

function pushbutton9_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton9 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

global filename;

%global y;

global C;
global y2;

global y3;

global y4;

global y5;

global y6;

y=y2*C(1)+y3*C(2)+y4*C(3)+y5*C(4)+y6*C(5);

%out=y;

v=get(handles.popupmenu5,'Value');

% if v==1

% out=0;

if v==2

out=y2;

elseif v==3

out=y3;

elseif v==4

out=y4;

elseif v==5

out=y5;

elseif v==6

out=y6;

end

fs= 1000;

t=(0:1/fs:1);

fc=100;

sinwav1= sin(2*pi*t);

amwav=ammod(sinwav1,fc,fs);
[X,Fs]=audioread(filename);

nf=44100;

F=fft(y,nf);

f=Fs/2*linspace(0,1,nf/2+1);

axes(handles.axes8);

plot(f,abs(F(1:nf/2+1)))

title('Input Signal');

xlabel('Frequency');

ylabel('Magnitude');

axis tight;

zoom xon;

Z=fft(out,nf);

axes(handles.axes7);

plot(f,abs(Z(1:nf/2+1)))

title('Output Signal');

xlabel('Frequency');

ylabel('Magnitude');

axis tight;

zoom xon;

% --- Executes when user attempts to close figure1.

function figure1_CloseRequestFcn(hObject, eventdata, handles)

% hObject handle to figure1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hint: delete(hObject) closes the figure

delete(hObject);
% --- Executes on button press in pushbutton10.

function pushbutton10_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton10 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

run About;

You might also like