question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error Getting Mac OS X Sound Output

See original GitHub issue

I made the following program in an attempt to try and retrieve all the audio that is being played on my Mac and replay it but everytime I run the code in main.txt, I run across the following output,

Default Devices:

> 0 Built-in Microphone, Core Audio (2 in, 0 out)
< 1 Built-in Output, Core Audio (0 in, 2 out)
Traceback (most recent call last):
  File "main.py", line 15, in <module>
    with sd.Stream(channels=2,dtype="float32",callback=callback):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sounddevice.py", line 1654, in __init__
    **_remove_self(locals()))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sounddevice.py", line 772, in __init__
    'Error opening {0}'.format(self.__class__.__name__))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sounddevice.py", line 2563, in _check
    raise PortAudioError(errormsg, err)
sounddevice.PortAudioError: Error opening Stream: Invalid number of channels [PaErrorCode -9998]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
mgeiercommented, May 2, 2020

@khlorghaal Do you mean the message Invalid number of channels?

This message comes directly from the PortAudio library, so we cannot change it.

But we could probably do some additional checks before trying to create the stream. E.g. we could try to call check_input_settings() and check_output_settings(). This way, the error message might contain information whether it’s about “input” or “output” channels. Do you think this would help?

0reactions
mgeiercommented, May 4, 2020

@khlorghaal I’ve created #242 to address your suggestion, but I’m not sure if it’s a good idea. Please express your opinions over there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

If you can't hear sound from your Mac speakers - Apple Support
Make sure the speakers are plugged into the audio output port on your Mac or display, and if necessary, into a power supply....
Read more >
How to Fix Common Sound Issues on a Mac - MacKeeper
Go to Apple Menu → System Preferences → Sound → Output; You should see Internal Speakers as a device for sound output. If...
Read more >
Audio & Sound Not Working in Mac OS X? It's an Easy Fix
First things first: make sure the Mac audio output is enabled and that the computer is not set to be mute. You can...
Read more >
What To Do If Your Mac Sound Is Not Working | Macworld
Check System Preferences: Open System Preferences and click Sound. Click the Output tab and click on Internal Speakers. Check that Mute next to ......
Read more >
Mac Sound Not Working? 7 Easy Fixes for Audio Problems on ...
At times, switching from one output to another can fix the problem. Also, try unplugging and reconnecting your audio devices. Remember to ...
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