Sound output/aquisition stops without an error (handles problem?)

5 views (last 30 days)
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

Accepted Answer

Daniel Shub
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.
  1 Comment
Steffen
Steffen on 12 Dec 2011
Sorry for the late response. The test was running oder the weekend and I wanted to give an answer based on the result.
Calling the audioplayer only once overall doesn't help, I tried that before and the handles still keep growing and the programm stops after a while.
However, the port audio implementations where the right hint! I used pawaveplay/record and it worked smoothly.
Thank you very much for your help!

Sign in to comment.

More Answers (1)

bym
bym on 8 Dec 2011
  1 Comment
Steffen
Steffen on 8 Dec 2011
Thank you very much for the response, but unfortunately it's not helping in our situation

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!