-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Internal PortAudio error [PaErrorCode -9986] #454
Comments
The code you provided and the code you ran that gave the error are a little different. import sounddevice as sd
sample_rate = 44100
duration = 2
# recording = sd.rec(int(seconds * sample_rate), samplerate=sample_rate, channels=1)
rec = sd.rec(int(sample_rate*duration), samplerate = sample_rate, channels = 1)
sd.wait() Running this code doesn't give me any errors. Perhaps you could try to run one of the recording examples. If you get the same error there as well, then it has to be something about your set up (maybe not all dependencies are installed or something with your audio device is wrong). Also, did you try it with any other channels (i.e. channels=2)? |
Thank you very much for your feedback. Sorry for the typo in the code, I have copied a source code and error message from two different attempts. However the snippet from your comment still throws the same error. I originally wanted to run it with two channels but it came with another error, I have tried the recording examples from the link you list, and the same error comes up. I have been installing and reinstalling PortAudio and various python audio libraries and their dependencies and I think that it is not my setup that is at fault. I ran an analogous code in pyaudio and I got the exact same error. I started to think that this might be an error on PortAudio side and subsequently raised an issue on their site (PortAudio/portaudio, #771) but so far I have had no answer. Meanwhile, I was finally able to record sounds using the This is however not ideal for me and I would still prefer to use sounddevice library. I would be grateful for any ideas for possible solutions of this hiccup. |
How exactly are you running your Python code? It might be an issue about microphone permissions. |
Updating: I am seeing the same problem on an intel mac (13" 2017 running macos ventura 13.4.1). The problem is with portaudio not sounddevice. Installing portaudio 19.7 from homebrew instead of 19.6 from anaconda (requires installing sounddevice with --no-deps) solves the problem (better solution would be to upgrade portaudio on anaconda to 19.7 but I do not see how to report that issue). alternately, install everything from pip instead of anaconda. Shows up as a bug on audacity as well |
I have created the following script:
When running this script, I get the following error message:
The list of devices is as follows:
Could you please advise me on how to solve this problem?
The text was updated successfully, but these errors were encountered: