MATLAB: Radio button to play song

guiplaymp3.radiobutton

im trying to come up with the code for selecting a radio button and making it play a song... i have asked my instructor with no luck, my book says nothing... if someone can point me in a direction... that would be great. !

Best Answer

I have had success with the following.
In the opening function:
% Audio Players
[y,Fs,NBITS]=wavread('punch.wav');
handles.Punch = audioplayer(y,Fs,NBITS);
[y,Fs,NBITS]=wavread('electric buzz.wav');
handles.Buzz = audioplayer(y,Fs,NBITS);
[y,Fs,NBITS]=wavread('I_can_see.wav');
handles.See = audioplayer(y,Fs,NBITS);
and in the callback:
play(handles.Buzz); % or whichever sound is appropriate for the selected button/control
This preloads the audio and player object when the GUI is opened and then it can be controlled from the callbacks in the GUI without a delay.
Related Question