pyaudio_portaudio
pyaudio_portaudio copied to clipboard
pyaudio in multiprocess
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.
Hello! I am getting the same error when trying to open a OutputStream with sounddevices. Did you figured out what was the problem?
Hi @maurorbl , I was facing issue while sharing the pyaudio instance among multiprocess. In single-process, there is no issue.