数字信号处理课程设计报告.docx_第1页
数字信号处理课程设计报告.docx_第2页
数字信号处理课程设计报告.docx_第3页
数字信号处理课程设计报告.docx_第4页
数字信号处理课程设计报告.docx_第5页
已阅读5页,还剩22页未读 继续免费阅读

下载本文档

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

文档简介

信息工程学院数字信号处理课程设计数 字 信 号 处 理课程设计报告题目: 数字调音台 学院: 信息工程学院 专业: 通信工程 指导教师: 指导时间: 姓 名学号承担任务指导教师评价意见成绩24目 录1 背景与内容12 设计目的13 设计原理13.1 研究语音信号的特点;13.2 IIR数字滤波器23.3 滤波器设计所涉及的matlab函数23.4 总体方案34 设计过程44.1 系统流程图44.2 具体设计45 实验代码及结果75.1 MATLAB源程序75.2 系统运行与测试196 实验体会及总结247 参考文献241.背景与内容根据数字信号处理课程设计教学大纲的要求,利用Matlab(工程设计软件)设计数字调音台,并且给出了具体的软件实施方案。Matlab功能强大、简单易学、编程效率高,深受广大科技工作者的欢迎。特别是Matlab还具有信号分析工具箱,不需具备很强的编程能力,就可以很方便地进行信号分析、处理和设计。此次设计利用Matlab对音频信号进行采样后;并画出音频信号的时域波形、频谱图;然后利用IIR设计高通、低通、带通以及帯阻滤波器对现有的音频信号进行滤波,实现音频音色的改变实现调音台的功能,并画出滤波后信号的时域波形和频谱,对滤波前后的信号进行对比,分析信号的变化;最后利用GUI设计一个数字信号系统界面。1、选一首歌曲,采用已经学过的信号处理知识,设计高通、带通、低通、带阻几种滤波器,对其进行数字信号滤波,观察信号的变化;2、实时显示处理前的信号频谱和处理后的信号频谱;3、设计系统界面:为了使编制的程序操作方便,设计处理系统的用户界面,在所设计的系统界面上可以选择滤波器的类型,输入滤波器的参数、显示滤波器的频率响应等。2.设计目的1、通过对常用数字滤波器的设计和实现,掌握数字信号处理的工作原理及设计方法;熟悉用 IIR 数字滤波器和FIR滤波器的原理与方法,掌握利用数字滤波器对信号进行滤波的方法 2、掌握数字滤波器的计算机仿真方法,并能够对设计结果加以分析。3、通过对Matlab的使用,掌握Matlab的程序设计方法,掌握Matlab设计IIR数字滤波器和FIR滤波器的方法,并学会用Matlab对信号分析和处理。4、学习使用MATLAB GUI设计工具应用平面。3.设计原理3.1研究语音信号的特点;语音信号的带宽约为5KHz,主要能量集中在低频段。语音信号是典型的随机信号,人的每次发音过程都是一个随机过程。很难得到两次完全相同的发音样本。 语音时域信号特征1)清音段:能量低,过零率高,波形特点有点像随机的噪声。这部分信号常与语音的辅音段对应。 2)浊音段:能量高,过零率低,波形具有周期性特点。所谓的短时平稳性质就是处于这个语音浊音(元音)段中。 3)过渡段:一般是指从辅音段向元音段信号变化之间的部分。信号变化快,是语音信号处理中最复杂、困难的部分。 3.2 IIR数字滤波器设计IIR数字滤波器一般采用间接法(脉冲响应不变法和双线性变换法),应用最广泛的是双线性变换法。基本设计过程是:先将给定的数字滤波器的指标转换成过渡模拟滤波器的指标; 设计过渡模拟滤波器;将过渡模拟滤波器系统函数转换成数字滤波器的系统函数。3.3滤波器设计所涉及的matlab函数y,fs= wavread(wavFile1),此函数能读取.wav格式的音频文件。其中y为语音信号,fs为采样频率,wavFile1为WAV音频文件存放路径。N,wc=buttord(wp,ws,Rp,As),用于计算巴特沃斯数字滤波器的阶数N和3dB截止频率 wc。调用参数wp,ws分别为数字滤波器的通带、阻带截止频率的归一化值,要求:0 wp1,0ws1。1表示数字频率pi。 rp,rs分别为通带最大衰减和组带最小衰减(dB)。 当wswp时,为高通滤波器;当wswp时,为低通通滤波器;当wp和ws为二元矢量时,当wslwplwpuwsu为带通滤波器;当wplwslwsswps为带阻滤波器。N,wc作为butter函数的调用参数。B,A=butter:b,a=butter(N,wc,high):设计N阶高通滤波器。b,a=butter(N,wc,low):设计N阶低通滤波器。b,a=butter(N,wc):当wc为具有两个元素的矢量wc=w1,w2时,它设计2N阶带通滤波器b,a=butter(N,wc,stop):若wc=w1,w2,则它设计2N阶带阻滤波器。利用冲激响应不变法,把系统函数为 (式1)模拟滤波器变换成等价的数字滤波器,采样间隔T=1S。先经过计算得到: (式2)则有如下式子 (式3)Matlab实验参考程序如下:B=1,1;A=1,5,6;T=1;Fs=1/T;Bz,Az=impinvar(B,A,Fs); %用冲激响应不变法将模拟滤波器变换成数字滤波器运行结果:Bz =1.0000 -0.2209Az = 1.0000 -0.1851 0.0067得到的数据和先前计算得到的数据相同,故利用冲激响应不变化法把模拟滤波器设计成数字滤波器正确。z=filter(B,A,x) (式4)输入X为滤波前序列,Y为滤波结果序列,B/A 提供滤波器系数,B为分子, A为分母。整个滤波过程是通过下面差分方程实现的: a(1)*y(n) = b(1)*x(n) + b(2)*x(n-1) + . + b(nb+1)*x(n-nb) - a(2)*y(n-1) - . - a(na+1)*y(n-na) 3.4总体方案系统的总体设计界面主要分为三个区域:播放区域、滤波器参数设置区域、滤波器类型选择区域。3.4.1播放区域包括播放和停止音乐的功能按键。3.4.2滤波器参数设置区域能够设置数字滤波器的各参数3.4.3滤波器类型选择区域在设置数字滤波器的参数之后,点击各类型滤波器按钮后弹出相应的波形图。4设计过程4.1系统流程图开始滤波器选择播放停止观察波形结束图1:系统流程图4.2具体设计(1)首先建立GUI界面,具体界面如下:图2 GUI界面建立(2)系统的总体设计界面主要分为四个区域:播放区域、滤波器参数设置区域、滤波器类型选择区域。具体界面如下图图3 GUI界面建立(3)播放区域设计包括播放、停止两个按钮,界面如下: 图4 播放按钮(4)滤波器参数设置区域包括,包括六个参数:wp(fp1) ws(fs1) rp rs fsu fpu区域界面如图所示:图5 参数设置按钮(5)滤波器类型选择区域包括高通、低通、带通、帯阻四个按钮,区域界面如下图所示。图6 选择按钮5.实验代码及结果5.1 MATLAB源程序(1)HIGH PASS FILTER 按钮所对应代码:function pushbutton1_Callback(hObject, eventdata, handles)global name1;global name2;global p;name1=D:WWWm2.wav;name2=D:WWWtu1.jpg; x,Fs=wavread(name1);h=axes(units,normalized,position,0,0,1,1);uistack(h,up);i=imread(name2);image(i);set(h,handlevisibility,off,visible,off);x1=x(:,1);N=length(x); f=Fs*(0:N/2-1)/N;figure(2);subplot(4,1,1);plot(x1);title(滤波前信号时域波形);X2k=abs(fft(x1,N);subplot(4,1,2);plot(f,X2k(1:N/2);title(滤波前信号频谱图);wp=2*str2num(get(handles.edit1,String)/Fs;ws=2*str2num(get(handles.edit2,String)/Fs;Rp=str2num(get(handles.edit3,String);As=str2num(get(handles.edit4,String);N,wc=buttord(wp,ws,Rp,As);%巴特沃斯滤波法B,A=butter(N,wc,high);%求模拟滤波器的两个参数Bz,Az=impinvar(B,A,Fs);%将模拟滤波器转换成数字滤波器w=pi/2:pi;Hk=freqz(Bz,Az,w); %求H(z)的频响wf=w*Fs/(2*pi); % 转化为Hzz=filter(B,A,x);subplot(4,1,3);plot(z);title(滤波后信号时域波形);Y1=abs(fft(z,Fs);subplot(4,1,4);plot(Y1(1:length(Y1)/2);title(滤波后信号的频谱); p=audioplayer(z,Fs);play(p); % 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)(2)LOW PASS FILTER 按钮所对应代码:function pushbutton2_Callback(hObject, eventdata, handles)global name1;global name2;global p;name1=D:WWWm2.wav;name2=D:WWWtu1.jpg;x,Fs=wavread(name1);h=axes(units,normalized,position,0,0,1,1);uistack(h,up);i=imread(name2);image(i);set(h,handlevisibility,off,visible,off);x1=x(:,1);N=length(x); f=Fs*(0:N/2-1)/N;figure(2);subplot(4,1,1);plot(x1);title(滤波前信号时域波形);X2k=abs(fft(x1,N);subplot(4,1,2);plot(f,X2k(1:N/2);title(滤波前信号频谱图);wp=2*str2num(get(handles.edit1,String)/Fs;ws=2*str2num(get(handles.edit2,String)/Fs;Rp=str2num(get(handles.edit3,String);As=str2num(get(handles.edit4,String);N,wc=buttord(wp,ws,Rp,As);B,A=butter(N,wc,low);Bz,Az=impinvar(B,A,Fs);w=pi/2:pi;Hk=freqz(Bz,Az,w); %求H(z)的频响wf=w*Fs/(2*pi); % 转化为Hzz=filter(B,A,x);subplot(4,1,3);plot(z);title(滤波后信号时域波形);Y1=abs(fft(z,Fs);subplot(4,1,4);plot(Y1(1:length(Y1)/2);title(滤波后信号的频谱); p=audioplayer(z,Fs);play(p);(3) BAND PASS TILTER 按钮所对应代码function pushbutton3_Callback(hObject, eventdata, handles)global name1;global name2;global p; name1=D:WWWm2.wav;name2=D:WWWtu1.jpg;x,Fs=wavread(name1);h=axes(units,normalized,position,0,0,1,1);uistack(h,up);i=imread(name2);image(i);set(h,handlevisibility,off,visible,off);x1=x(:,1);N=length(x); f=Fs*(0:N/2-1)/N;figure(2);subplot(4,1,1);plot(x1);title(滤波前信号时域波形);X2k=abs(fft(x1,N);subplot(4,1,2);plot(f,X2k(1:N/2);title(滤波前信号频谱图);fsl=str2num(get(handles.edit2,String);fsu=str2num(get(handles.edit5,String);fpl=str2num(get(handles.edit1,String);fpu=str2num(get(handles.edit6,String);wp=2*fpl/Fs,2*fpu/Fs;ws=2*fsl/Fs,2*fsu/Fs;Rp=str2num(get(handles.edit3,String);As=str2num(get(handles.edit4,String);N,wc=buttord(wp,ws,Rp,As);B,A=butter(N,wc);Bz,Az=impinvar(B,A,Fs);w=pi/2:pi;Hk=freqz(Bz,Az,w); %求H(z)的频响wf=w*Fs/(2*pi); % 转化为Hzz=filter(B,A,x);subplot(4,1,3);plot(z);title(滤波后信号时域波开形);Y1=abs(fft(z,Fs);subplot(4,1,4);plot(Y1(1:length(Y1)/2);title(滤波后信号的频谱); p=audioplayer(z,Fs);play(p);(4)BAND STOP TILTER 按钮所对应代码function pushbutton4_Callback(hObject, eventdata, handles)global name1;global name2;global p;name1=D:WWWm2.wav;name2=D:WWWtu1.jpg;x,Fs=wavread(name1);h=axes(units,normalized,position,0,0,1,1);uistack(h,up);i=imread(name2);image(i);set(h,handlevisibility,off,visible,off);x1=x(:,1);N=length(x); f=Fs*(0:N/2-1)/N;figure(2);subplot(4,1,1);plot(x1);title(滤波前信号时域波形);X2k=abs(fft(x1,N);subplot(4,1,2);plot(f,X2k(1:N/2);title(滤波前信号频谱图);fsl=str2num(get(handles.edit2,String);fsu=str2num(get(handles.edit5,String);fpl=str2num(get(handles.edit1,String);fpu=str2num(get(handles.edit6,String);wp=2*fpl/Fs,2*fpu/Fs;ws=2*fsl/Fs,2*fsu/Fs;Rp=str2num(get(handles.edit3,String);As=str2num(get(handles.edit4,String);N,wc=buttord(wp,ws,Rp,As);B,A=butter(N,wc,stop);Bz,Az=impinvar(B,A,Fs);w=pi/2:pi;Hk=freqz(Bz,Az,w); %求H(z)的频响wf=w*Fs/(2*pi); % 转化为Hzz=filter(B,A,x);subplot(4,1,3);plot(z);title(滤波后信号时域波开形);Y1=abs(fft(z,Fs);subplot(4,1,4);plot(Y1(1:length(Y1)/2);title(滤波后信号的频谱); p=audioplayer(z,s);play(p);(5) PLAY按钮所对应代码function pushbutton5_Callback(hObject, eventdata, handles)global name1;global name2;global p;x,Fs=wavread(name1);h=axes(units,normalized,position,0,0,1,1);uistack(h,up);i=imread(name2);image(i);set(h,handlevisibility,off,visible,off);%全屏背景p=audioplayer(x,Fs);play(p);% 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)(6) STOP 按钮所对应代码function pushbutton6_Callback(hObject, eventdata, handles)global p;stop(p);% 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)其他相关代码function varargout = projecttry(varargin)% PROJECTTRY M-file for projecttry.fig% PROJECTTRY, by itself, creates a new PROJECTTRY or raises the existing% singleton*.% H = PROJECTTRY returns the handle to a new PROJECTTRY or the handle to% the existing singleton*.% PROJECTTRY(CALLBACK,hObject,eventData,handles,.) calls the local% function named CALLBACK in PROJECTTRY.M with the given input arguments.% PROJECTTRY(Property,Value,.) creates a new PROJECTTRY or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before projecttry_OpeningFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to projecttry_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 projecttry% Last Modified by GUIDE v2.5 21-May-2014 22:53:44% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct(gui_Name, mfilename, . gui_Singleton, gui_Singleton, . gui_OpeningFcn, projecttry_OpeningFcn, . gui_OutputFcn, projecttry_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 projecttry is made visible.function projecttry_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 projecttry (see VARARGIN)% Choose default command line output for projecttryhandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes projecttry wait for user response (see UIRESUME)% uiwait(handles.figure1);% - Outputs from this function are returned to the command line.function varargout = projecttry_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;function edit1_Callback(hObject, eventdata, handles)% hObject handle to edit1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,String) returns contents of edit1 as text% str2double(get(hObject,String) returns contents of edit1 as a double% - Executes during object creation, after setting all properties.function edit1_CreateFcn(hObject, eventdata, handles)% hObject handle to edit1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit 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);endfunction edit2_Callback(hObject, eventdata, handles)% hObject handle to edit2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,String) returns contents of edit2 as text% str2double(get(hObject,String) returns contents of edit2 as a double% - Executes during object creation, after setting all properties.function edit2_CreateFcn(hObject, eventdata, handles)% hObject handle to edit2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit 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);endfunction edit3_Callback(hObject, eventdata, handles)% hObject handle to edit3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,String) returns contents of edit3 as text% str2double(get(hObject,String) returns contents of edit3 as a double% - Executes during object creation, after setting all properties.function edit3_CreateFcn(hObject, eventdata, handles)% hObject handle to edit3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit 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);endfunction edit4_Callback(hObject, eventdata, handles)% hObject handle to edit4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,String) returns contents of edit4 as text% str2double(get(hObject,String) returns contents of edit4 as a double% - Executes during object creation, after setting all properties.function edit4_CreateFcn(hObject, eventdata, handles)% hObject handle to edit4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit 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);endfunction edit5_Callback(hObject, eventdata, handles)% hObject handle to edit5 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,String) returns contents of edit5 as text% str2double(get(hObject,String) returns contents of edit5 as a double% - Executes during object creation, after setting all properties.function edit5_CreateFcn(hObject, eventdata, handles)% hObject handle to edit5 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit 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);endfunction edit6_Callback(hObject, eventdata, handles)% hObject handle to edit6 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,String) returns contents of edit6 as text% str2double(get(hObject,String) returns contents of edit6 as a double% - Executes during object creation, after setting all properties.function edit6_CreateFcn(hObject, eventdata, handles)% hObject handle t

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论