PromyLOPh / pianobar

Console-based pandora.com player
http://6xq.net/pianobar/
Other
1.74k stars 321 forks source link

Running on Windows Subsystem for Linux with Pulseaudio working - /!\ Cannot open audio device. #685

Open ronilaukkarinen opened 5 years ago

ronilaukkarinen commented 5 years ago

Subject of the issue

Trying to run pianobar on WSL, Hyper terminal, Ubuntu 16.04. Getting it to run, but just skipping tracks with /!\ Cannot open audio device. message without any sound.

Your environment

config:

user = 
password = 

#control_proxy = http://98.102.88.158:8080
#control_proxy = http://208.114.192.126:8080

# https://www.us-proxy.org/
control_proxy = http://153.92.5.186:8080

fifo = /home/rolle/.config/pianobar/ctl
#audio_quality = high
#autostart_station = 829594236901097823

# http://proxylist.hidemyass.com/search-1303410#listable
# http://www.gatherproxy.com/proxylist/country/?c=United%20States

#event_command = /home/rolle/.config/pianobar/events.py

Steps to reproduce

  1. Install WSL
  2. Install all dependencies and pianobar (followed this tutorial: https://gist.github.com/paulbaker3/2886698)
  3. Configure pulseaudio for Windows https://token2shell.com/howto/x410/enabling-sound-in-wsl-ubuntu-let-it-sing/ and testing https://community.mycroft.ai/t/experimental-mycroft-on-wsl-with-pulseaudio/5464

Expected behaviour

Songs should play normally with sound without errors.

Actual behaviour

Sound works when running paplay test.wav on Terminal. It just needs export PULSE_SERVER=tcp:127.0.0.1 to be run before. However, when running pianobar, it looks like this (debug on):

rolle@Optimus:/mnt/c/Users/Optimus/pianobar$ pianobar
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/x86_64-linux-gnu/ao/plugins-4...
debug: Loaded driver alsa
ERROR: Failed to load plugin /usr/lib/x86_64-linux-gnu/ao/plugins-4/libesd.so => dlopen() failed
ERROR: Failed to load plugin /usr/lib/x86_64-linux-gnu/ao/plugins-4/libnas.so => dlopen() failed
debug: Loaded driver oss
debug: Loaded driver pulse
Welcome to pianobar (2019.02.14-dev)! Press ? for a list of commands.
(i) Login... Ok.
(i) Get stations... Ok.
|>  Station "QuickMix" (829594236901097823)
(i) Receiving new playlist... Ok.
|>  "Let Me" by "Widowspeak" on "Expect the Best" @ Shoegaze Radio
debug: Testing drivers to find playback default...
/!\ Cannot open audio device.
|>  "Rapture At Sea" by "Eastern Sun" on "Groove Closet" @ Know Where Radio
debug: Testing drivers to find playback default...
/!\ Cannot open audio device.
|>  "Love Is Here To Stay (1959)" by "Oscar Peterson" on "Oscar Peterson Plays The George Gershwin Song Book" @ Jazz Instrumentals Radio
/!\ Unable to open audio file (Immediate exit requested)
|>  "If You Can't Help Your Own" by "Hank Williams III" on "Damn Right, Rebel Proud (Explicit)" @ Hank Williams III Radio
/!\ Unable to open audio file (Immediate exit requested)
rolle@Optimus:/mnt/c/Users/Optimus/pianobar$ ^C

/etc/libao.conf:

rolle@Optimus:/mnt/c/Users/Optimus/pianobar$ sudo cat /etc/libao.conf
default_driver=pulse
dev=default
debug=1
server=127.0.0.1
#quiet

Alsa is currently not functional on WSL.

edward-p commented 5 years ago

I don't think you need dev=default in your libao.conf. According to pa_simple_new you need pass a NULL to dev for default. If you set dev=default, a string "default" will be passed to pa_simple_new. see ao_pulse.c:266

ronilaukkarinen commented 5 years ago

Yeah, that's just one option I tried when desperately tried to get this to work. It's now removed from libao.conf but that doesn't improve the situation which seems to be stay the same regardless to that option.

PromyLOPh commented 5 years ago

Can you step into GDB, add a breakpoint at player.c:336 (the error message) and dump the value of the variable errno? It should tell us more about the failure.

ronilaukkarinen commented 5 years ago

GDB is not familiar to me as I'm not very experienced in testing and programming software as I'm only a server and web dev type of dude.

I have just installed gdb via adb. gdb --help works so I guess it's installed correctly. How to add breakpoint? (what that even means?) I presume I need to go to source dir where player.c is at or point to it somehow, but can you please provide me more precise steps on how to proceed, thanks!

PromyLOPh commented 5 years ago

Uh, that’s going to be tough if you’ve never used GDB before. Can you apply this patch instead? It should print the error number. https://gist.github.com/PromyLOPh/b294b0882c3bf942bf456dda0af19632

ronilaukkarinen commented 5 years ago

Here you go:

|>  Station "QuickMix" (829594236901097823)
(i) Receiving new playlist... Ok.
|>  "Sweet Emotion" by "Aerosmith" on "O, Yeah!  Ultimate Aerosmith Hits" @ 70s Rock Radio
debug: Testing drivers to find playback default...
/!\ Cannot open audio device (error 5).
|>  "Polka Dots And Moonbeams" by "Elmo Hope" on "Side Steps" @ Jazz Instrumentals Radio
debug: Testing drivers to find playback default...
/!\ Cannot open audio device (error 5).
|>  "Faded" by "Alan Walker" on "Faded" <3 @ Alan Walker Radio
debug: Testing drivers to find playback default...
/!\ Cannot open audio device (error 5).
PromyLOPh commented 5 years ago

That is equivalent to AO_EOPENDEVICE, which means the driver is having some issue opening the device. It is likely this is an issue with libao on Windows Subsystem for Linux, so you might have to report it here and pray for someone to answer. Not much else I can do, unfortunately.