Beruflich Dokumente
Kultur Dokumente
LAB # 7
Object
To Process Audio signal using Matlab.
Task 2:Write a script to record your utterance and apply the following operation on signal
a) Multiply by -1
b) Reverse the signal
c) Multiply with 10
d) Replace the signal by its square root
e) Replace the signal by is square
Code
fs=8000;
y=wavrecord(5*fs,fs,2,'double');
a=y*-1;
b=flipud(y);
c=y*10;
d=vpa(sqrt(y),3);
e=y.^2;
Task 3:Write a Matlab script to record your voice with a sample rate of 32 KHz and 8 bits resolution.
Resample the audio at 16KHz, 8KHz, 4KHz, 2KHz, 1KHz and state difference
Code
fs=32000;
y=wavrecord(1*fs,fs,2,'uint8');
%%for Fs=16000
wavplay(y,16000)
%%for Fs=8000
wavplay(y,8000)
%%for Fs=4000
wavplay(y,4000)
%%for Fs=2000
wavplay(y,2000)
%%for Fs=1000
wavplay(y,1000)
Task 4:Write a Matlab code to read any file and generate its stem
Code
Fs=11025;
Fs2=8000;
[y Fs nbits]=wavread('Beep1.wav');
wavwrite(y,Fs,'B:\\Beep2.wav');
[y2 Fs2 nbits2]=wavread('B:\\Beep2.wav');
subplot(2,2,1);
stem(y);
subplot(2,2,2);
stem(y2);
wavplay(y2,fs2)
subplot(2,2,[3 4]);
stem(abs(y-y2));
Task 5:Record and play back 5 second of 16 bits audio sampled at 11025 Hz.
Code
fs=11025;
y=wavrecord(5*fs,fs,2,'double');
wavplay(y,fs);
Task 6:Write a script file to read any audio file and display the following information.
a) No. of sample points
b) Sampling rate
c) Bit resolution
d) Time duration
Code
[y fs nbits]=wavread('chimes.wav')
[m d]=wavfinfo('chimes.wav')
t=54080/44100
Result
fs = 44100
nbits = 16
d = Sound (WAV) file containing: 54080 samples in 2 channel(s)
t = 1.2263
Conclusion: In this lab we perform audio processing and perform different frequencies
task using matlab