% waterspect.m - compute fft of X
nhops = floor((Size-320)/320)-1; % 10 ms overlap at 16
kHz SR
W = hamming(512);
Z = zeros(nhops,256);
for n = 1:nhops
j = floor(160*n);
% hop size = 10ms
clear Pyy
Y = fft(W .* X(j:j+511),512);
Pyy = (Y .* conj(Y)/512)';
Z(n,:) = log(Pyy(1:256));
end
f = 22050 * (0:255)/512;
%plot(f,Z(1:1024))
Firsthop = 1;
Lasthop = nhops;
Lowfreq = 1;
Highfreq = 256;
mesh(Z(Firsthop:Lasthop,Lowfreq:Highfreq))
view(80,30)
cm = 1-gray;
colormap(cm)
xlabel('f (bins) (10 bins = 625 Hz)')
ylabel('time (10 ms increments)')