Force quitting sound(y)

Hello,
How can I force quit the sound function if I accidentally played a 44100 hz file with the default hz?
Control - C doesn't seem to work and the only way is through the ctrl-alt-del
Thanks in advance

 Accepted Answer

Walter Roberson
Walter Roberson on 18 Jan 2012

2 votes

Yes, ctrl-alt-del if you are in MS Windows. control-c is not active until the hard-coded routine returns.
Might I suggest that the lesson here is not to use sound()? You can use http://www.mathworks.com/help/techdoc/ref/audioplayer.html

4 Comments

Jan
Jan on 18 Jan 2012
+1 for the audioplayer.
If you do not need the extra control, I think sound might be "better" than audioplayer. For example, in Linux, sound is implemented with audioplayer, but with Windows sound is implemented using a mex file called playsnd. This makes me think that TMW know something about the internal workings of audioplayer/playsnd.
audioplayer has a "stop" method. sound() does not. If being able to cancel the playing is important, then sound() is out of the running.
For the current question I agree that the flexibility of audioplayer is beneficial. My reaction was to the "the lesson here is not to use sound()" which I read as suggesting audioplayer was always as good as or better than sound.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!