|
Hi,
I wanted to use the movie function to create an animation effect in the waterfall plot and spectrogram from a music wav file. I wish to create a visual effect such that the waterfall plot and spectrogram will "move" while the music is being play. However, the below code done by me is simply unable to do so. When the program is run, it first show 2 plots, with the below plot showing some meaningless data. The next 2 plots show stationary spectrogram and waterfall plot.
Hope you can assist. Tks alot
[filename, pathname] = uigetfile('*.*', 'Pick any file');
[y, fs, nbits] = wavread(filename);
disp('Playing at the original sample rate.');
sound(y, fs);
disp(fs);
subplot(311)
spectrogram(y);
Y = fft(y);
[S,S,T,P]=spectrogram(y(:,1));
subplot(2,1,1);
spectrogram(y(:,1));
title('Spectrogram');
subplot(2,1,2);
for k = 1:16
plot(Y)
axis equal
M(k) = getframe;
end
arg={S,T,10*log10(abs([P.'])+eps)};
waterfall(arg{:});
colormap(jet(256));
title('Waterfall Plot');
|