Open natankeddem opened 3 years ago
Thanks for the report!
The problem seems to be that this line never finishes:
... even though this line is called:
So it looks like eventlet.monkey_patch()
somehow messes with threading.Event
.
But this seems to only happen with the thread created by PortAudio, there's no problem when using "normal" Python threads.
Other than that, I don't know what exactly is going wrong nor how to fix it ...
Could you please create an issue at the eventlet
project, maybe they can help?
There is a similar-sounding issue: https://github.com/eventlet/eventlet/issues/395
There it is suggested to use eventlet.monkey_patch(thread=False)
which seems to make your example work!
I will put up something over at the Eventlet
issues page. I am not sure of the ramifications of using thread=False
; this code is being used in a larger code base which utilizes Flask
& Flask-SocketIO
which would likely not appreciate that change I imagine. As a short term workaround I have taken out the blocking and have put a hard sleep for the duration of the playrec
with a bit extra for good measure. This is obviously not ideal and I might try to make my own stream implementation of playrec
.
I might try to make my own stream implementation of
playrec
That's exactly what I would suggest as a work-around.
I'm not sure if if there is anything we can do on the sounddevice
side to fix the root of the problem, though.
Hello, I am getting a hang in the audio playback\recording (need to CTRL-C) with playrec() when I monkey_patch with eventlet. Running RPI4 on Raspberry Pi OS 5.10 utilizing I2S codec device. Code works fine without the monkey_patch.
Example:
Trace on CTRL-C: