Error opening audio device 5

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

Read more here: Source link