版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、數(shù)字信號(hào)處理課程設(shè)計(jì)報(bào)告課設(shè)題目:語音信號(hào)變聲處理系統(tǒng)學(xué)院:信息科學(xué)與工程學(xué)院專業(yè):電子與信息工程班級(jí):姓名:學(xué)號(hào):指導(dǎo)教師:哈爾濱工業(yè)大學(xué)(威海)2011 年7 月8 日目錄一. 課程設(shè)計(jì)任務(wù) . 1二. 課程設(shè)計(jì)原理及設(shè)計(jì)方案. 1三. 課程設(shè)計(jì)的步驟和結(jié)果. 3四. 課程設(shè)計(jì)總結(jié) . 17五. 設(shè)計(jì)體會(huì) . 18六. 參考文獻(xiàn) . 19哈爾濱工業(yè)大學(xué)(威海)課程設(shè)計(jì)報(bào)告- 1 - 一. 課程設(shè)計(jì)任務(wù)電視臺(tái)經(jīng)常針對(duì)某些事件的知情者進(jìn)行采訪,為了保護(hù)知情者,經(jīng)常改變說話人的聲音,請(qǐng)利用所學(xué)的知識(shí),將其實(shí)現(xiàn)。1) 自己錄制一段正常的聲音文件,或者通過菜單選擇的方式選擇一段正常聲音文件;2) 能
2、夠播放該文件;3) 對(duì)語音信號(hào)進(jìn)行處理,要求處理后的語音信號(hào)基本不影響正常收聽與理解;5) 對(duì)處理參數(shù)能夠通過 matlab 界面進(jìn)行調(diào)節(jié),以對(duì)比不同處理效果;6) 能夠?qū)μ幚砗蟮穆曇粑募c原始聲音文件的頻譜進(jìn)行觀察、分析。7) 編制 gui用戶界面。哈爾濱工業(yè)大學(xué)(威海)課程設(shè)計(jì)報(bào)告- 2 - 二. 課程設(shè)計(jì)原理及設(shè)計(jì)方案()選取需要變聲的原始語音信號(hào);()得到原始語音信號(hào)的基音周期長度;()根據(jù)基音周期長度定位整個(gè)原始語音信號(hào)的每一個(gè)基音周期的位置;()在原始語音信號(hào)中的基音周期之間刪除插入基音周期,得到縮短伸長的語音信號(hào);()將縮短伸長的語音信號(hào)線性伸長壓縮至與原始語音信號(hào)一致的長度,得
3、到變聲后的語音信號(hào)。哈爾濱工業(yè)大學(xué)(威海)課程設(shè)計(jì)報(bào)告- 3 - 三. 課程設(shè)計(jì)的步驟和結(jié)果function varargout = fenxi(varargin) gui_singleton = 1; gui_state = struct(gui_name , mfilename, .gui_singleton, gui_singleton, .gui_openingfcn, fenxi_openingfcn, .gui_outputfcn, fenxi_outputfcn, .gui_layoutfcn, , .gui_callback, ); if nargin & ischar
4、(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 fenxi is made visible.function fenxi_openingfcn(hobject, eventdat
5、a, 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 fenxi (see varargin)% choose default co
6、mmand line output for fenxihandles.output = hobject; % update handles structureguidata(hobject, handles); % uiwait makes fenxi wait for user response (see uiresume)哈爾濱工業(yè)大學(xué)(威海)課程設(shè)計(jì)報(bào)告- 4 - % uiwait(handles.figure1);% - outputs from this function are returned to the command line.function varargout = fe
7、nxi_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 h
8、andles structurevarargout1 = handles.output; % - executes on button press in luyin.function luyin_callback(hobject, eventdata, handles) if get(hobject,value) % set(handles.luyinpinlv,enable,on); set(handles.dakai,value,0); set(handles.luyinshijian,enable, on ); set(handles.luyinqueding,enable, on );
9、 set(handles.dakaiqueding,enable, off); set(handles.bofang,value,0); set(handles.bofangpinlv,enable, off); set(handles.bofangqueding,enable, off); set(handles.luyinqueding,string, start); elseend; % hint: get(hobject,value) returns toggle state of luyin% - executes on button press in dakai.function
10、dakai_callback(hobject, eventdata, handles) if get(hobject,value) set(handles.luyin,value,0); set(handles.luyinshijian,enable, off); set(handles.luyinqueding,enable, off); set(handles.dakaiqueding,enable, on ); set(handles.bofang,value,0); %set(handles.bofangpinlv,enable,off); set(handles.bofangqued
11、ing,enable, off); 哈爾濱工業(yè)大學(xué)(威海)課程設(shè)計(jì)報(bào)告- 5 - %set(handles.luyinpinlv,enable,off);elseend; function radiobutton3_callback(hobject, eventdata, handles) % hobject handle to radiobutton3 (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles structure with handles and user dat
12、a (see guidata)% hint: get(hobject,value) returns toggle state of radiobutton3% - executes on button press in luyinqueding.function luyinqueding_callback(hobject, eventdata, handles) % hobject handle to luyinqueding (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handle
13、s structure with handles and user data (see guidata)set(hobject,string, recording); pause(0.4); fs=44100; t=str2double(get(handles.luyinshijian,string); ai=analoginput(winsound,0); % 初始化錄音麥克chanel=addchannel(ai,1);%1 表示單聲道set(ai,samplerate ,fs); duration=t; % 錄音時(shí)間set(ai,samplespertrigger,duration*fs
14、); start(ai); y=0;time=0; y,time=getdata(ai);% 讀出相應(yīng)的數(shù)據(jù)handles.y=y; handles.fs=fs; guidata(hobject,handles); plot(handles.huitu2,time,handles.y)% 畫出聲音波形title(handles.huitu2, 時(shí)域圖 ); ysize=size(handles.y); set(hobject,string, finish); set(handles.yuchuli,enable, on ); set(handles.yuchuliqd,enable, on )
15、; 哈爾濱工業(yè)大學(xué)(威海)課程設(shè)計(jì)報(bào)告- 6 - set(handles.fuliyebianhuan,enable , on ); set(handles.baocun,enable, on ); %set(handles.biansheng,enable,on);% - executes on button press in dakaiqueding.function dakaiqueding_callback(hobject, eventdata, handles) % hobject handle to dakaiqueding (see gcbo)% eventdata reserv
16、ed - to be defined in a future version of matlab% handles structure with handles and user data (see guidata) filename pathname=uigetfile(*.wav, all files(*.*), select); if isequal(filename pathname,0,0) return ; endstr=pathname filename;% 選擇的聲音文件路徑和文件名temp fs=wavread(str);%temp 表示聲音數(shù)據(jù) fs 表示頻率handles
17、.y=temp;handles.fs=fs; guidata(hobject,handles); set(handles.yuchuli,enable, on ); set(handles.yuchuliqd,enable, on ); set(handles.fuliyebianhuan,enable , on ); set(handles.baocun,enable, on ); %set(handles.biansheng,enable,on); set(handles.bofang,enable, on ); % - executes on button press in pushbu
18、tton3.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)function luyinshijian_callback(hobject, eventdata, handles) % hobje
19、ct handle to luyinshijian (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 luyinshijian as text%str2double(get(hobject,string) returns contents of luyinshijian 哈爾濱工
20、業(yè)大學(xué)(威海)課程設(shè)計(jì)報(bào)告- 7 - as a double% - executes during object creation, after setting all properties.function luyinshijian_createfcn(hobject, eventdata, handles) ifispc & isequal(get(hobject,backgroundcolor), get(0, defaultuicontrolbackgroundcolor) set(hobject,backgroundcolor, white); end% - executes
21、 on button press in bofang.function bofang_callback(hobject, eventdata, handles) if get(hobject,value) set(handles.luyin,value,0); set(handles.luyinshijian,enable, off); set(handles.luyinqueding,enable, off); set(handles.dakaiqueding,enable, off); set(handles.dakai,value,0); set(handles.bofangpinlv,
22、enable, on ); set(handles.bofangqueding,enable, on ); % set(handles.luyinpinlv,enable,off);elseend; % hint: get(hobject,value) returns toggle state of bofangfunction bofangpinlv_callback(hobject, eventdata, handles) function bofangpinlv_createfcn(hobject, eventdata, handles) ifispc & isequal(get
23、(hobject,backgroundcolor), get(0, defaultuicontrolbackgroundcolor) set(hobject,backgroundcolor, white); end% - executes on button press in bofangqueding.function bofangqueding_callback(hobject, eventdata, handles) % hobject handle to bofangqueding (see gcbo)% eventdata reserved - to be defined in a
24、future version of matlab% handles structure with handles and user data (see guidata)c=handles.fs; contents = cellstr(get(handles.bofangpinlv,string) ;% 獲取listbox1哈爾濱工業(yè)大學(xué)(威海)課程設(shè)計(jì)報(bào)告- 8 - 中的細(xì)胞矩陣bj=contentsget(handles.bofangpinlv,value); % 獲取listbox中的值if strcmp(bj,frequency) ds=c; elseif strcmp(bj,male
25、) ds=0.7*c; else ds=1.7*c; end; wavplay(handles.y,ds); y=fft(handles.y,length(handles.y); ysize=size(y); plot(handles.huitu2,abs(y); xlabel(handles.huitu2,f/hz); ylabel(handles.huitu2,range ); title(handles.huitu2,frequency ); grid on; function luyinpinlv_callback(hobject, eventdata, handles) % hobj
26、ect handle to luyinpinlv (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 luyinpinlv as text% str2double(get(hobject,string) returns contents of luyinpinlv as a dou
27、ble% - executes during object creation, after setting all properties.function luyinpinlv_createfcn(hobject, eventdata, handles) % hobject handle to luyinpinlv (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles empty - handles not created until after all createfcns
28、called哈爾濱工業(yè)大學(xué)(威海)課程設(shè)計(jì)報(bào)告- 9 - % hint: edit controls usually have a white background on windows.% see ispc and computer.ifispc & isequal(get(hobject,backgroundcolor), get(0, defaultuicontrolbackgroundcolor) set(hobject,backgroundcolor, white); endfunction xianshi_callback(hobject, eventdata, handl
29、es) % hobject handle to xianshi (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 xianshi as text% str2double(get(hobject,string) returns contents of xianshi as a do
30、uble% - executes during object creation, after setting all properties.function xianshi_createfcn(hobject, eventdata, handles) % hobject handle to xianshi (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles empty - handles not created until after all createfcns calle
31、d% hint: edit controls usually have a white background on windows.% see ispc and computer.ifispc & isequal(get(hobject,backgroundcolor), get(0, defaultuicontrolbackgroundcolor) set(hobject,backgroundcolor, white); end% - executes on button press in yuchuliqd.function yuchuliqd_callback(hobject,
32、eventdata, handles) % hobject handle to yuchuliqd (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles structure with handles and user data (see guidata)contents = cellstr(get(handles.yuchuli,string) ;% 獲取listbox1中的哈爾濱工業(yè)大學(xué)(威海)課程設(shè)計(jì)報(bào)告- 10 - 細(xì)胞矩陣bj=contentsget(handles.y
33、uchuli,value); % 獲取listbox中的值if strcmp(bj,removal of dc component) shuju=handles.y; handles.y=shuju-mean(shuju); elseif strcmp(bj,removal of long-term trend) y=handles.y; handles.y=detrend(y); elsey=handles.y;fs=handles.fs; % 低通濾波器性能指標(biāo),% fp=1000; fc=2000; as=100; ap=1;wp=2*1200/8000; % 歸一化通帶數(shù)字頻率 wpw
34、s=2*2000/8000; % 歸一化阻帶數(shù)字截止頻率wsrp=0.5; % 通帶波紋系數(shù) rprs=60; % 最小阻帶衰減 rsn,wn=buttord(wp,ws,rp,rs); % 求階數(shù) n和濾波器截止頻率 wnnum,den=butter(n,rp); % 傳輸分子和分母的系數(shù)h,w=freqz(num,den); % 求頻率響應(yīng)f=filter(num,den,y); % 濾波f1=fft(f,fs); handles.y=f; plot(handles.huitu,abs(f1); % 畫出濾波后的時(shí)域圖title(handles.huitu, 濾波后的幅度譜 ); set(
35、handles.huitu,xgrid, on ); set(handles.huitu,ygrid, on ); plot(handles.huitu2,angle(f1); % 畫出濾波后的時(shí)域圖title(handles.huitu2, 濾波后的相位譜 ); grid on; end; guidata(hobject,handles); % - executes on selection change in yuchuli.function yuchuli_callback(hobject, eventdata, handles) 哈爾濱工業(yè)大學(xué)(威海)課程設(shè)計(jì)報(bào)告- 11 - % ho
36、bject handle to yuchuli (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 yuchuli contents as cell array% contentsget(hobject,value) returns selected item fro
37、m yuchuli% - executes during object creation, after setting all properties.function yuchuli_createfcn(hobject, eventdata, handles) % hobject handle to yuchuli (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles empty - handles not created until after all createfcns
38、called% hint: popupmenu controls usually have a white background on windows.% see ispc and computer.ifispc & isequal(get(hobject,backgroundcolor), get(0, defaultuicontrolbackgroundcolor) set(hobject,backgroundcolor, white); end% - executes on button press in fuliyebianhuan.function fuliyebianhua
39、n_callback(hobject, eventdata, handles) % hobject handle to fuliyebianhuan (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles structure with handles and user data (see guidata) temp=handles.y; fs=handles.fs; len=max(size(temp);% 讀出聲音數(shù)據(jù)文件的長度sel,ok=listdlg(liststring
40、, length, 128 , 256 , 512 , 1024 , 2048 , 4096 , 8192 , 16384 , 32768 , 65536 , .name , choose fft , okstring, yes , .cancelstring, cancle, selectionmode, single, listsize,250 150); 哈爾濱工業(yè)大學(xué)(威海)課程設(shè)計(jì)報(bào)告- 12 - data_frequency=len,128,256,512,1024,2048,4096,8192,16384,32768,65536; if ok=1 m=data_frequency
41、(sel); y=temp(1:m);% 取前m個(gè)數(shù)據(jù)做變換 s=length(y); zh=fft(y,s); % 做fft 變換 f=0:fs/s:fs*(s-1)/s; % 計(jì)算頻率 plot(handles.huitu2,f(1:m/2),zh(1:m/2) set(handles.huitu2,xgrid, on ); set(handles.huitu2,ygrid, on ); legend( 頻譜圖 ); xlabel(handles.huitu2, 頻率 ); ylabel(handles.huitu2, 振幅 ); elseend% - executes on button
42、 press in baocun.function baocun_callback(hobject, eventdata, handles) % hobject handle to baocun (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles structure with handles and user data (see guidata)fs=handles.fs; sel,ok=listdlg(liststring, frequency, 6000 , 8000 ,
43、 11025 , 16000 , 22050 , 32000 , 44100 , 48000 , 96000 , .name , choose frequency, okstring, yes, .cancelstring, cancle, selectionmode, single, listsize,240 120); data_frequency=fs,6000,8000,11025,16000,22050,32000,44100,48000,96000; if ok=1 fs=data_frequency(sel); filename=uiputfile(*.wav, save as)
44、; wavwrite(handles.y,fs,filename);%data表示聲音數(shù)據(jù)else哈爾濱工業(yè)大學(xué)(威海)課程設(shè)計(jì)報(bào)告- 13 - end; % - executes on button press in biansheng.function biansheng_callback(hobject, eventdata, handles) % hobject handle to biansheng (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles structu
45、re with handles and user data (see guidata)% ct1set(hobject,string, processing, please wait); % 定義常數(shù) fl = 80; % 幀長 wl = 240; % 窗長 p = 10; % 預(yù)測系數(shù)個(gè)數(shù) s=handles.y;fs=handles.fs; % 載入語音 s s = s/max(s); % 歸一化 l = length(s); % 讀入語音長度 fn = floor(l/fl)-2; % 計(jì)算幀數(shù)% 預(yù)測和重建濾波器 exc = zeros(l,1); % 激勵(lì)信號(hào)(預(yù)測誤差) zi_pr
46、e = zeros(p,1); % 預(yù)測濾波器的狀態(tài) s_rec = zeros(l,1); % 重建語音 zi_rec = zeros(p,1); % 合成濾波器 exc_syn = zeros(l,1); % 合成的激勵(lì)信號(hào)(脈沖串) s_syn = zeros(l,1); % 合成語音 last_syn = 0; % 存儲(chǔ)上一個(gè)(或多個(gè))段的最后一個(gè)脈沖的下標(biāo) zi_syn = zeros(p,1); % 合成濾波器的狀態(tài)% 變調(diào)不變速濾波器 exc_syn_t = zeros(l,1); % 合成的激勵(lì)信號(hào)(脈沖串) s_syn_t = zeros(l,1); % 合成語音 last_
47、syn_t = 0; % 存儲(chǔ)上一個(gè)(或多個(gè))段的最后一個(gè)脈沖的下標(biāo) zi_syn_t = zeros(p,1); % 合成濾波器的狀態(tài)% 變速不變調(diào)濾波器(假設(shè)速度減慢一倍) hw = hamming(wl); % 漢明窗% 依次處理每幀語音哈爾濱工業(yè)大學(xué)(威海)課程設(shè)計(jì)報(bào)告- 14 - for n = 3:fn % 計(jì)算預(yù)測系數(shù)(不需要掌握) s_w = s(n*fl-wl+1:n*fl).*hw; % 漢明窗加權(quán)后的語音 a e = lpc(s_w, p); % 用線性預(yù)測法計(jì)算 p個(gè)預(yù)測系數(shù)% a 是預(yù)測系數(shù), e會(huì)被用來計(jì)算合成激勵(lì)的能量 s_f = s(n-1)*fl+1:n*fl); % 本幀語音,
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 建筑資質(zhì)維護(hù)勞務(wù)協(xié)議書(2篇)
- 工廠用臨時(shí)工合同范本(2篇)
- 物業(yè)公司2025年度學(xué)校門衛(wèi)保養(yǎng)維護(hù)合同3篇
- 鋁合金百葉施工方案
- 臨戰(zhàn)水平封堵施工方案
- 二零二五版白灰礦產(chǎn)資源開采合同協(xié)議書3篇
- 2024年浙江省無人機(jī)應(yīng)用技能競賽備考試題庫(含各題型)
- 2025年度個(gè)人購房合同備案及過戶服務(wù)協(xié)議4篇
- 二零二五年度文化創(chuàng)意產(chǎn)品研發(fā)與銷售合同4篇
- 軸及夾具課程設(shè)計(jì)
- CT設(shè)備維保服務(wù)售后服務(wù)方案
- 重癥血液凈化血管通路的建立與應(yīng)用中國專家共識(shí)(2023版)
- 兒科課件:急性細(xì)菌性腦膜炎
- 柜類家具結(jié)構(gòu)設(shè)計(jì)課件
- 陶瓷瓷磚企業(yè)(陶瓷廠)全套安全生產(chǎn)操作規(guī)程
- 煤炭運(yùn)輸安全保障措施提升運(yùn)輸安全保障措施
- JTGT-3833-2018-公路工程機(jī)械臺(tái)班費(fèi)用定額
- 保安巡邏線路圖
- (完整版)聚乙烯課件
- 建筑垃圾資源化綜合利用項(xiàng)目可行性實(shí)施方案
- 大華基線解碼器解碼上墻的操作
評(píng)論
0/150
提交評(píng)論