《【精编】数字信号处理实验报告--电话拨号音合成与识别-精品资料.pdf》由会员分享,可在线阅读,更多相关《【精编】数字信号处理实验报告--电话拨号音合成与识别-精品资料.pdf(11页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、大连理工大学实验报告学院(系):专业:班级:姓名:学号:组:_ 实验时间:实验室:实验台:指导教师签字:成绩:实验二 电话拨号音合成与识别一、实验结果与分析数字拨号音频谱分析(代码与频谱):n=1:410;fs=8192;d1=sin(2*pi*697/fs*n)+sin(2*pi*1209/fs*n);D1=fft(d1);t1=(0:length(d1)-1)*fs/length(d1)-fs/2;figure(1);plot(t1,fftshift(abs(D1);title(按键 1的频谱);d1=sin(2*pi*697/fs*n)+sin(2*pi*1336/fs*n);D1=ff
2、t(d1);figure(2);plot(t1,fftshift(abs(D1);title(按键 2的频谱);d1=sin(2*pi*697/fs*n)+sin(2*pi*1477/fs*n);D1=fft(d1);figure(3);plot(t1,fftshift(abs(D1);title(按键 3的频谱);d1=sin(2*pi*770/fs*n)+sin(2*pi*1209/fs*n);D1=fft(d1);figure(4);plot(t1,fftshift(abs(D1);title(按键 4的频谱);d1=sin(2*pi*770/fs*n)+sin(2*pi*1336/fs
3、*n);D1=fft(d1);figure(5);plot(t1,fftshift(abs(D1);title(按键 5的频谱);d1=sin(2*pi*770/fs*n)+sin(2*pi*1477/fs*n);D1=fft(d1);figure(6);plot(t1,fftshift(abs(D1);title(按键 6的频谱);d1=sin(2*pi*852/fs*n)+sin(2*pi*1209/fs*n);D1=fft(d1);figure(7);plot(t1,fftshift(abs(D1);title(按键 7的频谱);d1=sin(2*pi*852/fs*n)+sin(2*p
4、i*1336/fs*n);D1=fft(d1);figure(8);plot(t1,fftshift(abs(D1);title(按键 8的频谱);d1=sin(2*pi*852/fs*n)+sin(2*pi*1477/fs*n);D1=fft(d1);figure(9);plot(t1,fftshift(abs(D1);title(按键 9的频谱);d1=sin(2*pi*941/fs*n)+sin(2*pi*1209/fs*n);D1=fft(d1);figure(10);plot(t1,fftshift(abs(D1);title(按键*的频谱);d1=sin(2*pi*941/fs*n
5、)+sin(2*pi*1336/fs*n);D1=fft(d1);figure(11);plot(t1,fftshift(abs(D1);title(按键 0的频谱);d1=sin(2*pi*941/fs*n)+sin(2*pi*1477/fs*n);D1=fft(d1);figure(12);plot(t1,fftshift(abs(D1);title(按键#的频谱);频谱图如下:-2000-1500-1000-5000500100015002000050100150200250按 键 1的 频 谱-2000-1500-1000-5000500100015002000050100150200
6、250按 键 2的频谱-2000-1500-1000-5000500100015002000050100150200250按键 3的频谱-2000-1500-1000-5000500100015002000050100150200250按键 4的频谱-2000-1500-1000-5000500100015002000050100150200250按键 5的频谱-2000-1500-1000-5000500100015002000050100150200250按键 6的频谱-2000-1500-1000-5000500100015002000050100150200250按键 7的频谱-200
7、0-1500-1000-5000500100015002000050100150200250按键 8的频谱-2000-1500-1000-5000500100015002000050100150200250按 键 9的 频 谱-2000-1500-1000-5000500100015002000050100150200250按 键 *的 频 谱-2000-1500-1000-5000500100015002000050100150200250按 键 0的 频 谱-2000-1500-1000-5000500100015002000050100150200250按键#的频谱图形电话拨号面板的制作
8、:首先是框架的搭建:利用 callback在.m 文件中对各个模块进行代码的编辑(下面列出主要部分):1、数字 09 的显示与发声(以数字7为例):%-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 h
9、andles and user data(see GUIDATA)n0=strcat(get(handles.numshow,string),7);%获取数字号码set(handles.numshow,string,n0);%显示号码n=1:handles.DTMFnum;%每个数字 410 个采样点表示d0=sin(2*pi*852/handles.fs*n)+sin(2*pi*1209/handles.fs*n);%对应行频列频叠加space=zeros(1,handles.DTMFnum);%400 个 0 模拟静音信号phone=handles.NUM,d0;handles.NUM=p
10、hone,space;%存储连续的拨号音信号guidata(hObject,handles);wavplay(d0,8192);2、删除键*的代码:%-Executes on button press in pushbutton11.function pushbutton11_Callback(hObject,eventdata,handles)%hObject handle to pushbutton11(see GCBO)%eventdata reserved-to be defined in a future version of MATLAB%handles structure wit
11、h handles and user data(see GUIDATA)n=1:1000;num=get(handles.numshow,string);l=length(num);n11=strrep(num,num,num(1:l-1);d11=sin(0.7217*n)+sin(0.9273*n);set(handles.numshow,string,n11);L=length(handles.NUM);handles.NUM=handles.NUM(1:L-820);guidata(hObject,handles);wavplay(d11,8192);3、确认键#的代码:%-Execu
12、tes on button press in pushbutton12.function pushbutton12_Callback(hObject,eventdata,handles)%hObject handle to pushbutton12(see GCBO)%eventdata reserved-to be defined in a future version of MATLAB%handles structure with handles and user data(see GUIDATA)n0=strcat(get(handles.numshow,string),#);%获取数
13、字号码set(handles.numshow,string,n0);%显示号码n=1:handles.DTMFnum;%每个数字 410 个采样点表示d0=sin(2*pi*941/handles.fs*n)+sin(2*pi*1477/handles.fs*n);%对应行频列频叠加guidata(hObject,handles);wavplay(d0,8192);4、清空键 Reset 的代码:%-Executes on button press in btFW.function btFW_Callback(hObject,eventdata,handles)%hObject handle
14、to btFW(see GCBO)%eventdata reserved-to be defined in a future version of MATLAB%handles structure with handles and user data(see GUIDATA)handles.NUM=;set(handles.numshow,string,);%显示号码set(handles.numRec,string,);%显示号码guidata(hObject,handles);5、显示键的代码:%-Executes on button press in btRec.function btR
15、ec_Callback(hObject,eventdata,handles)%hObject handle to btRec(see GCBO)%eventdata reserved-to be defined in a future version of MATLAB%handles structure with handles and user data(see GUIDATA)L=length(handles.NUM);n=L/handles.DTMFsum;number=;for i=1:n j=(i-1)*handles.DTMFsum+1;d=handles.NUM(j:j+(ha
16、ndles.DTMFnum-1);%截取出每个数字 f=fft(d,8192);%以 N=2048 作 FFT 变换 a=abs(f);p=a.*a/handles.fs;%计算功率谱%p=a.*a/10000;%计算功率谱 num(1)=find(p(1:1000)=max(p(1:1000);%找行频 num(2)=1000+find(p(1000:1700)=max(p(1000:1700);%找列频 if(num(1)730)row=1;%确定行数 elseif(num(1)810)row=2;elseif(num(1)900)row=3;else row=4;end if(num(2
17、)1260)column=1;%确定列数 elseif(num(2)1400)column=2;else column=3;end z=row,column;%确定数字 if z=4,2 tel=0;elseif z=1,1 tel=1;elseif z=1,2 tel=2;elseif z=1,3 tel=3;elseif z=2,1 tel=4;elseif z=2,2 tel=5;elseif z=2,3 tel=6;elseif z=3,1 tel=7;elseif z=3,2 tel=8;elseif z=3,3 tel=9;end t(i)=tel;c=strcat(number,
18、int2str(tel);number=c;i=i+1;end set(handles.numRec,string,number);%显示号码GUI界面的操作:(1)初始化界面(2)输入数字后的界面(3)按*后删除一位(4)按#后确认键(5)按下显示键显示出来(6)按下 Reset 键清空二、讨论、建议、质疑做本实验分两部分,第一部分是做图形化(GUI)界面的设计,第二部分是做电话信号的频谱分析。做 GUI 设计中的问题:删除键部分*在 ppt 模板的基础上,将全局变量global NUM 删掉了,而改为用句柄handles.NUM.还有就是用guidata(hObject,handles);进行实时更新从而确保删除后能在内存中也删除。同时注意删除是820 个点,不是1100 个点。确认键#只需要发声和显示即可,不用放在内存中,显示键用的是ppt 上的模板,其他部分都顺利完成。第二部分频谱分析是利用FFT变换实现的,由于抽样过程会出现频谱搬移的现象,为了看到原有信号的频谱,采用:t1=(0:length(d1)-1)*fs/length(d1)-fs/2;从而保证抽样频率不会在频谱中体现出来,一共做出了12 个拨音信号的频谱。本实验作为综合性的实验,既让我熟悉了GUI 的设计,又强化了信号频谱分析的知识,这是本次实验的体会。