You are on page 1of 2

Home task 1

% use of wavrecord function

close all
clear all
%sampling for 2 seconds
Fs = 11025;
y = wavrecord(2*Fs, Fs, 2, 'int16');
wavplay(y, Fs)

%changing samplg frequency of wavrecord


%to 8K
Fs = 8000;
y = wavrecord(2*Fs, Fs, 2, 'int16'); %2 is for stereo
wavplay(y, Fs)
%to 16K
Fs = 16000;
y = wavrecord(2*Fs, Fs, 2, 'int16');
wavplay(y, Fs)
%to 32K
Fs = 32K;
y = wavrecord(2*Fs, Fs, 2, 'int16'); %2 is for stereo
wavplay(y, Fs)

%changing samplg frequency of wavplay


%to 8K
Fs = 11025;
y = wavrecord(2*Fs, Fs, 2, 'int16');
wavplay(y, 8000)
%to 16K
Fs = 11025;
y = wavrecord(2*Fs, Fs, 2, 'int16');
wavplay(y, 16000)
%to 32K
Fs = 11025;
y = wavrecord(2*Fs, Fs, 2, 'int16');
wavplay(y, 32000)
Home Task 2

close all
clear all

Fs = 16000; %sampling frequency


voice = wavrecord(5*Fs,Fs,1);
y=abs(fft(voice));
plot (1:Fs/2,y(1:Fs/2));
hold on
plot(1:3.4*1000,y(1:3.4*1000),'r--')
ratio=sum(y(1:3.4*1000))/sum(y(1:Fs/2))

The figure below shows that the red and blue overlap in only 0-3.4KHZ range and the ratio is
53.8%.So the human voice consists of only the frequency components between 3-4 KHz.

You might also like