Code covered by the BSD License  

Highlights from
audio signal filtering

image thumbnail
from audio signal filtering by rahul tulsian
this program give a real time application of audio signal filtering

filterdsound(varargin)
function varargout = filterdsound(varargin)

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @filterdsound_OpeningFcn, ...
                   'gui_OutputFcn',  @filterdsound_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 filterdsound is made visible.
function filterdsound_OpeningFcn(hObject, eventdata, handles, varargin)

% Choose default command line output for filterdsound
handles.output = hObject;

x1 = evalin('base', 'x1');
handles.x1=x1;
Fs = evalin('base', 'Fs');
handles.Fs=Fs;
b=evalin('base', 'b');
handles.b=b;
a=evalin('base', 'a');
handles.a=a;
s=evalin('base', 's');


axes(handles.soundpsd);
Pxx = periodogram(handles.x1);
Hpsd = dspdata.psd(Pxx,'Fs',handles.Fs);   % Create PSD data object
plot(Hpsd); 


axes(handles.soundtime);
plot(handles.x1);
xlabel('Time'); ylabel('Amplitude');

axes(handles.soundspec);
specgram(handles.x1, 1024, handles.Fs);
title('Signal Spectrogram');

switch(s)
    case(1)
        set(handles.chebydis,'Visible','off');
        set(handles.cheby,'Visible','off');
        set(handles.ellipticdis,'Visible','off');
        set(handles.elliptic,'Visible','off');
    case(2)
        set(handles.butterdis,'Visible','off');
        set(handles.butter,'Visible','off');
        set(handles.ellipticdis,'Visible','off');
        set(handles.elliptic,'Visible','off');
    case(3)
        set(handles.chebydis,'Visible','off');
        set(handles.cheby,'Visible','off');
        set(handles.butterdis,'Visible','off');
        set(handles.butter,'Visible','off');
end

% Update handles structure
guidata(hObject, handles);



% --- Outputs from this function are returned to the command line.
function varargout = filterdsound_OutputFcn(hObject, eventdata, handles) 

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on button press in FILTEREED SOUND.
function noisysound_Callback(hObject, eventdata, handles)

sound(handles.x1,handles.Fs);


% --- Executes on button press in impulseresponse.
function impulseresponse_Callback(hObject, eventdata, handles)
figure(1);
impz(handles.b,handles.a);
xlim([0 200]);

% --- Executes on button press in pzplot.
function pzplot_Callback(hObject, eventdata, handles)
figure(2);
zplane(handles.b,handles.a);

% --- Executes on button press in freqresponse.
function freqresponse_Callback(hObject, eventdata, handles)
figure(3);
freqz(handles.b,handles.a,128,handles.Fs);


% --- Executes on button press in stepresponse.
function stepresponse_Callback(hObject, eventdata, handles)

figure(4);
stepz(handles.b,handles.a);

Contact us at files@mathworks.com