radio button to play song
1 view (last 30 days)
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. !
Benjamin Avants on 14 Mar 2014
I have had success with the following.
In the opening function:
% Audio Players
handles.Punch = audioplayer(y,Fs,NBITS);
handles.Buzz = audioplayer(y,Fs,NBITS);
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.