% EE 438 Digital Signal Processing with Applications - Spring 1997 % Application of elementary signal operations to speech signal %--------------------------------------------------------------- % Initialize clear all; close all; %Read and play back data sampled at 12.5kHz Fs = 8192; data=load('erf1s1t0')'; x = data; N = length(x) %--------------------------------------------------------------- %Create reverberation by adding shifted version of signal delay = 0.4 atten = 0.5 n0 = round(delay.*Fs) n_ext = 1:1:N+n0; x_delay(n0+1:N+n0) = x(n_ext(n0+1:N+n0)-n0); x_extend = x; x_extend(N+1:N+n0) = zeros(1,n0); y = x_extend + atten.*x_delay; t_extend = (n_ext-1)./Fs; subplot(2,1,1), plot(t_extend,x_extend); xlabel('t sec'); title('Original utterance'); subplot(2,1,2), plot(t_extend,y); xlabel('t sec'); title('Utterance with reverberation'); input('Original utterance') soundsc(x,Fs); %soundsc(resample(x,8192,Fs)); input('Utterance with reverberation') soundsc(y,Fs); %soundsc(resample(y,8192,Fs)); %--------------------------------------------------------------- % Reflection n = 1:1:N; minus_n = N+1 - n; z = x(minus_n); t = (n-1)./Fs; subplot(2,1,1), plot(t, x); xlabel('t sec'); title('Original utterance'); subplot(2,1,2), plot(t, z); xlabel('t sec'); title('Reflected utterance'); input('Original utterance') soundsc(x,Fs); %soundsc(resample(x,8192,Fs)); input('Reflected utterance') soundsc(z,Fs); %soundsc(resample(z,8192,Fs)); %--------------------------------------------------------------- % Downsampling by 2 z = zeros(1,N); z(1:ceil(N/2)) = x(1:2:N); z(ceil(N/2)+1:N) = zeros(1,N-ceil(N/2)); subplot(2,1,1), plot(t,x); xlabel('t sec'); title('Original utterance'); subplot(2,1,2), plot(t,z); xlabel('t sec'); title('Utterance downsampled by 2'); input('Original utterance') soundsc(x,Fs); %soundsc(resample(x,8192,Fs)); input('Utterance downsampled by 2') soundsc(z,Fs); %soundsc(resample(z,8192,Fs)); %--------------------------------------------------------------- % Upsampling by 2 z = zeros(1,2.*N); z(1:2:2.*N) = x(1:N); x_extend(N+1:2.*N) = zeros(1,N); n_extend = 1:1:2.*N; t_extend = n_extend./Fs; subplot(2,1,1), plot(t_extend,x_extend); xlabel('t sec'); title('Original utterance'); subplot(2,1,2), plot(t_extend,z); xlabel('t sec'); title('Utterance upsampled by 2'); input('Original utterance') soundsc(x,Fs); %soundsc(resample(x,8192,Fs)); input('Utterance upsampled by 2') soundsc(z,Fs); %soundsc(resample(z,8192,Fs));