DSPRelated.com
Forums

Linking audio file from MATLAB plot

Started by Arijit Biswas March 23, 2010
Hi Matlab Experts:

I'm not an expert and thus I have a question ;-)

Let's assume I plot the numbers 1 to 10 on a MATLAB figure.
And (for my use), for each number an audio wav file is associated.

My question:
I wish to click any one of these numbers on the plot, and I want the
corresponding audio file to play back. Is it possible? How?

I will be grateful if you are able to kindly answer my queries.

Best Regards,
~Arijit

'
Hi Arijit,

This is definitely possible in MATLAB. I would create a ButtonDownFunction to be executed when a point on the graph is clicked. If the click co-ordinates are in the vicinity of the co-ordinates of a point associated with a wav file (don't know how you are plotting, but easy to knock up a few conditional statements for this; maybe a switch statement with a case for each wav file and a couple of if statements in each to test if a click is close enough to the co-ordinates for a particular wav file) then use the sound function to play the wav file.

Look up ButtonDownFcn and sound in the MATLAB help.

Best regards

Ger

Hi Matlab Experts:
>
>I'm not an expert and thus I have a question ;-)
>
>Let's assume I plot the numbers 1 to 10 on a MATLAB figure.
>And (for my use), for each number an audio wav file is associated.
>
>My question:
>I wish to click any one of these numbers on the plot, and I want the
>corresponding audio file to play back. Is it possible? How?
>
>I will be grateful if you are able to kindly answer my queries.
>
>Best Regards,
>~Arijit
>
>'