




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、數(shù)字信號(hào)處理課程設(shè)計(jì)報(bào)告課設(shè)題目:語(yǔ)音信號(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)常改變說(shuō)話人的聲音,請(qǐng)利用所學(xué)的知識(shí),將其實(shí)現(xiàn)。1) 自己錄制一段正常的聲音文件,或者通過(guò)菜單選擇的方式選擇一段正常聲音文件;2) 能
2、夠播放該文件;3) 對(duì)語(yǔ)音信號(hào)進(jìn)行處理,要求處理后的語(yǔ)音信號(hào)基本不影響正常收聽(tīng)與理解;5) 對(duì)處理參數(shù)能夠通過(guò) 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ì)方案()選取需要變聲的原始語(yǔ)音信號(hào);()得到原始語(yǔ)音信號(hào)的基音周期長(zhǎng)度;()根據(jù)基音周期長(zhǎng)度定位整個(gè)原始語(yǔ)音信號(hào)的每一個(gè)基音周期的位置;()在原始語(yǔ)音信號(hào)中的基音周期之間刪除插入基音周期,得到縮短伸長(zhǎng)的語(yǔ)音信號(hào);()將縮短伸長(zhǎng)的語(yǔ)音信號(hào)線性伸長(zhǎng)壓縮至與原始語(yǔ)音信號(hào)一致的長(zhǎng)度,得
3、到變聲后的語(yǔ)音信號(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)% 畫(huà)出聲音波形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); % 畫(huà)出濾波后的時(shí)域圖title(handles.huitu, 濾波后的幅度譜 ); set(
35、handles.huitu,xgrid, on ); set(handles.huitu,ygrid, on ); plot(handles.huitu2,angle(f1); % 畫(huà)出濾波后的時(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ù)文件的長(zhǎng)度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; % 幀長(zhǎng) wl = 240; % 窗長(zhǎng) p = 10; % 預(yù)測(cè)系數(shù)個(gè)數(shù) s=handles.y;fs=handles.fs; % 載入語(yǔ)音 s s = s/max(s); % 歸一化 l = length(s); % 讀入語(yǔ)音長(zhǎng)度 fn = floor(l/fl)-2; % 計(jì)算幀數(shù)% 預(yù)測(cè)和重建濾波器 exc = zeros(l,1); % 激勵(lì)信號(hào)(預(yù)測(cè)誤差) zi_pr
46、e = zeros(p,1); % 預(yù)測(cè)濾波器的狀態(tài) s_rec = zeros(l,1); % 重建語(yǔ)音 zi_rec = zeros(p,1); % 合成濾波器 exc_syn = zeros(l,1); % 合成的激勵(lì)信號(hào)(脈沖串) s_syn = zeros(l,1); % 合成語(yǔ)音 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); % 合成語(yǔ)音 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ǔ)音哈爾濱工業(yè)大學(xué)(威海)課程設(shè)計(jì)報(bào)告- 14 - for n = 3:fn % 計(jì)算預(yù)測(cè)系數(shù)(不需要掌握) s_w = s(n*fl-wl+1:n*fl).*hw; % 漢明窗加權(quán)后的語(yǔ)音 a e = lpc(s_w, p); % 用線性預(yù)測(cè)法計(jì)算 p個(gè)預(yù)測(cè)系數(shù)% a 是預(yù)測(cè)系數(shù), e會(huì)被用來(lái)計(jì)算合成激勵(lì)的能量 s_f = s(n-1)*fl+1:n*fl); % 本幀語(yǔ)音,
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 樓梯店鋪利用方案(3篇)
- 燒烤聚餐采購(gòu)方案(3篇)
- 接待會(huì)議方案(3篇)
- 企業(yè)運(yùn)維方案(3篇)
- DB23-T3003-2021-馬鈴薯微型薯溫室床上畦作生產(chǎn)技術(shù)規(guī)程-黑龍江省
- 公司環(huán)保巡查管理制度
- 小區(qū)重點(diǎn)人員管理制度
- 員工股權(quán)分紅方案(3篇)
- 醫(yī)院隱私安全管理制度
- 破損路面重建方案(3篇)
- JC/T 929-2003葉臘石行業(yè)標(biāo)準(zhǔn)
- 國(guó)家職業(yè)技術(shù)技能標(biāo)準(zhǔn) 6-18-01-01 車(chē)工 人社廳發(fā)2018145號(hào)
- 人教版小學(xué)五年級(jí)數(shù)學(xué)下冊(cè)第三單元測(cè)試卷(含答案)
- 小兒急乳蛾的護(hù)理查房
- 胸骨后甲狀腺腫課件
- 公司差旅費(fèi)報(bào)銷(xiāo)單
- 如何撰寫(xiě)高水平的博士論文
- 三班兩倒排班表
- 制冷車(chē)間及冷庫(kù)日常隱患排查表
- 風(fēng)口風(fēng)閥安裝施工流程及工藝工法
- 商混站崗位職責(zé)匯編
評(píng)論
0/150
提交評(píng)論