sounddevice.PortAudioError: Error opening InputStream: Device unavailable [PaErrorCode -9985]

See original GitHub issue

When trying to record, I use the line

myrecording = sd.rec(duration * fs, samplerate=fs, channels=2,dtype='float64')

This leads to

> Traceback (most recent call last):
  File "sd_test.py", line 7, in <module>
    myrecording = sd.rec(duration * fs, samplerate=fs, channels=2,dtype='float64')
  File "C:\Users\gwerner004\AppData\Local\Programs\Python\Python36\lib\site-packages\sounddevice.py", line 224, in rec
    ctx.input_dtype, callback, blocking, **kwargs)
  File "C:\Users\gwerner004\AppData\Local\Programs\Python\Python36\lib\site-packages\sounddevice.py", line 2417, in start_stream
    **kwargs)
  File "C:\Users\gwerner004\AppData\Local\Programs\Python\Python36\lib\site-packages\sounddevice.py", line 1301, in __init__
    **_remove_self(locals()))
  File "C:\Users\gwerner004\AppData\Local\Programs\Python\Python36\lib\site-packages\sounddevice.py", line 780, in __init__
    'Error opening {0}'.format(self.__class__.__name__))
  File "C:\Users\gwerner004\AppData\Local\Programs\Python\Python36\lib\site-packages\sounddevice.py", line 2572, in _check
    raise PortAudioError(errormsg, err)
sounddevice.PortAudioError: Error opening InputStream: Device unavailable [PaErrorCode -9985]

When I do python -m sounddevice I get this line:

>  1 Microphone (Plantronics C320), MME (2 in, 0 out)

Why would this device not be available for recording?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
warrenareacommented, Oct 12, 2022

sounddevice.PortAudioError: Error opening RawStream: Unanticipated host error [PaErrorCode -9999]: ‘Undefined external error.’ [MME error 1]

I resolved this by enabling "Let apps access your microphone" in Windows 10/11. a setting in Privacy & Security > Microphone

0reactions
joachimpoutaraudcommented, Nov 20, 2022

Uninstalling sounddevice from pip and reinstalling using conda worked for me

pip uninstall sounddevice
conda install -c conda-forge python-sounddevice
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error opening OutputStream: Invalid number of channels ...
sounddevice.play is interpreting this as a single sample with 4999 channels! Try transposing the array, so play sees the array as 4999 samples ......
Read more >
python-sounddevice, version 0.3.7 - Read the Docs
Pa_GetDeviceInfo(device) if not info: raise PortAudioError('Error querying ... prime_output_buffers_using_stream_callback=None): """Open an input stream.
Read more >
spatialaudio - Bountysource
PortAudioError : Error opening InputStream: Internal PortAudio error ... PortAudioError: Error opening InputStream: Device unavailable [PaErrorCode -9985].
Read more >
Pyaudio Does Not Work And Breaks Sound On Ubuntu
... pygame PortAudioError: Error opening InputStream: Device unavailable [PaErrorCode 9985] 0 fix the problem and tried uninstalling/installing sounddevice ...
Read more >
Trouble using pyaudio and sounddevice on raspberry pi
Hello, I am having some touble using pyaudio and sounddevice to ... Error opening OutputStream: Invalid sample rate [PaErrorCode -9997].
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found