TooTallNate / node-speaker

Output PCM audio data to the speakers
648 stars 145 forks source link

Fails in a docker #96

Open augnustin opened 7 years ago

augnustin commented 7 years ago

Has anyone tried to use this within a docker?

I get the following error:

ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
[../deps/mpg123/src/output/alsa.c:165] error: cannot open device default
node: pcm_params.c:2286: snd_pcm_hw_refine: Assertion `pcm && params' failed.
Aborted

According to the web this is related to the fact that the sound hardware is not connected...

I'll report along if I can make it work. Any suggestion welcome!

wzr1337 commented 7 years ago

+1 leads to issues on Travis-ci.org as well

alex-knyazev commented 6 years ago

+1. Does anybody know the solution?

meldron commented 6 years ago

So I have a similar problem with this library, even if I just import the node-speaker it tries to open the default device. I would suggest moving this check into a specific function (open?)

So your docker container cannot find a output device the program will crash with your error.

If you want that the docker container has access to the sound card add --device /dev/snd:/dev/snd to your run command. See Runtime privilege and Linux capabilities

Duxy1996 commented 4 years ago

+1 I'm having the same problem