py-simple-audio icon indicating copy to clipboard operation
py-simple-audio copied to clipboard

play function is blocking for 200ms!

Open bsense-rius opened this issue 3 years ago • 2 comments

Dear all.

Although I know that this package is archived, I just wanted underline that each time I call the play function inside an async function (ubuntu 20.04) , having the file loaded in advance, the task is blocking the coroutine loop by 200ms. This might not be suitable for some time constrained applications. I tried to figure a workaround by checking the source code, but did not succeed.

I am considering moving the call to a different process, so that it is not blocking the async loop (a thread would be non sense as well for the GIL)

Regards

PS: It is a great library hiowever!!

bsense-rius avatar Jan 06 '22 15:01 bsense-rius

@bsense-rius I agree - looking at the ALSA version, I don't see anything obvious. My guess is that some part of the ALSA initialization is taking significant time for some reason but it would probably take printing the system time at various points in the process to determine the culprit.

hamiltron avatar Jan 06 '22 16:01 hamiltron

Ok Sir.

Thank you very much

bsense-rius avatar Jan 07 '22 14:01 bsense-rius