Mantain Matlab Busy while generating sound

1 view (last 30 days)
Hello, I have been using the command "play" to generate a sound (1KHz sine wave), I want to generate the sine wave for about 3 seconds and then, after the signal ended ringing do another operation, I sounds simple, but the problem is that when the comamnd "play" is executed the sine wave rings, but the operation that was suposed to be executed after the end of the ringing, is executed while the sound is ringing.

Accepted Answer

Walter Roberson
Walter Roberson on 23 Jan 2017
Edited: Walter Roberson on 23 Jan 2017
You can use playblocking() instead of play().
You might also want to consider setting up the second operation as the StopFcn property of the audioplayer object, in which case you could still use play()

More Answers (0)

Community Treasure Hunt

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

Start Hunting!