issue with audioplayer/sound functions
Show older comments
Hi all,
I am running an automated test using Matlab. I have two functions, collectData and Analysis and a main script than calls these functions in that order. collectData plays a bunch of wav files using sound (also tried audioplayer) function (non-blocking function call) sequentially, make some measurements while the audio is being played to collect raw data. Analysis function analyses this data to generate results. The issue is that, sometimes Analysis function is called when collectData has not finished its execution completely and then Analysis function complains because it does not have complete data. I am guessing that sound/audioplayer has something to do with this but not sure exactly what. Could someone help me out here?
Thanks in advance, Alok
Accepted Answer
More Answers (1)
Daniel Shub
on 14 Aug 2011
If you use an audioplayer object p to play the sounds then you could add:
while p.isplaying
end
to the end of collectData or at the beginning of Analysis. If you want to add it to the beginning of Analysis you will need to pass the audioplayer object as an argument.
1 Comment
Alok Deshpande
on 14 Aug 2011
Categories
Find more on Use COM Objects in MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!