0

I want a 3d spectrogram This is what I have done so far.

urlwrite('http://goo.gl/D1uAn','sample.wav');
%reads from web and saves the wav file in local folder with name sample.wav
%this might not save the file if so please download the file from the link

[W,fs]=wavread('sample');
%[W,fs]=wavread(FileName);

[~,~,T,P]=spectrogram(W(:,end),200,200/2,256,fs);
%[~,~,T,P]=spectrogram(W(:,end),tres,tres/2,fres,fs);
I=flipud(-log(P));
% I is the image of spectrogram in 2D matrix now

% I want to plot this spectrogram in 3d
h = surf(I.*-1);
set(h, 'edgecolor','none');

%this does the job however it is very blocky I want to smooth this
royhowie
  • 11,075
  • 14
  • 50
  • 67
Sunil Shahi
  • 641
  • 2
  • 13
  • 31

1 Answers1

1

If you increase your overlap, it will be smoother:

[~,~,T,P]=spectrogram(W(:,end),200,199,256,fs);

But will also take longer to calculate. That's the trade-off.

Hugh Nolan
  • 2,508
  • 13
  • 15
  • I tried doing that its slow and still blocky..I just want a general shape. so i was thinking to decrease the resolution and interpolate but i cannot find a way to do that.. – Sunil Shahi Jul 11 '13 at 16:26
  • Well you could use a smoothing filter like a gaussian using `imfilter` and `fspecial`? Or interpolate using `interp2`? Did you look in the help files for interpolation, because there is loads of info there. – Hugh Nolan Jul 11 '13 at 16:33