【文章內(nèi)容簡介】
e existing % singleton*. % % H = UNTITLED returns the handle to a new UNTITLED or the handle to % the existing singleton*. % % UNTITLED(39。CALLBACK39。,hObject,eventData,handles,...) calls the local % function named CALLBACK in with the given input arguments. % % UNTITLED(39。Property39。,39。Value39。,...) creates a new UNTITLED or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before untitled_OpeningF gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to untitled_OpeningF via varargin. % % *See GUI Options on GUIDE39。s 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 untitled % Last Modified by GUIDE 21Dec2020 21:01:58 % Begin initialization code DO NOT EDIT gui_Singleton = 1。 gui_State = struct(39。gui_Name39。, mfilename, ... 39。gui_Singleton39。, gui_Singleton, ... 39。gui_OpeningF39。, @untitled_OpeningF, ... 39。gui_OutputF39。, @untitled_OutputF, ... 39。gui_LayoutF39。, [] , ... 39。gui_Callback39。, [])。 if nargin amp。amp。 ischar(varargin{1}) = str2func(varargin{1})。 end if nargout [varargout{1:nargout}] = gui_mainf(gui_State, varargin{:})。 else gui_mainf(gui_State, varargin{:})。 end % End initialization code DO NOT EDIT % Executes just before untitled is made visible. function untitled_OpeningF(hObject, eventdata, handles, varargin) % This function has no output args, see OutputF. % 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 mand line arguments to untitled (see VARARGIN) % Choose default mand line output for untitled = hObject。 % Update handles structure guidata(hObject, handles)。 % UIWAIT makes untitled wait for user response (see UIRESUME) % uiwait()。 % Outputs from this function are returned to the mand line. function varargout = untitled_OutputF(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 mand line output from handles structure varargout{1} = 。 % Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) % 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) [y,fs,bits]=wavread(39。C:\Users\Administrator\Desktop\ 音 頻 信號(hào) .wav39。)。%讀取原始音頻信號(hào) y=y(:,1)。%只取單信道 sound(y,fs,bits)。%播放原始信號(hào) Y=fft(y)。%對(duì)原始信號(hào)取傅里葉變換 subplot(2,2,1:2)。plot(y)。title(39。原始信號(hào)時(shí)域波形 39。)。 subplot(2,2,3)。plot(abs(Y))。title(39。原始信號(hào)幅頻 39。)。 subplot(2,2,4)。plot(angle(Y))。title(39。原始信號(hào)相頻 39。)。 % Executes on button press in pushbutton2. function pushbutton2_Callback(hObject, eventdata, handles) % hObject handle to pushbutton2 (see GCBO) % eventdata reserved to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [y,fs,bits]=wavread(39。C:\Users\Administrator\Desktop\ 音 頻 信號(hào) .wav39。,[50000 500000])。%只取原信號(hào)的一部分,即時(shí)間區(qū)間 [50000 150000] y=y(:,1)。 Y=fft(y,6001)。%抽取 6001點(diǎn) subplot(2,2,1:2)。plot(y)。title(39。采樣信號(hào)時(shí)域波形 39。)。 subplot(2,2,3)。plot(abs(Y))。title(39。采樣信號(hào)幅頻 39。)。 subplot(2,2,4)。plot(angle(Y))。title(39。采樣信號(hào)相頻 39。)。 sound(y,fs,bits)。%回放采樣信號(hào) % Executes on button press in pushbutton3. 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) [y,fs,bits]=wavread(39。C:\Users\Administrator\Desktop\ 音 頻 信號(hào) .wav39。,[50000 500000])。 y=y(:,1)。 z=[zeros(20000,1)。y]。%延遲 3000 Z=fft(z,6001)。 subplot(2,2,1:2)。plot(z)。title(39。延時(shí)后時(shí)域波形 39。)。 subplot(2,2,3)。plot(abs(Z))。title(39。延時(shí)后幅頻 39。)。 subplot(2,2,4)。plot(angle(Z))。title(39。延時(shí)后相頻 39。)。 sound(y,fs,bits)。%回放延遲信號(hào) % Executes on button press in pushbutton4. function pushbutton4_Callback(hObject, eventdata, handles) % hObject handle to pushbutton4 (see GCBO) % eventdata reserved to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [y,fs,bits]=wavread(39。C:\Users\Administrator\Desktop\ 音 頻 信號(hào) .wav39。,[50000 150000])。 y=y(:,1)。 z=[zeros(3000,1)。y]。 y=[y。zeros(3000,1)]。%補(bǔ) 3000 y1=y+z。%將原始信號(hào)與延遲信號(hào)相加,產(chǎn)生混響信號(hào) Y1=fft(y1,6001)。 subplot(2,2,1:2)。plot(y1)。title(39?;祉懙臅r(shí)域波形 39。)。 subplot(2,2,3)。plot(abs(Y1))。title(39?;祉懙姆l 39。)。 subplot(2,2,4)。plot(angle(Y1))。title(39?;祉懙南囝l 39。)。 sound(y,fs,bits)。%回放混響信號(hào) % Executes on button press in pushbutton5. function pushbutton5_Callback(hObject, eventdata, handles) % 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) [y,fs,bits]=wavread(39。C:\Users\Administrator\Desktop\ 音 頻 信號(hào) .wav39。,[50000 500000])。 y=y(:,1)。 z=[zeros(3000,1)。y]。 y=[y。zeros(3000,1)]。 a=。 R=5000。%濾波器階數(shù)設(shè)置,其值越高,回聲越明顯 Bz1=[1,zeros(1,R1),a]。%單回聲濾波器系統(tǒng)函數(shù)分子 Az1=(1)。%單回聲濾波器系統(tǒng)函數(shù)分母 y2=filter(Bz1,Az1,y)。%單回聲濾波器系統(tǒng)函數(shù) Y2=fft(y2,6001)。 [h,w]=freqz(Bz1,Az1)。%求設(shè)計(jì)的濾波器頻譜 subplot(3,2,1)。plot(abs(h))。 title(39。單回聲濾波器幅頻響應(yīng) 39。)。 subplot(3,2,2)。 plot(angle(h))。 title(39。單回聲濾波器相頻響應(yīng) 39。)。 subplot(3,2,3:4)。plot(y2)。title(39。單回聲濾波器時(shí)域圖 39。)。 subplot(3,2,5)。