大连理工大学数字信号处理实验二电话拨号音的合成与识别
《大连理工大学数字信号处理实验二电话拨号音的合成与识别》由会员分享,可在线阅读,更多相关《大连理工大学数字信号处理实验二电话拨号音的合成与识别(10页珍藏版)》请在装配图网上搜索。
1、大连理工大学实验报告学院(系): 电信 专业: 电子信息工程 班级: 电子1204 姓 名: 梁宇 学号: 201281001 组: _ 实验时间: 实验室: 实验台: 指导教师签字: 成绩: 实验二、 拨号音的合成与识别一、实验题目和代码实现对 通信系统中拨号音合成与识别的仿真实现。系统界面设计:源程序:function varargout = sy2(varargin)% SY2, by itself, creates a new SY2 or raises the existing% singleton*.% H = SY2 returns the handle to a new SY2
2、 or the handle to% the existing singleton*.% SY2(CALLBACK,hObject,eventData,handles,.) calls the local% function named CALLBACK in SY2.M with the given input arguments.% SY2(Property,Value,.) creates a new SY2 or raises the% existing singleton*. Starting from the left, property value pairs are% appl
3、ied to the GUI before sy2_OpeningFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to sy2_OpeningFcn via varargin.% *See GUI Options on GUIDEs Tools menu. Choose GUI allows only one% instance to run (singleton).% See also: GUIDE,
4、 GUIDATA, GUIHANDLES % Edit the above text to modify the response to help sy2 % Last Modified by GUIDE v2.5 03-Jun-2015 23:06:41 % Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct(gui_Name, mfilename, . gui_Singleton, gui_Singleton, . gui_OpeningFcn, sy2_OpeningFcn, . gui_
5、OutputFcn, sy2_OutputFcn, . gui_LayoutFcn, , . gui_Callback, );if nargin & ischar(varargin1) 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 % - Execut
6、es just before sy2 is made visible.function sy2_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)%
7、 varargin command line arguments to sy2 (see VARARGIN) % Choose default command line output for sy2handles.output = hObject; handles.fs=8192;handles.DTMFsum=820;handles.DTMFnum=410;handles.NUM=;handles.numshow2=;% Update handles structureguidata(hObject, handles); % UIWAIT makes sy2 wait for user re
8、sponse (see UIRESUME)% uiwait(handles.figure1); % - Outputs from this function are returned to the command line.function varargout = sy2_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT);% hObject handle to figure% eventdata reserved - to be defi
9、ned 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 num1.function num1_Callback(hObject, eventdata, handles)% hObject handle to num1 (see GCB
10、O)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n1=strcat(get(handles.numshow,string),1) %set(handles.numshow,string,n1); %n=1:handles.DTMFnum;d1=sin(2*pi*697/handles.fs*n)+sin(2*pi*1209/handles.fs*n);%space=zeros(1,hand
11、les.DTMFnum);%4100temp=d1,space;handles.NUM=handles.NUM,temp;%guidata(hObject,handles);audioplayer(d1,8192); % - Executes on button press in num2.function num2_Callback(hObject, eventdata, handles)% hObject handle to num2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB%
12、handles structure with handles and user data (see GUIDATA)n2=strcat(get(handles.numshow,string),2) %set(handles.numshow,string,n2); %n=1:handles.DTMFnum;d2=sin(2*pi*697/handles.fs*n)+sin(2*pi*1336/handles.fs*n);%space=zeros(1,handles.DTMFnum);%4100temp=d2,space;handles.NUM=handles.NUM,temp;%guidata(
13、hObject,handles);audioplayer(d2,8192); % - Executes on button press in num3.function num3_Callback(hObject, eventdata, handles)% hObject handle to num3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n3=strcat(ge
14、t(handles.numshow,string),3) %set(handles.numshow,string,n3); %n=1:handles.DTMFnum;d3=sin(2*pi*697/handles.fs*n)+sin(2*pi*1477/handles.fs*n);%space=zeros(1,handles.DTMFnum);%4100temp=d3,space;handles.NUM=handles.NUM,temp;%guidata(hObject,handles);audioplayer(d3,8192); % - Executes on button press in
15、 num4.function num4_Callback(hObject, eventdata, handles)% hObject handle to num4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n4=strcat(get(handles.numshow,string),4) %set(handles.numshow,string,n4); %n=1:han
16、dles.DTMFnum;d4=sin(2*pi*770/handles.fs*n)+sin(2*pi*1209/handles.fs*n);%space=zeros(1,handles.DTMFnum);%4100temp=d4,space;handles.NUM=handles.NUM,temp;%guidata(hObject,handles);audioplayer(d4,8192); % - Executes on button press in num5.function num5_Callback(hObject, eventdata, handles)% hObject han
17、dle to num5 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n5=strcat(get(handles.numshow,string),5) %set(handles.numshow,string,n5); %n=1:handles.DTMFnum;d5=sin(2*pi*770/handles.fs*n)+sin(2*pi*1336/handles.fs*n)
18、;%space=zeros(1,handles.DTMFnum);%4100temp=d5,space;handles.NUM=handles.NUM,temp;%guidata(hObject,handles);audioplayer(d5,8192); % - Executes on button press in num6.function num6_Callback(hObject, eventdata, handles)% hObject handle to num6 (see GCBO)% eventdata reserved - to be defined in a future
19、 version of MATLAB% handles structure with handles and user data (see GUIDATA)n6=strcat(get(handles.numshow,string),6) %set(handles.numshow,string,n6); %n=1:handles.DTMFnum;d6=sin(2*pi*770/handles.fs*n)+sin(2*pi*1477/handles.fs*n);%space=zeros(1,handles.DTMFnum);%4100temp=d6,space;handles.NUM=handle
20、s.NUM,temp;%guidata(hObject,handles);audioplayer(d6,8192); % - Executes on button press in num7.function num7_Callback(hObject, eventdata, handles)% hObject handle to num7 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see
21、GUIDATA)n7=strcat(get(handles.numshow,string),7) %set(handles.numshow,string,n7); %n=1:handles.DTMFnum;d7=sin(2*pi*852/handles.fs*n)+sin(2*pi*1209/handles.fs*n);%space=zeros(1,handles.DTMFnum);%4100temp=d7,space;handles.NUM=handles.NUM,temp;%guidata(hObject,handles);audioplayer(d7,8192); % - Execute
22、s on button press in num8.function num8_Callback(hObject, eventdata, handles)% hObject handle to num8 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n8=strcat(get(handles.numshow,string),8) %set(handles.numshow,
23、string,n8); %n=1:handles.DTMFnum;d8=sin(2*pi*852/handles.fs*n)+sin(2*pi*1336/handles.fs*n);%space=zeros(1,handles.DTMFnum);%4100temp=d8,space;handles.NUM=handles.NUM,temp;%guidata(hObject,handles);audioplayer(d8,8192); % - Executes on button press in num9.function num9_Callback(hObject, eventdata, h
24、andles)% hObject handle to num9 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n9=strcat(get(handles.numshow,string),9) %set(handles.numshow,string,n9); %n=1:handles.DTMFnum;d9=sin(2*pi*852/handles.fs*n)+sin(2*p
25、i*1477/handles.fs*n);%space=zeros(1,handles.DTMFnum);%4100temp=d9,space;handles.NUM=handles.NUM,temp;%guidata(hObject,handles);audioplayer(d9,8192); % - Executes on button press in num10.function num10_Callback(hObject, eventdata, handles)% hObject handle to num10 (see GCBO)% eventdata reserved - to
26、 be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n=1:1000;num=get(handles.numshow,string);l=length(num);n10=strrep(num,num,num(1:l-1);d10=sin(0.7217*n)+sin(0.9273*n);set(handles.numshow,string,n10);L=length(handles.NUM);handles.NUM=handles.NUM(1:L-
27、820);guidata(hObject, handles);audioplayer(d10,8192); % - Executes on button press in num0.function num0_Callback(hObject, eventdata, handles)% hObject handle to num0 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDA
28、TA)n0=strcat(get(handles.numshow,string),0) %set(handles.numshow,string,n0); %n=1:handles.DTMFnum;d0=sin(2*pi*941/handles.fs*n)+sin(2*pi*1336/handles.fs*n);%space=zeros(1,handles.DTMFnum);%4100temp=d0,space;handles.NUM=handles.NUM,temp;%guidata(hObject,handles);audioplayer(d0,8192); % - Executes on
29、button press in num11.function num11_Callback(hObject, eventdata, handles)% hObject handle to num11 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.numshow,string,get(handles.numshow,string),#);fs=819
30、2;fL=941;fH=1477;wL=2*pi*fL/fs;wH=2*pi*fH/fs;n=1:410;d12=sin(wL*n)+sin(wH*n);sound=d12,zeros(1,410);audioplayer(sound,fs)pause(.5);if isempty(handles.NUM) audioplayer(handles.NUM,fs); all_numdata=handles.NUM; n=length(handles.NUM)/820; rowf_mat=zeros(1,n); colf_mat=zeros(1,n); identify_result=; for
31、i=1:n d=all_numdata(i-1)*820+1:i*820); f=fft(d,fs); a=abs(f); p=a.*a/fs; value,rowf_mat(i)=max(p(1:1000); value,colf_mat(i)=max(p(1000:1700); colf_mat(i)=colf_mat(i)+1000; end for i=1:n rowf=rowf_mat(i); colf=colf_mat(i); if rowf730; row=1; elseif rowf810 row=2; elseif rowf900 row=3; else row=4; end
32、 if colf1272.5; col=1; elseif col=2; else col=3; end if row=4&col=2 row=1;col=0; end identify_result=strcat(identify_result,num2str(3*(row-1)+col); end set(handles.numshow2,string,identify_result);end实验结果:1. 拨号2. 删除二、总结、讨论和建议本次实验开始时用的wavplay函数实现拨号音,但是在电脑上运行时因为MATLAB版本较高,wavplay函数已删除,改为了audioplayer函数实现,但是audioplayer函数需要参数定义,查阅了很多资料也没有学到,以至于运行程序的时候,总是在“#”回显是因为audioplayer的缘故不能实现回显,没有完成语音信号的识别。但是在程序中编写了回显识别的函数,通过与其他同学的比对,程序理论没有发现错误,但是实际运行中就是无法实现回显识别功能,是本次实验的一大不足。其他部分没有太大的问题。同时通过本次实验进一步熟悉了MATLAB中GUI的操作。参考资料:
- 温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。