Skip to content
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

Error opening audio device 5 #72

Open
fsevenm opened this issue Sep 13, 2018 · 10 comments
Open

Error opening audio device 5 #72

fsevenm opened this issue Sep 13, 2018 · 10 comments

Comments

@fsevenm
Copy link

fsevenm commented Sep 13, 2018

Below is the complete error

Error opening audio device 5 Please check your libao settings and try again

It tells me to check my libao settings, but I think there is no problem with them.
This is my libao settings in /etc/libao.conf

default_driver=pulse quiet

Any solutions will be appreciated.

@erikhric
Copy link

Try running as sudo. I saved me on nxp dev board.
Double check the driver - if you are using alsa device, you should change the confing accordingly.

@frol
Copy link

frol commented Feb 22, 2019

I am getting the same error:

$ sudo shairplay -a mylaptop
Error opening audio device 5
Please check your libao settings and try again

I have tried alsa and pulse as a default_driver in /etc/libao.conf. Here is the default /etc/libao.conf config in my Arch Linux:

default_driver=alsa
dev=default
quiet

If I drop quiet setting, and keep alsa, I get:

ao_alsa ERROR: Unable to open ALSA device 'default' for playback => Invalid argument

which seems fine as I use pulseaudio. With debug setting and pulse driver I get:

debug: Loaded driver null (built-in)
debug: Loaded driver wav (built-in)
debug: Loaded driver raw (built-in)
debug: Loaded driver au (built-in)
debug: Loading driver plugins from /usr/lib/ao/plugins-4...
debug: Loaded driver pulse
debug: Loaded driver alsa
debug: Loaded driver oss
debug: Testing drivers to find playback default...
Error opening audio device 5
Please check your libao settings and try again

@ColonelThirtyTwo
Copy link

Getting the same issue on a fresh Arch Linux install. Not really sure how this app in general is supposed to work.

@stephensrmmartin
Copy link

stephensrmmartin commented Dec 27, 2019

Edit your /etc/libao.conf:

  1. Change default_driver to pulse
  2. Comment out dev=default

@sagar-connect
Copy link

sagar-connect commented Feb 4, 2020

Edit your /etc/libao.conf:

  1. Change default_driver to pulse
  2. Comment out dev=default

Getting the same error, on Ubuntu.
Here's my /etc/libao.conf

default_driver=pulse
quiet

I don't even care about the audio for the moment, just need an extended screen with my Mac, is there a way?

@bikubi
Copy link

bikubi commented Feb 12, 2020

same here, on Arch.

@rashsaga - I was to start it with dev=null in libao.conf and --ao_driver=alsa

@HugoPoi
Copy link

HugoPoi commented Aug 8, 2020

I think we can close this one, because I confirm it's working on ArchLinux with just this

default_driver=pulse
quiet

in the /etc/libao.conf

@UnlimitedCookies
Copy link

Why is alsa not supported though?

@HugoPoi
Copy link

HugoPoi commented Dec 2, 2020

@UnlimitedCookies I think alsa is supported, it's just a mess if you use pulse and the same time alsa

@lunasophia
Copy link

I think we can close this one, because I confirm it's working on ArchLinux with just this

default_driver=pulse
quiet

in the /etc/libao.conf

This does not work for me on Arch. Maybe it did in 2020 when this comment was written, maybe HugoPoi has a different setup than I do (I have several different audio devices on my system). Confusingly, if I try to specify a different device ID, the option seems to be ignored:

$ doas /usr/bin/shairplay -a myhostname --ao_deviceid=2
Error opening audio device 5
Please check your libao settings and try again

Digging into the code, I see why.

fprintf(stderr, "Error opening audio device %d\n", errno);
This error message isn't saying that we failed to open audio device ID 5, it's saying we failed to open the specified audio device because of error 5. This is quite counterintuitive and is why proper punctuation is so important. Following the code, we ultimately call ao_open_live in audio_open_device:
device = ao_open_live(driver_id, &format, ao_options);

Looking at the documentation for the ao_open_live function we see it can set errno to a few values. The value of 5 corresponds to AO_EOPENDEVICE, a generic "welp something went wrong lol" error.

I tried specifying debug in my libao.conf but this didn't provide any useful information. This is as much as I have time to troubleshoot right now, perhaps someone else can use the info I posted here to figure out the root cause of the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants