1、课设论文 matlab gui 界面设计、function varargout = jy01(varargin)% JY01 M-file for jy01.fig% JY01, by itself, creates a new JY01 or raises the existing% singleton*.% H = JY01 returns the handle to a new JY01 or the handle to% the existing singleton*.% JY01(CALLBACK,hObject,eventData,handles,.) calls the loca
2、l% function named CALLBACK in JY01.M with the given input arguments.% JY01(Property,Value,.) creates a new JY01 or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before jy01_OpeningFcn gets called. An% unrecognized property name or invalid value
3、 makes property application% stop. All inputs are passed to jy01_OpeningFcn via varargin.% *See GUI Options on GUIDEs 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 jy01 % Last Modified b
4、y GUIDE v2.5 01-Jul-2005 13:30:37 % Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct(gui_Name, mfilename, . gui_Singleton, gui_Singleton, . gui_OpeningFcn, jy01_OpeningFcn, . gui_OutputFcn, jy01_OutputFcn, . gui_LayoutFcn, , . gui_Callback, );if nargin & ischar(varargin1)
5、gui_State.gui_Callback = str2func(varargin1);end if nargout varargout1:nargout = gui_mainfcn(gui_State, varargin:);else gui_mainfcn(gui_State, varargin:);end% End initialization code - DO NOT EDIT % - Executes just before jy01 is made visible.function jy01_OpeningFcn(hObject, eventdata, handles, var
6、argin)% 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 jy01 (see VARARGIN) % Choose default command line outpu
7、t for jy01handles.output = hObject; % Update handles structureguidata(hObject, handles); % UIWAIT makes jy01 wait for user response (see UIRESUME)% uiwait(handles.figure1); % - Outputs from this function are returned to the command line.function varargout = jy01_OutputFcn(hObject, eventdata, handles
8、) % 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 structurevarargout1 = handles.out
9、put; % - 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)x=wavread(01.wav);sound(x
10、);subplot(4,1,1);plot(x);axis(1 length(x) -1 1);ylabel(Speech);enhance=filter(1-0.9375,1,x);FrameLen=240; FrameInc=80;yframe=enframe(x,FrameLen,FrameInc);amp1=sum(abs(yframe),2);subplot(4,1,2);plot(amp1);axis(1 length(amp1) 0 max(amp1);ylabel(Amp);legend(amp1=x);amp2=sum(abs(yframe.*yframe),2);subpl
11、ot(4,1,3);plot(amp2);axis(1 length(amp2) 0 max(amp2);ylabel(Energy);legend(amp1=x*x);tmp1=enframe(x(1:end-1),FrameLen,FrameInc);tmp2=enframe(x(2:end),FrameLen,FrameInc);signs=(tmp1.*tmp2)0.02;zcr=sum(signs.*diffs,2);subplot(4,1,4);plot(zcr);axis(1 length(zcr) 0 max(zcr);ylabel(ZCR);legend(zcr);funct
12、ion f=enframe(x,win,inc)nx=length(x(:);nwin=length(win);if (nwin = 1)len = win;elselen = nwin;endif (nargin 1)w = win(:);f = f .* w(ones(nf,1),:);end % - Executes on button press in pushbutton3.function pushbutton3_Callback(hObject, eventdata, handles)% hObject handle to pushbutton3 (see GCBO)% even
13、tdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) our=wavread(01.wav);specgram_hw3p20(our,1024,512,10000);specgram_hw3p20(our,512,256,10000); function spec = specgram_hw3p20(x, winlgh, frmlgh, sampling_rate); % specgram_hw3p20(x,
14、 winlgh, frmlgh, sampling_rate)% function to compute a spectrogram % x = input waveform % winlgh = window length in samples% frmlgh = frame length in samples% sampling_rate = samples/sec % PARAMETERS %sampling_rate = 10000; % sampling ratelfft = 1024; % FFT length lfft2 = lfft/2;%winlgh = 200; % (12
15、8) window length (in samples)%frmlgh = 10; % frame interval (in samples)noverlap = winlgh - frmlgh; % x = x(1:4500); x = 2.0*x/max(abs(x); etime = length(x)/sampling_rate; %-% spec = abs(specgram(x, lfft, sampling_rate, winlgh, noverlap); subplot(211); plot(1:length(x)/sampling_rate,x) xlabel(Time (
16、s); title(SPEECH); axis(0 etime -2.5 2.5); grid; subplot(212) imagesc(0:.010:etime, 0:1000:(sampling_rate/2), log10(abs(spec);axis(xy) xlabel(Time (ms),ylabel(Frequency (Hz); title(SPECTROGRAM); % - Executes on button press in pushbutton4.function pushbutton4_Callback(hObject, eventdata, handles)% h
17、Object 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)clc; clear;tic, y,fs=wavread(01.wav); L=length(y); fw=y.*hamming(L);r=real(log(fft(fw,L)pfw=cceps(fw);rpfw=rceps(fw);z=rpfw(1:30);p=pfw
18、(31:L)logz=real(exp(fft(z,L);logp=real(fft(p);subplot(3,2,1);plot(y);title()subplot(3,2,3);plot(pfw);title()subplot(3,2,5);plot(rpfw);title()subplot(3,2,6);plot(logz);title()subplot(3,2,4);plot(r);title()subplot(3,2,2);plot(fw);title() % - Executes on button press in pushbutton5.function pushbutton5
19、_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)speech1_10k=wavread(01.wav,1024 1273);%250sw=speech1_10k.*hamming(250);%a Rsw=xcorr(sw);%a t=0
20、.1:0.1:25;subplot(1,2,1);plot(t,sw);xlabel(ms);title(); subplot(1,2,2); t=0.1:0.1:length(Rsw)/10;plot(t,Rsw);xlabel(ms);title(); Rsw4=Rsw(250:253);Rsw(249:252);Rsw(248:251);Rsw(247:250);%4*4 Rsw6=Rsw(250:255);Rsw(249:254);Rsw(248:253);Rsw(247:252);Rsw(246:251);Rsw(245:250);%6*6 rea4=inv(Rsw4)*Rsw(25
21、1:254);%4 rea6=inv(Rsw6)*Rsw(251:256);%6 A4=sqrt(Rsw(250)-Rsw(251:254)*rea4);% A6=sqrt(Rsw(250)-Rsw(251:256)*rea6);% w=pi/512:pi/512:pi;% j=sqrt(-1); FW4=rea4*exp(-j*w);exp(-j*w*2);exp(-j*w*3);exp(-j*w*4);% FW6=rea6*exp(-j*w);exp(-j*w*2);exp(-j*w*3);exp(-j*w*4);exp(-j*w*5);exp(-j*w*6);% HW4=A4./(1-F
22、W4);% HW6=A6./(1-FW6);% FW2=fft(sw,1024);% FW3=FW2(1:512); w=(1/1024:1/1024:0.5)*10000; subplot(2,2,1);plot(w,log(abs(FW3);xlabel(hz);title(); subplot(2,2,2);plot(w,log(abs(HW4),g);xlabel(hz);title(4); subplot(2,2,3);plot(w,log(abs(HW6),r);xlabel(hz);title(6); subplot(2,2,4);plot(w,log(abs(FW3),w,lo
23、g(abs(HW4),w,log(abs(HW6);xlabel(hz);title(); % - Executes on button press in pushbutton6.function pushbutton6_Callback(hObject, eventdata, handles)% hObject handle to pushbutton6 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user da
24、ta (see GUIDATA)clearY=wavread(01.wav,1 1800);x1=Y(271:510);x2=Y(271:510);x3=Y(271:510);%r=zeros(1,240);for k=1:240 for n=1:240-k r(k)=r(k)+x1(n)*x1(n+k); endend j=1:240;subplot(2,2,2);plot(j,r);title()subplot(2,2,1);plot(j,x1);title() %for k1=1:1:240 if x2(k1)0 x2(k1)=1; else if x2(k1)=0 x2(k1)=0;
25、else if x2(k1)tc x3(k1)=x3(k1)-tc; else if x3(k1)-tc x3(k1)=x3(k1)+tc; else x3(k1)=0; end endendj=1:240;subplot(2,2,4);plot(j,x3);title() % - Executes on button press in pushbutton7.function pushbutton7_Callback(hObject, eventdata, handles)% hObject handle to pushbutton7 (see GCBO)% eventdata reserv
26、ed - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)clearclcwinsize=256; % winsize=256; % n=0.04; % speech,fs,nbits=wavread(01.wav); % size=length(speech); numofwin=floor(size/winsize); % % ham=hamming(winsize); %Generates Hamming Window hamwin
27、=zeros(1,size); %Vector for window gain enhanced=zeros(1,size); %Vector for enhanced speech % x=speech+ n*randn(1,size); %Contaminates signal with white noise % noisy=n*randn(1,winsize); %Sample of noise N = fft(noisy); nmag= abs(N); %Estimated noise magnitude spectrum for q=1:2*numofwin-1 frame=x(1+(q-1)*winsize/2:winsize+(q-1)*winsize/2); %50 percent ov
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1