Thread Subject: how to create waterfall plot

Subject: how to create waterfall plot

From: Clement Lim

Date: 29 Aug, 2009 14:32:03

Message: 1 of 7

Hi All,

I had the following script to read a .wav file and plot the spectrogram of the signal generated.

>> [filename, pathname] = uigetfile('*.*', 'Pick any file');
>> [y, fs, nbits] = wavread(filename);
>> spectrogram(y);

I would like to modify the code so that it can analyse and plot the music file both from .wav and from a music cd. Furthermore, I would also like to show a waterfall plot of the spectrogram. Can anyone help me or provide me with an example?

Thanks a million!

Subject: how to create waterfall plot

From: us

Date: 29 Aug, 2009 14:44:03

Message: 2 of 7

"Clement Lim" <clementlim@singnet.com.sg> wrote in message <h7be53$kjl$1@fred.mathworks.com>...
> Hi All,
>
> I had the following script to read a .wav file and plot the spectrogram of the signal generated.
>
> >> [filename, pathname] = uigetfile('*.*', 'Pick any file');
> >> [y, fs, nbits] = wavread(filename);
> >> spectrogram(y);
>
> I would like to modify the code so that it can analyse and plot the music file both from .wav and from a music cd. Furthermore, I would also like to show a waterfall plot of the spectrogram. Can anyone help me or provide me with an example?
>
> Thanks a million!

a hint:

     help waterfall;

us

Subject: how to create waterfall plot

From: us

Date: 29 Aug, 2009 15:08:03

Message: 3 of 7

"us "
> > I would like to modify the code so that it can analyse and plot the music file both from .wav and from a music cd. Furthermore, I would also like to show a waterfall plot of the spectrogram. Can anyone help me or provide me with an example?
> >
> > Thanks a million!
>
> a hint:
>
> help waterfall;

sorry, forgot the ...example... part...

     d=load('chirp');
     [ff,ff,tt,pxx]=spectrogram(d.y);
     subplot(2,1,1);
     spectrogram(d.y);
     subplot(2,1,2);
     arg={ff,tt,10*log10(abs([pxx.'])+eps)};
     waterfall(arg{:});
     colormap(jet(256));

us

Subject: how to create waterfall plot

From: Clement Lim

Date: 29 Aug, 2009 15:22:03

Message: 4 of 7

"us " <us@neurol.unizh.ch> wrote in message <h7bg8j$afj$1@fred.mathworks.com>...
> "us "
> > > I would like to modify the code so that it can analyse and plot the music file both from .wav and from a music cd. Furthermore, I would also like to show a waterfall plot of the spectrogram. Can anyone help me or provide me with an example?
> > >
> > > Thanks a million!
> >
> > a hint:
> >
> > help waterfall;
>
> sorry, forgot the ...example... part...
>
> d=load('chirp');
> [ff,ff,tt,pxx]=spectrogram(d.y);
> subplot(2,1,1);
> spectrogram(d.y);
> subplot(2,1,2);
> arg={ff,tt,10*log10(abs([pxx.'])+eps)};
> waterfall(arg{:});
> colormap(jet(256));
>
> us

Hi us,

Tks for the prompt reply. However the above code does not allow me to analyse in term of a music cd. That mean, I would like the script to prompt the user to input in the file to analyse. Currently, my original code is only able to analyse .wav files. However, it wont work for .wma file.
Furthermore, it is possible for the waterfall plot to animate as a function of time when the music is being play?

Pls advise tks.

Subject: how to create waterfall plot

From: us

Date: 29 Aug, 2009 15:50:18

Message: 5 of 7

"Clement Lim"
> Tks for the prompt reply. However the above code does not allow me to analyse in term of a music cd. That mean, I would like the script to prompt the user to input in the file to analyse. Currently, my original code is only able to analyse .wav files. However, it wont work for .wma file.
> Furthermore, it is possible for the waterfall plot to animate as a function of time when the music is being play?
>
> Pls advise tks.

as far as i know, reading WMA files into ML currently can only be achieved by the signal proc blockset (an extension of SL) module FROM-MULTIMEDIA-FILE...
thus, you could ...try(!)... to create a SL model to do what you want; although i doubt that the current hardware is physically able to generate a waterfall plot of a moving spectrogram in real-time...
however, others will know more (and better)...

us

Subject: how to show filename in GUI

From: BC Tan

Date: 30 Aug, 2009 10:02:01

Message: 6 of 7

Hi All,

I have the following code to read in the filename of the music file.

[filename, pathname] = uigetfile('*.*', 'Pick any file');
[y, fs, nbits] = wavread(filename);
handles.value = filename;

I had created a GUI and had placed a static text with tag being "tSource".
I would like to show the filename of the file that the users had chosen in the GUI with the following code.

set(handles.tSource,'String',sprintf('%s:%d',handles.value,handles.id));

However, the code is unable to show the filename as predicted. can anyone tell me what is wrong with my code?

Tks a million!

Subject: how to create waterfall plot

From: asdafa

Date: 28 Oct, 2009 03:44:02

Message: 7 of 7

"Clement Lim" <clementlim@singnet.com.sg> wrote in message <h7be53$kjl$1@fred.mathworks.com>...
> Hi All,
>
> I had the following script to read a .wav file and plot the spectrogram of the signal generated.
>
> >> [filename, pathname] = uigetfile('*.*', 'Pick any file');
> >> [y, fs, nbits] = wavread(filename);
> >> spectrogram(y);
>
> I would like to modify the code so that it can analyse and plot the music file both from .wav and from a music cd. Furthermore, I would also like to show a waterfall plot of the spectrogram. Can anyone help me or provide me with an example?
>
> Thanks a million!

Hi, sorry to use your post..I don't know how to crete one..really sorry
I have a problem with your code:
> >> [filename, pathname] = uigetfile('*.*', 'Pick any file');
> >> [y, fs, nbits] = wavread(filename);
> >> spectrogram(y);
I make it run but says:

??? Error using ==> spectrogram at 113
X must be a vector (either row or column).
Error in ==> spec at 3
spectrogram(y);

Can anyone help me with this please, im new in this.
thanks for your help!

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
waterfall us 29 Aug, 2009 11:09:26
code us 29 Aug, 2009 11:09:26
spectrogram us 29 Aug, 2009 11:09:26
reference us 29 Aug, 2009 10:49:06
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com