How can I interrupt the playback of an audio file that has been initiated using WAVPLAY in MATLAB 7.9 (R2009b)?
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 11 Nov. 2009
Kommentiert: Joe V
am 27 Jun. 2019
I have created a GUI application which starts the playback of an audio file using WAVPLAY. I would like to insert a new button in the GUI that allows the user to pause or stop the audio playback.
Akzeptierte Antwort
MathWorks Support Team
am 11 Nov. 2009
There is no function in MATLAB that can pause or stop audio playback once initiated by WAVPLAY. Instead of using WAVPLAY, an alternative is to create an AUDIOPLAYER object. This type of object has methods which allow pausing, resuming and stopping the audio playback. For example:
player = audioplayer(Y, Fs)
% start the playback
play(player);
% pause the playback
pause(player);
% resume the playback
resume(player)
% stop the playback
stop(player)
For further details refer to the AUDIOPLAYER documentation.
doc audioplayer
1 Kommentar
Joe V
am 27 Jun. 2019
See Li Kang's answer below -- the "clear sound" command works, at least for some cases.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Audio and Video Data finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!