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

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

 Réponse acceptée

Daniel Shub
Daniel Shub le 8 Déc 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 commentaire

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!

Connectez-vous pour commenter.

Plus de réponses (1)

bym
bym le 8 Déc 2011

1 commentaire

Thank you very much for the response, but unfortunately it's not helping in our situation

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by