www.pudn.com > SPEECH-ANALYSIS-GUI.rar > tl.m, change:2008-12-28,size:8545b


function varargout = tl(varargin) 
% TL M-file for tl.fig 
%      TL, by itself, creates a new TL or raises the existing 
%      singleton*. 
% 
%      H = TL returns the handle to a new TL or the handle to 
%      the existing singleton*. 
% 
%      TL('CALLBACK',hObject,eventData,handles,...) calls the local 
%      function named CALLBACK in TL.M with the given input arguments. 
% 
%      TL('Property','Value',...) creates a new TL or raises the 
%      existing singleton*.  Starting from the left, property value pairs are 
%      applied to the GUI before tl_OpeningFunction gets called.  An 
%      unrecognized property name or invalid value makes property application 
%      stop.  All inputs are passed to tl_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 
 
% Copyright 2002-2003 The MathWorks, Inc. 
 
% Edit the above text to modify the response to help tl 
 
% Last Modified by GUIDE v2.5 28-Dec-2008 01:37:37 
 
% Begin initialization code - DO NOT EDIT 
gui_Singleton = 1; 
gui_State = struct('gui_Name',       mfilename, ... 
                   'gui_Singleton',  gui_Singleton, ... 
                   'gui_OpeningFcn', @tl_OpeningFcn, ... 
                   'gui_OutputFcn',  @tl_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 tl is made visible. 
function tl_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 tl (see VARARGIN) 
 
% Choose default command line output for tl 
handles.output = hObject; 
 
% Update handles structure 
guidata(hObject, handles); 
 
% UIWAIT makes tl wait for user response (see UIRESUME) 
% uiwait(handles.figure1); 
 
 
% --- Outputs from this function are returned to the command line. 
function varargout = tl_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 button press in togglebutton1. 
function togglebutton1_Callback(hObject, eventdata, handles) 
% hObject    handle to togglebutton1 (see GCBO) 
% eventdata  reserved - to be defined in a future version of MATLAB 
% handles    structure with handles and user data (see GUIDATA) 
 
% Hint: get(hObject,'Value') returns toggle state of togglebutton1 
x = wavread('D:\voice\j.wav',[15000 16000]); 
plot(x); 
title('清音原始波形'); 
 
 
 
 
% --- Executes on button press in togglebutton2. 
function togglebutton2_Callback(hObject, eventdata, handles) 
% hObject    handle to togglebutton2 (see GCBO) 
% eventdata  reserved - to be defined in a future version of MATLAB 
% handles    structure with handles and user data (see GUIDATA) 
 
% Hint: get(hObject,'Value') returns toggle state of togglebutton2 
x = wavread('D:\voice\j.wav',[15000 16000]); 
F =fft(x); 
S =abs(F) ; 
Output = log(S); 
plot(Output); 
title('对数谱'); 
 
 
% --- Executes on button press in togglebutton3. 
function togglebutton3_Callback(hObject, eventdata, handles) 
% hObject    handle to togglebutton3 (see GCBO) 
% eventdata  reserved - to be defined in a future version of MATLAB 
% handles    structure with handles and user data (see GUIDATA) 
 
% Hint: get(hObject,'Value') returns toggle state of togglebutton3 
x = wavread('D:\voice\j.wav',[15000 16000]); 
f = fft(x); 
a=abs(f); 
Ifft=ifft(log(a)); 
O=real(Ifft); 
plot(O); 
title('倒谱图'); 
% x = wavread('D:\voice\j.wav',[15000 16000]); 
% o = rceps(x); 
% plot(o); 
 
 
% --- Executes on button press in togglebutton4. 
function togglebutton4_Callback(hObject, eventdata, handles) 
% hObject    handle to togglebutton4 (see GCBO) 
% eventdata  reserved - to be defined in a future version of MATLAB 
% handles    structure with handles and user data (see GUIDATA) 
 
% Hint: get(hObject,'Value') returns toggle state of togglebutton4 
x = wavread('D:\voice\j.wav',[15000 16000]); 
h = hamming(100); 
x = x.*x; 
Out = conv(x,h); 
plot(Out); 
title('短时能量谱'); 
 
 
 
 
% --- Executes on button press in togglebutton5. 
function togglebutton5_Callback(hObject, eventdata, handles) 
% hObject    handle to togglebutton5 (see GCBO) 
% eventdata  reserved - to be defined in a future version of MATLAB 
% handles    structure with handles and user data (see GUIDATA) 
 
% Hint: get(hObject,'Value') returns toggle state of togglebutton5 
x = wavread('D:\voice\j.wav',[15000 16000]); 
h = hamming(100); 
x = abs(x); 
O = conv(x,h); 
plot(O); 
title('短时幅度谱'); 
 
 
 
 
 
% --- Executes on button press in togglebutton6. 
function togglebutton6_Callback(hObject, eventdata, handles) 
% hObject    handle to togglebutton6 (see GCBO) 
% eventdata  reserved - to be defined in a future version of MATLAB 
% handles    structure with handles and user data (see GUIDATA) 
 
% Hint: get(hObject,'Value') returns toggle state of togglebutton6 
x = wavread('D:\voice\j.wav',[15000 16000]); 
n = 1; 
k = 1; 
S = 0; 
Output(1000) = 0; 
for n=1:900     
    S = 0; 
    for k=1:100 
        S = S + abs( x(1000-k+1)-x(1000-n-k+1) );           
    end; 
    Out(n) = S;     
end; 
plot(Out);   
title('短时幅度谱差'); 
 
 
 
% --- Executes on button press in togglebutton7. 
function togglebutton7_Callback(hObject, eventdata, handles) 
% hObject    handle to togglebutton7 (see GCBO) 
% eventdata  reserved - to be defined in a future version of MATLAB 
% handles    structure with handles and user data (see GUIDATA) 
 
% Hint: get(hObject,'Value') returns toggle state of togglebutton7 
x = wavread('D:\voice\j.wav',[10000 26000]);  
n = 1; 
k = 1; 
N = 0; 
for n=1:900     
    N = 0; 
    for k=1:22 
        if x((n-1)+k) * x((n-1)+k+1) < 0 
            N = N + 1; 
        end; 
    end; 
    Output(n) = N;     
end; 
plot(Output); 
title('短时过零率'); 
 
 
 
% --- Executes on button press in togglebutton8. 
function togglebutton8_Callback(hObject, eventdata, handles) 
% hObject    handle to togglebutton8 (see GCBO) 
% eventdata  reserved - to be defined in a future version of MATLAB 
% handles    structure with handles and user data (see GUIDATA) 
 
% Hint: get(hObject,'Value') returns toggle state of togglebutton8 
x = wavread('D:\voice\j.wav',[12000 15000]); 
c = xcorr(x,'coeff');         
h = hamming(1500); 
O = conv(h,c);                 
plot(O); 
title('短时自相关'); 
 
 
% --- Executes on button press in togglebutton9. 
function togglebutton9_Callback(hObject, eventdata, handles) 
% hObject    handle to togglebutton9 (see GCBO) 
% eventdata  reserved - to be defined in a future version of MATLAB 
% handles    structure with handles and user data (see GUIDATA) 
 
% Hint: get(hObject,'Value') returns toggle state of togglebutton9 
x = wavread('D:\voice\j.wav',[15000 16000]); 
y=real(specgram(x,256,120,256));                 
plot(y); 
title('短时傅里叶'); 
 
 
% --- Executes on button press in togglebutton10. 
function togglebutton10_Callback(hObject, eventdata, handles) 
% hObject    handle to togglebutton10 (see GCBO) 
% eventdata  reserved - to be defined in a future version of MATLAB 
% handles    structure with handles and user data (see GUIDATA) 
 
% Hint: get(hObject,'Value') returns toggle state of togglebutton10 
 
x = wavread('D:\voice\j.wav',[12000 15000]); 
y=lpc(x); 
plot(y); 
title('线性预测') 
 
 
% --- Executes on button press in togglebutton11. 
function togglebutton11_Callback(hObject, eventdata, handles) 
% hObject    handle to togglebutton11 (see GCBO) 
% eventdata  reserved - to be defined in a future version of MATLAB 
% handles    structure with handles and user data (see GUIDATA) 
 
% Hint: get(hObject,'Value') returns toggle state of togglebutton11 
x=wavread('D:\voice\j.wav',[15000 16000]); 
o = cceps(x); 
plot(o); 
title('复倒谱')