pyaudio_portaudio icon indicating copy to clipboard operation
pyaudio_portaudio copied to clipboard

pyaudio in multiprocess

Open artinegi1607 opened this issue 5 years ago • 2 comments

There is a Pyaudio stream that takes input from mic and text received is processed. I have created another function main that uses silence detection class in which again Pyaudio is created and closed. It was working fine. As per my requirement, I created process and call main() in process. and start the multiprocess environment. But this I got below error.

Expression 'ret' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1736 Expression 'AlsaOpen( &alsaApi->baseHostApiRep, params, streamDir, &self->pcm )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1904 Expression 'PaAlsaStreamComponent_Initialize( &self->capture, alsaApi, inParams, StreamDirection_In, NULL != callback )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2171 Expression 'PaAlsaStream_Initialize( stream, alsaHostApi, inputParameters, outputParameters, sampleRate, framesPerBuffer, callback, streamFlags, userData )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2840 [Errno -9993] Illegal combination of I/O devices

The code used was the same, the only change was now main() is not directly called this time as a function instead of a process. Any help would be appreciated.

artinegi1607 avatar Dec 06 '19 10:12 artinegi1607

Hello! I am getting the same error when trying to open a OutputStream with sounddevices. Did you figured out what was the problem?

maurorbl avatar Apr 26 '20 16:04 maurorbl

Hi @maurorbl , I was facing issue while sharing the pyaudio instance among multiprocess. In single-process, there is no issue.

artinegi1607 avatar May 12 '20 12:05 artinegi1607