spatialaudio / python-sounddevice

:sound: Play and Record Sound with Python :snake:
https://python-sounddevice.readthedocs.io/
MIT License
1.01k stars 149 forks source link

Error opening InputStream: Unanticipated host error [PaErrorCode -9999]: 'unknown error' [JACK Audio Connection Kit error -1] #417

Open Martmists-GH opened 2 years ago

Martmists-GH commented 2 years ago

Code:

def open_stream(index: int, stereo: bool, is_input: bool) -> Union[InputStream, OutputStream]:
    if is_input:
        return InputStream(device=index,
                           channels=1 + stereo,
                           latency=LATENCY,
                           samplerate=48000,
                           blocksize=1024,
                           dtype='float32')
    else:
        return OutputStream(device=index,
                            channels=1 + stereo,
                            latency=LATENCY,
                            samplerate=48000,
                            blocksize=1024,
                            dtype='float32')
Expression 'jack_ports = jack_get_ports( jackHostApi->jack_client, regex_pattern, JACK_PORT_TYPE_FILTER, JackPortIsOutput )' failed in 'src/hostapi/jack/pa_jack.c', line: 1294
Traceback (most recent call last):
  File "/home/mart/.pyenv/versions/3.10.5/lib/python3.10/site-packages/kaudio/app/nodes/base_nodes.py", line 121, in set_func
    getattr(self, f"set_{name}")(options[idx])
  File "/home/mart/.pyenv/versions/3.10.5/lib/python3.10/site-packages/kaudio/app/nodes/io_nodes.py", line 40, in set_device
    stream = open_stream(
  File "/home/mart/.pyenv/versions/3.10.5/lib/python3.10/site-packages/kaudio/app/utils/sounddevice_handler.py", line 41, in open_stream
    return InputStream(device=index,
  File "/home/mart/.pyenv/versions/3.10.5/lib/python3.10/site-packages/sounddevice.py", line 1415, in __init__
    _StreamBase.__init__(self, kind='input', wrap_callback='array',
  File "/home/mart/.pyenv/versions/3.10.5/lib/python3.10/site-packages/sounddevice.py", line 892, in __init__
    _check(_lib.Pa_OpenStream(self._ptr, iparameters, oparameters,
  File "/home/mart/.pyenv/versions/3.10.5/lib/python3.10/site-packages/sounddevice.py", line 2739, in _check
    raise PortAudioError(errormsg, err, hosterror_info)
sounddevice.PortAudioError: Error opening InputStream: Unanticipated host error [PaErrorCode -9999]: 'unknown error' [JACK Audio Connection Kit error -1]
mgeier commented 2 years ago

Sorry, this error doesn't sound familiar.

The first line of the error message comes directly from the JACK library, maybe you can ask there (https://jackaudio.org/community.html)?