% m-file to take FFT of students' "open" and "give me' % voce_fft.m % 2/5/97, G. Dempsey % Bradley University, Electrical & Computer Engineering % get time domain info for 6 students y1=wavread('h:\ee410\hw8\olee.wav'); % open for Lee y2=wavread('h:\ee410\hw8\glee.wav'); % give me for Lee y3=wavread('h:\ee410\hw8\ojoel.wav'); y4=wavread('h:\ee410\hw8\gjoel.wav'); y5=wavread('h:\ee410\hw8\ojeff.wav'); y6=wavread('h:\ee410\hw8\gjeff.wav'); y7=wavread('h:\ee410\hw8\ocurtis.wav'); y8=wavread('h:\ee410\hw8\gcurtis.wav'); y9=wavread('h:\ee410\hw8\okurt.wav'); y10=wavread('h:\ee410\hw8\gkurt.wav'); y11=wavread('h:\ee410\hw8\obecky.wav'); y12=wavread('h:\ee410\hw8\gbecky.wav'); % South-East U.S. Test Voices y13=wavread('h:\ee410\hw8\ogary.wav'); y14=wavread('h:\ee410\hw8\ggary.wav'); y15=wavread('h:\ee410\hw8\odana.wav'); y16=wavread('h:\ee410\hw8\gdana.wav'); % eliminate DC content m1=mean(y1); m2=mean(y2); m3=mean(y3); m4=mean(y4); m5=mean(y5); m6=mean(y6); m7=mean(y7); m8=mean(y8); m9=mean(y9); m10=mean(y10); m11=mean(y11); m12=mean(y12); m13=mean(y13); m14=mean(y14); m15=mean(y15); m16=mean(y16); y1=y1-m1; y2=y2-m2; y3=y3-m3; y4=y4-m4; y5=y5-m5; y6=y6-m6; y7=y7-m7; y8=y8-m8; y9=y9-m9; y10=y10-m10; y11=y11-m11; y12=y12-m12; y13=y13-m13; y14=y14-m14; y15=y15-m15; y16=y16-m16; % normalize data y1=y1/max(abs(y1)); y2=y2/max(abs(y2)); y3=y3/max(abs(y3)); y4=y4/max(abs(y4)); y5=y5/max(abs(y5)); y6=y6/max(abs(y6)); y7=y7/max(abs(y7)); y8=y8/max(abs(y8)); y9=y9/max(abs(y9)); y10=y10/max(abs(y10)); y11=y11/max(abs(y11)); y12=y12/max(abs(y12)); y13=y13/max(abs(y13)); y14=y14/max(abs(y14)); y15=y15/max(abs(y15)); y16=y16/max(abs(y16)); disp('press key to continue- plot time domain') pause % plot voice in time domain for Lee and Becky subplot(221),plot(y1) ylabel('Amplitude') title('Time Domain- "Open" from Lee') subplot(222),plot(y2) ylabel('Amplitude') title('Time Domain- "Give Me from Lee"') subplot(223),plot(y11) ylabel('Amplitude') xlabel('Data Length in bytes') title('Time Domain- "Open" from Becky') subplot(224),plot(y12) xlabel('Data Length in bytes') ylabel('Amplitude') title('Time Domain- "Give Me" from Becky') disp('Compute FFT') pause % setup code for frequency response of input signals (fft) Npts=256; % 256 pt FFT to distinquish freuencies % freq div= 8KHz/256= 31.25 Hz x1=fft(y1,Npts); % take FFT x1=abs(x1); % take absolute value % normalize data x1=x1/max(x1); % do other voices x2=fft(y2,Npts); x2=abs(x2); x2=x2/max(x2); x3=fft(y3,Npts); x3=abs(x3); x3=x3/max(x3); x4=fft(y4,Npts); x4=abs(x4); x4=x4/max(x4); x5=fft(y5,Npts); x5=abs(x5); x5=x5/max(x5); x6=fft(y6,Npts); x6=abs(x6); x6=x6/max(x6); x7=fft(y7,Npts); x7=abs(x7); x7=x7/max(x7); x8=fft(y8,Npts); x8=abs(x8); x8=x8/max(x8); x9=fft(y9,Npts); x9=abs(x9); x9=x9/max(x9); x10=fft(y10,Npts); x10=abs(x10); x10=x10/max(x10); x11=fft(y11,Npts); x11=abs(x11); x11=x11/max(x11); x12=fft(y12,Npts); x12=abs(x12); x12=x12/max(x12); x13=fft(y13,Npts); x13=abs(x13); x13=x13/max(x13); x14=fft(y14,Npts); x14=abs(x14); x14=x14/max(x14); x15=fft(y15,Npts); x15=abs(x15); x15=x15/max(x15); x16=fft(y16,Npts); x16=abs(x16); x16=x16/max(x16); % plot Lee's and Becky's Voice in Freq Domain % scale freq domain data back to analog freq % only show 1st Npts/4 points (DC to 2000Hz) % show above with x-axis in Hz af_step=8000/Npts; spersec=0:af_step:(1/Npts)*8000*((Npts/4)-1); subplot(221),stem(spersec,x1(1:Npts/4)) grid title('"Open" Frequency Spectrum (Lee)') subplot(222),stem(spersec,x2(1:Npts/4)) grid title('"Give Me" Frequency Spectrum (Lee)') subplot(223),stem(spersec,x11(1:Npts/4)) grid title('"Open" Frequency Spectrum (Becky)') subplot(224),stem(spersec,x12(1:Npts/4)) grid title('"Give Me" Frequency Spectrum (Becky)') disp('Display next two students') pause subplot(221),stem(spersec,x3(1:Npts/4)) grid title('"Open" Frequency Spectrum (Joel)') subplot(222),stem(spersec,x4(1:Npts/4)) grid title('"Give Me" Frequency Spectrum (Joel)') subplot(223),stem(spersec,x5(1:Npts/4)) grid title('"Open" Frequency Spectrum (Jeff)') subplot(224),stem(spersec,x6(1:Npts/4)) grid title('"Give Me" Frequency Spectrum (Jeff)') disp('Display next two students') pause subplot(221),stem(spersec,x7(1:Npts/4)) grid title('"Open" Frequency Spectrum (Curtis)') subplot(222),stem(spersec,x8(1:Npts/4)) grid title('"Give Me" Frequency Spectrum (Curtis)') subplot(223),stem(spersec,x9(1:Npts/4)) grid title('"Open" Frequency Spectrum (Kurt)') subplot(224),stem(spersec,x10(1:Npts/4)) grid title('"Give Me" Frequency Spectrum (Kurt)') disp('Display next two students') pause subplot(221),stem(spersec,x13(1:Npts/4)) grid title('"Open" Frequency Spectrum (Gary)') subplot(222),stem(spersec,x14(1:Npts/4)) grid title('"Give Me" Frequency Spectrum (Gary)') subplot(223),stem(spersec,x15(1:Npts/4)) grid title('"Open" Frequency Spectrum (Dana)') subplot(224),stem(spersec,x16(1:Npts/4)) grid title('"Give Me" Frequency Spectrum (Dana)') % save data for ANN training x1=x1(1:48); % 0 to 1500 Hz only (48 inputs) x2=x2(1:48); x3=x3(1:48); x4=x4(1:48); x5=x5(1:48); x6=x6(1:48); x7=x7(1:48); x8=x8(1:48); x9=x9(1:48); x10=x10(1:48); x11=x11(1:48); x12=x12(1:48); % x13 thru x16 will be used for x13=x13(1:48); % test data x14=x14(1:48); x15=x15(1:48); x16=x16(1:48);