0% found this document useful (0 votes)
54 views4 pages

DSP Lab Report 8

This code records 5 seconds of audio using a microphone at a sampling rate of 32000 Hz and 16-bit samples. It then plays back and saves the recording as a WAV file. The code then reads in the WAV file, plots the time domain signal, performs a discrete time Fourier transform, and applies decimation by a factor of 2 twice to downsample the signal, plotting the results each time.

Uploaded by

Faria Raghib
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views4 pages

DSP Lab Report 8

This code records 5 seconds of audio using a microphone at a sampling rate of 32000 Hz and 16-bit samples. It then plays back and saves the recording as a WAV file. The code then reads in the WAV file, plots the time domain signal, performs a discrete time Fourier transform, and applies decimation by a factor of 2 twice to downsample the signal, plotting the results each time.

Uploaded by

Faria Raghib
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

code:

Fs=32000;
recObj=audiorecorder(Fs,16,1);
get(recObj)

%record your voice for 5 seconds


disp('Start speaking.')
recordblocking(recObj,5);
disp('End of Recording');

%playback the recording


play(recObj);

%Store data in double-precision array


myRecording=getaudiodata(recObj);

filename='anam audio.wav';
audiowrite(filename,myRecording,Fs);

[y,Fs] = audioread('anam audio.wav');


plot(y)
dtft(y')
out=decimate(y,2);
figure
dtft(out')
out1=decimate(out,2);
figure
dtft(out1')

You might also like