8. 8
In case Fs = 8000Hz
In the right window, there are two spectral line at -3kHz and 3kHz
which does not match the spectrum of 5kHz sinusoidal signal
10. 10
II. Create sound effects
Matlab program
The program read
a .wav file which
was build from
stereo audio signal
sampling at
44.1kHz. With the
data, we generate
several sound
effect.
11. 11
MATLAB functions
[x,fs] = wavread(‘road.wav’) : read file name road.wav
and store the value to array x.
sound(x,fs) : play the wav file converted to x in the previous
description.
soundsc(x,Fs) : scale the sound of the wav file. Scaling a
signal means changing its frequency or amplitude.
13. 13
Effects
Changing the Speed
[hootie,fs]=wavread('hootie.wav'); %loads Hootie
Soundsc(hootie,fs/1.5) % How slow can you go?
soundsc(hootie,fs*1.5) % The Chimpmonks!
Changing Volume
soundsc(m*hootie,fs)
Reverse
y=[1;2;3;4;5];
y2=flipud(y); %reverse the array y
14. 14
Digital Delay Experiment
out = x; % set up a new array, same size as old
one
N=10000; % delay amount N/44100 seconds
for n=N+1:length(left)
out(n)=x(n)+x(n-N); % approximately ¼ second
echo
end
soundsc(out,fs) % new echo
Digital Tone Control ( Low Pass Filter)
[hootie,fs]=wavread('hootie.wav'); % loads Hootie
out=hootie;
for n=2:length(hootie)
out(n,:) = 0.9*out(n-1,:)+hootie(n,:);
end
soundsc(out,fs); % low pass filtered