Sound output/aquisition stops without an error (handles problem?)
5 views (last 30 days)
Show older comments
Hi everyone,
I'm working on an project which has over 4000 measurement points. On every point, 151 different "beeps" need to be played (and simultaneously recorded) in a row. Every beep is 0.1sec long.
so my attempt was to put this in a loop with 151 different y's:
ap = audioplayer(y,Fs);
ar = audiorecorder(Fs, 16, 1);
play(ap)
recordblocking(ar, duration_of_y+0.1);
x = getaudiodata(ar);
It works good for the first few hundred measurement points. However, at some point the programme stops without an error and since the "reordblocking command is used, it also freezes.
As I was looking at the Windows Task Manager it appears that on the "Performance" Tab, the "Handles" are rising constantly during the measurment and will not drop until Matlab is closed again. I'm Conseuqently, the value is pretty high after the programm stops. I'm wondering if that might be a reason?
Anyone has an Idea what I did wrong or has a better idea how to play and simutaniously record a sound?
Cheers and Thanks in advanced, Steffen
0 Comments
Accepted Answer
Daniel Shub
on 8 Dec 2011
There is a pretty long and variable behind the scenes management of sound hardware in MATLAB. It can take a few hunderd millisconds to reset the hardware. Ideally you would make concatanate your sounds and only call audio player once per measurement (or even once overall). You also should look into some of the MATALB port audio implementations, they are much more reliable than sound/audioplayer.
More Answers (1)
See Also
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!