matlab代码-语音信号分析和去噪处理_第1页
matlab代码-语音信号分析和去噪处理_第2页
matlab代码-语音信号分析和去噪处理_第3页
matlab代码-语音信号分析和去噪处理_第4页
matlab代码-语音信号分析和去噪处理_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

S X 文 理 学 院数 理 信 息 学 院数字信号处理课 程 设 计 报 告 书题目 语音信号分析与去噪处理 姓 名 学 号 专业班级 电信11级信号处理 指导教师 于 刘 时 间 年 月 日 I课程设计任务书班 级电信112姓 名 题 目语音信号分析与去噪处理技术参数、设计要求、检测数据等(1) 语音信号的采集:利用Windows下的录音机,录制一段自己的话音,时间在10秒内,然后在MATLAB软件下,利用函数wavread对语音信号进行采样,记录采样频率和采样点数。(2) 语音信号的频谱分析:首先画出语音信号的时域波形,然后对语音信号进行频谱分析。(3) 分别设计低通、高通和带通滤波器对语音信号进行滤波后对语音信号进行回放(函数sound可以对声音进行回放),分析比较滤波结果。(4) 对语音信号进行加入高斯白噪声(用randn函数产生随机序列)设计滤波器对语音信号进行滤波后对语音信号进行回放,分析比较滤波结果。(上述滤波器分别采用IIR和FIR滤波结构实现)设计进度安排或工作计划2014.7.1 2014.7.2: 熟悉课题,查询相关资料,完成方案选择。2014.7.32014.7.6: 设计模块划分、实现及各模块调试、验证。2014.7.72014.7.8: 设计整体实现、调试及验证,并开始撰写报告。2014.7.92014.7.10: 设计完成,课程设计报告撰写并定稿,上交。其 它 认真阅读数字信号处理课程设计报告撰写规范;课题小组经协商好要指定组长并明确分工,形成良好团队工作氛围;基于课题基本要求,各小组课再细化、增加要求;课题小组每成员均需各自撰写一份课程设计报告。附录源码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 existing 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_OpeningFcn 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 above 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_LayoutFcn, , . 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.function 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 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_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 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 GUIDATA)%*语音信号采集*global YL YH YK YG YY;global F BB;fn,pn,fi=uigetfile(*.wav,select a wav-file);%调用选择文件对话框,返回fn代表名字,pn代表路径name=strcat(pn,fn);y1,Fs,bits=wavread(name); %采样值放在向量y中,fs表示采样频率(hz),bits表示采样位数T=length(y1)/Fs;set(handles.text4,string,Fs);set(handles.text12,string,T);set(handles.text15,string,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);%*% - 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 YY F BB;y1=YY;Fs=F;bits=BB;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)%*高斯噪声*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, 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;%*自适应算法*w=0,1;%初始2阶加权系数 u=0.00026;%最佳参数 for i=1:length(z); y(i+1)=h(i:i+1)*w; e(i+1)=z(i+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 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=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),.); 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 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 data (see GUIDATA)%*高通*global YH YY F Yhi Yhf;Fs=F;y1=YH;%*IIR*fph=10000;fsh=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,high,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=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)% eventdata 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=6000;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; 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*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 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% handles 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 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 properties.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 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 checkbox1.function checkbox1_Callback(hObject, eventdata, handles)% hObject handle to checkbox1 (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 checkbox1% - Executes on button press in checkbox2.function checkbox2_Callback(hObject, eventdata, handles)% hObject handle 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_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, 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. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论