matlab代碼_語音信號分析和去噪處理_第1頁
matlab代碼_語音信號分析和去噪處理_第2頁
matlab代碼_語音信號分析和去噪處理_第3頁
matlab代碼_語音信號分析和去噪處理_第4頁
matlab代碼_語音信號分析和去噪處理_第5頁
已閱讀5頁,還剩8頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、S X 文 理 學(xué) 院數(shù) 理 信 息 學(xué) 院數(shù)字信號處理課 程 設(shè) 計 報 告 書題目 語音信號分析與去噪處理 姓 名 學(xué) 號 專業(yè)班級 電信11級信號處理 指導(dǎo)教師 于 劉 時 間 年 月 日 I課程設(shè)計任務(wù)書班 級電信112姓 名 題 目語音信號分析與去噪處理技術(shù)參數(shù)、設(shè)計要求、檢測數(shù)據(jù)等(1) 語音信號的采集:利用Windows下的錄音機(jī),錄制一段自己的話音,時間在10秒內(nèi),然后在MATLAB軟件下,利用函數(shù)wavread對語音信號進(jìn)行采樣,記錄采樣頻率和采樣點數(shù)。(2) 語音信號的頻譜分析:首先畫出語音信號的時域波形,然后對語音信號進(jìn)行頻譜分析。(3) 分別設(shè)計低通、高通和帶通濾波器對

2、語音信號進(jìn)行濾波后對語音信號進(jìn)行回放(函數(shù)sound可以對聲音進(jìn)行回放),分析比較濾波結(jié)果。(4) 對語音信號進(jìn)行加入高斯白噪聲(用randn函數(shù)產(chǎn)生隨機(jī)序列)設(shè)計濾波器對語音信號進(jìn)行濾波后對語音信號進(jìn)行回放,分析比較濾波結(jié)果。(上述濾波器分別采用IIR和FIR濾波結(jié)構(gòu)實現(xiàn))設(shè)計進(jìn)度安排或工作計劃2014.7.1 2014.7.2: 熟悉課題,查詢相關(guān)資料,完成方案選擇。2014.7.32014.7.6: 設(shè)計模塊劃分、實現(xiàn)及各模塊調(diào)試、驗證。2014.7.72014.7.8: 設(shè)計整體實現(xiàn)、調(diào)試及驗證,并開始撰寫報告。2014.7.92014.7.10: 設(shè)計完成,課程設(shè)計報告撰寫并定稿,上

3、交。其 它 認(rèn)真閱讀數(shù)字信號處理課程設(shè)計報告撰寫規(guī)范;課題小組經(jīng)協(xié)商好要指定組長并明確分工,形成良好團(tuán)隊工作氛圍;基于課題基本要求,各小組課再細(xì)化、增加要求;課題小組每成員均需各自撰寫一份課程設(shè)計報告。附錄源碼function varargout = PF(varargin)% PF MATLAB code for PF.fig% PF, by itself, creates a new PF or raises the existing% singleton*.% H = PF returns the handle to a new PF or the handle to% the exis

4、ting singleton*.% PF(CALLBACK,hObject,eventData,handles,.) calls the local% function named CALLBACK in PF.M with the given input arguments.% PF(Property,Value,.) creates a new PF or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before PF_Openin

5、gFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to PF_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 ab

6、ove text to modify the response to help PF% Last Modified by GUIDE v2.5 06-Jul-2014 11:15:51% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct(gui_Name, mfilename, . gui_Singleton, gui_Singleton, . gui_OpeningFcn, PF_OpeningFcn, . gui_OutputFcn, PF_OutputFcn, . gui_LayoutF

7、cn, , . gui_Callback, );if nargin & ischar(varargin1) gui_State.gui_Callback = str2func(varargin1);endif nargout varargout1:nargout = gui_mainfcn(gui_State, varargin:);else gui_mainfcn(gui_State, varargin:);end% End initialization code - DO NOT EDIT% - Executes just before PF is made visible.functio

8、n PF_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 PF (see

9、 VARARGIN)% Choose default command line output for PFhandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes PF wait for user response (see UIRESUME)% uiwait(handles.figure1);% - Outputs from this function are returned to the command line.function varargout = PF_O

10、utputFcn(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 handle

11、s structurevarargout1 = handles.output;% - Executes on button press in pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see

12、 GUIDATA)%*語音信號采集*global YL YH YK YG YY;global F BB;fn,pn,fi=uigetfile(*.wav,select a wav-file);%調(diào)用選擇文件對話框,返回fn代表名字,pn代表路徑name=strcat(pn,fn);y1,Fs,bits=wavread(name); %采樣值放在向量y中,fs表示采樣頻率(hz),bits表示采樣位數(shù)T=length(y1)/Fs;set(handles.text4,string,Fs);set(handles.text12,string,T);set(handles.text15,string

13、,bits);YL=y1;YH=y1;YK=y1;YG=y1;YY=y1;BB=bits;F=Fs;Y=fft(y1,524288);plot(handles.axes1,0:1/Fs:(length(y1)-1)/Fs,y1);axes(handles.axes1);legend(原信號波形,1);stem(handles.axes2,0:2*pi/524288:2*pi-1/524288,abs(Y),.);set(handles.axes2,ylim,0 1500,xlim,0 2*pi);axes(handles.axes2);legend(原信號頻譜,1);%*% - Execute

14、s 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 YY F BB;y1=YY;Fs=F;bits=BB;

15、sound(YY,Fs,bits);%播放聲音% - 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)%*高斯噪聲*

16、global h z YY YG;y1=YG;h=0.05*randn(size(y1);z=plus(h,y1);Z=fft(z,524288);stem(handles.axes4,0:2*pi/524288:2*pi-1/524288,abs(Z),.);set(handles.axes4,ylim,0 1500,xlim,0 2*pi);axes(handles.axes4);legend(加入高斯噪聲頻譜,1);YY=z;% - Executes on button press in pushbutton4.function pushbutton4_Callback(hObject,

17、 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 h z YY;%*自適應(yīng)算法*w=0,1;%初始2階加權(quán)系數(shù) u=0.00026;%最佳參數(shù) for i=1:length(z); y(i+1)=h(i:i+1)*w; e(i+1)=z(i+

18、1)-y(i+1); w=w+2*u*e(i+1)*h(i:i+1);end; Y=fft(e,524288);stem(handles.axes4,0:2*pi/524288:2*pi-1/524288,abs(Y),.);set(handles.axes4,ylim,0 1500,xlim,0 2*pi);legend(濾除高斯噪聲頻譜,1);YY=e;%*% - Executes on button press in pushbutton5.function pushbutton5_Callback(hObject, eventdata, handles)% hObject handle

19、 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 YL YY F Yli Ylf;y1=YL;Fs=F;%*IIR*fp=6000;fs=8000;Fs=44100;rp=3;rs=10;wp=2*pi*fp/Fs;ws=2*pi*fs/Fs;op=2*tan(wp/2);os=2*tan(ws/2);N, wc

20、=buttord(op,os,rp,rs,s);B, A=butter(N,wc,s);Bz, Az=bilinear(B ,A,1);%*FIR* Bt=abs(wp-ws);N=ceil(6.6*pi/Bt);wc=(wp+ws)/2/pi;hn=fir1(N-1,wc,low,hamming(N);co=get(handles.popupmenu1,value);if co=2 y2=fftfilt(Bz,y1); Yli=fft(y2,524288); YY=y2; stem(handles.axes4,0:2*pi/524288:2*pi-1/524288,abs(Yli),.);

21、set(handles.axes4,xlim,0 2*pi); axes(handles.axes4); legend(低通濾波頻譜,1);elseif co=3 y3=fftfilt(hn,y1); Ylf=fft(y3,524288); YY=y3; stem(handles.axes4,0:2*pi/524288:2*pi-1/524288,abs(Ylf),.); set(handles.axes4,ylim,0 1500,xlim,0 2*pi); axes(handles.axes4); legend(低通濾波頻譜,1);end% - Executes on button pres

22、s 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 data (see GUIDATA)%*高通*global YH YY F Yhi Yhf;Fs=F;y1=YH;%*IIR*fph=10000;fs

23、h=11000;rph=3;rsh=10;wph=2*pi*fph/Fs;wsh=2*pi*fsh/Fs;oph=2*tan(wph/2);osh=2*tan(wsh/2);Nh, wch=buttord(oph,osh,rph,rsh,s);Bh, Ah=butter(Nh,wch,s);Bs,As=lp2hp(Bh,Ah,wch); Bzh, Azh=bilinear(Bs ,As,1);%*FIR*Bth=abs(wph-wsh);Nh0=ceil(6.6*pi/Bth);Nh=Nh0+mod(Nh0+1,2);wch=(wph+wsh)/2/pi;hnh=fir1(Nh-1,wch,h

24、igh,hamming(Nh);co=get(handles.popupmenu1,value);if co=2 y3=fftfilt(Bzh,y1); Yhi=fft(y3,524288); YY=y3; stem(handles.axes4,0:2*pi/524288:2*pi-1/524288,abs(Yhi),.); set(handles.axes4,ylim,0 1500,xlim,0 2*pi); axes(handles.axes4); legend(高通濾波頻譜,1);elseif co=3 y4=fftfilt(hnh,y1); Yhf=fft(y4,524288); YY

25、=y4; stem(handles.axes4,0:2*pi/524288:2*pi-1/524288,abs(Yhf),.); set(handles.axes4,ylim,0 1500,xlim,0 2*pi); axes(handles.axes4); legend(高通濾波頻譜,1);end% - Executes on button press in pushbutton7.function pushbutton7_Callback(hObject, eventdata, handles)% hObject handle to pushbutton7 (see GCBO)% even

26、tdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)%*帶通*%*IIR*global YK YY Ypi Ypf;y1=YK;Fs=44100;wpp=6000 8000*2/Fs;wsp=5000 10000*2/Fs;rpp=3;rsp=20;N,Wn=buttord(wpp,wsp,rpp,rsp,s);Bp,Ap=butter(N,Wn,bandpass);%*FIR*fpl=5000;fph1=6

27、000;fsl=8000;fsh1=10000;wpl=2*pi*fpl/Fs;wph1=2*pi*fph1/Fs;wsl=2*pi*fsl/Fs;wsh1=2*pi*fsh1/Fs;Bthb=abs(wpl-wsl);Nhb=ceil(6.6*pi/Bthb);wcl=(wpl+wph1)/2/pi;wch1=(wsl+wsh1)/2/pi;wn=wcl wch1;hnb=fir1(Nhb-1,wn,hamming(Nhb);co=get(handles.popupmenu1,value)if co=2 y3=fftfilt(Bp,y1); Ypi=fft(y3,524288); YY=y3

28、; stem(handles.axes4,0:2*pi/524288:2*pi-1/524288,abs(Ypi),.); set(handles.axes4,ylim,0 40,xlim,0 2*pi); axes(handles.axes4); legend(帶通濾波頻譜,1);elseif co=3 y4=fftfilt(hnb,y1); Ypf=fft(y4,524288); YY=y4; stem(handles.axes4,0:2*pi/524288:2*pi-1/524288,abs(Ypf),.); set(handles.axes4,ylim,0 1500,xlim,0 2*

29、pi); axes(handles.axes4); legend(帶通濾波頻譜,1);end% - Executes on button press in radiobutton1.function radiobutton1_Callback(hObject, eventdata, handles)% hObject handle to radiobutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user

30、 data (see GUIDATA)% Hint: get(hObject,Value) returns toggle state of radiobutton1% - Executes on button press in radiobutton2.function radiobutton2_Callback(hObject, eventdata, handles)% hObject handle to radiobutton2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% han

31、dles structure with handles and user data (see GUIDATA)% Hint: get(hObject,Value) returns toggle state of radiobutton2% - Executes on selection change in popupmenu1.function popupmenu1_Callback(hObject, eventdata, handles)% hObject handle to popupmenu1 (see GCBO)% eventdata reserved - to be defined

32、in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = cellstr(get(hObject,String) returns popupmenu1 contents as cell array% contentsget(hObject,Value) returns selected item from popupmenu1% - Executes during object creation, after setting all p

33、roperties.function popupmenu1_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu1 (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 backgr

34、ound 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 checkbox1.function checkbox1_Callback(hObject, eventdata, handles)% hObject handle to checkbox1 (see GC

35、BO)% 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 checkbox1% - Executes on button press in checkbox2.function checkbox2_Callback(hObject, eventdata, handles)% hObject han

36、dle to checkbox2 (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 checkbox2% - Executes during object creation, after setting all properties.function pushbutton3_

37、CreateFcn(hObject, eventdata, handles)% hObject handle to pushbutton3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% - Executes on button press in pushbutton9.function pushbutton9_Callback(hObject,

38、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 Yli Ylf; stem(handles.axes2,0:2*pi/524288:2*pi-1/524288,abs(Yli),.); set(handles.axes2,xlim,0 2*pi); axes(handles.axes2); legend(IIR低通濾波頻譜,1); stem(handles.axes4,0

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論