python-sounddevice icon indicating copy to clipboard operation
python-sounddevice copied to clipboard

sounddevice.PortAudioError: Error opening InputStream: Internal PortAudio error [PaErrorCode -9986]

Open nishakaushik3108 opened this issue 4 years ago • 3 comments

_my code is :_

import sounddevice as sd from scipy.io.wavfile import write

fs=44100 seconds=5

myrecording=sd.rec(int(seconds*fs), samplerate=fs,channels=1) sd.wait() write('output.wav',fs,myrecording)

and i am getting this error File "/Users/i543481/internship-project/lastTry.py", line 7, in myrecording=sd.rec(int(seconds*fs), samplerate=fs,channels=1) File "/usr/local/lib/python3.9/site-packages/sounddevice.py", line 274, in rec ctx.start_stream(InputStream, samplerate, ctx.input_channels, File "/usr/local/lib/python3.9/site-packages/sounddevice.py", line 2573, in start_stream self.stream = StreamClass(samplerate=samplerate, File "/usr/local/lib/python3.9/site-packages/sounddevice.py", line 1415, in init _StreamBase.init(self, kind='input', wrap_callback='array', File "/usr/local/lib/python3.9/site-packages/sounddevice.py", line 892, in init _check(_lib.Pa_OpenStream(self._ptr, iparameters, oparameters, File "/usr/local/lib/python3.9/site-packages/sounddevice.py", line 2738, in _check raise PortAudioError(errormsg, err) sounddevice.PortAudioError: Error opening InputStream: Internal PortAudio error [PaErrorCode -9986]

i am using Macbook pro MacOs Bigsur version 11.0.1 speech_recognition was also not working and the error was internal portaudio error -9986 now i used sound device even this is throwing error. could someone help me fix this?

nishakaushik3108 avatar Mar 10 '21 04:03 nishakaushik3108

Same fix as #299

Uninstall portaudio and reinstall it using brew install portaudio --HEAD

8lank avatar Mar 11 '21 13:03 8lank

brew install portaudio --HEAD did not work on bigsur 11.2.3 now...

jqjiang819 avatar Mar 24 '21 04:03 jqjiang819

It's working on my side with macOS 11.2.3, have you properly uninstalled it?

8lank avatar Mar 24 '21 08:03 8lank