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

Alsa device not working #48

Open
pgcudahy opened this issue Feb 1, 2023 · 6 comments
Open

Alsa device not working #48

pgcudahy opened this issue Feb 1, 2023 · 6 comments

Comments

@pgcudahy
Copy link

pgcudahy commented Feb 1, 2023

Hello, I've got an ubuntu setup with working audio but trying to get a spotifyd.conf that works with this container. Currently I have a USB soundcard that is labeled as "default" by aplay -L and aplay -D default /usr/share/sounds/alsa/Front_Center.wav works. My spotifyd.conf is

username= XXX
password = XXX
backend = "alsa"
device = "default"
control = "default"
mixer = "PCM"
volume_controller = "alsa"
device_name = "YYY"
bitrate = 160
no_audio_cache = true
initial_volume = "90"
volume_normalisation = true
normalisation_pregain = -10
zeroconf_port = 1234
device_type = "computer"

And my docker-compose.yml is

  spotifyd:
    container_name: spotifyd
    image: hvalev/spotifyd-alsa
    network_mode: host
    devices:
      - /dev/snd:/dev/snd
    volumes:
      - /usr/share/alsa:/usr/share/alsa
      - /home/pgcudahy/spotifyd/spotifyd.conf:/etc/spotifyd.conf
      - /etc/asound.conf:/etc/asound.conf
    group_add:
      - audio
    restart: unless-stopped

But it doesn't work and the logs are

Loading config from "/etc/spotifyd.conf"
No proxy specified
Using alsa volume controller.
Connecting to AP "ap.spotify.com:443"
Authenticated as "XXX" !
Country: "US"
Using Alsa sink with format: S16
Couldn't set volume: Error("snd_mixer_attach", Sys(EINVAL))
ALSA lib dlmisc.c:170:(snd_dlsym_verify) unable to verify version for symbol snd_func_private_integer
ALSA lib conf.c:4556:(_snd_config_evaluate) symbol snd_func_private_integer is not defined inside (null)
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such device or address
ALSA lib conf.c:3694:(snd_config_hook_load) Unable to expand filenames in the pre-load section
ALSA lib conf.c:3572:(snd_config_hooks_call) function snd_config_hook_load_for_all_cards returned error: No such device or address
ALSA lib control.c:1264:(snd_ctl_open_conf) Invalid type for CTL default definition

What am I getting wrong?

@hvalev
Copy link
Owner

hvalev commented Feb 1, 2023

Hi, I think to expose a USB device to a docker container you need to add as volume the actual usb drive handle. One way to easily check whether it would work is with the privileged: true option in your docker compose. privileged gives root access to the container of all of your host's devices. The proper way to do it is to mount the specific usb devices to the container. You can do that by mounting it as a volume similar to something like this: - /dev/ttyUSB0:/dev/ttyUSB0. However, you need to find out the exact handle for your soundcard. You can do that with lsusb.

@hvalev hvalev closed this as completed Feb 1, 2023
@hvalev hvalev reopened this Feb 1, 2023
@pgcudahy
Copy link
Author

pgcudahy commented Feb 1, 2023

lsusb gives me

Bus 002 Device 003: ID 0d8c:0014 C-Media Electronics, Inc. Audio Adapter (Unitek Y-247A)

But there are not ttyUSB devices
I tried adding

    devices:
      - /dev/snd:/dev/snd
      - /dev/bus/usb:/dev/bus/usb
    privileged: true

to the dockercompose.yml but get the same error

@hvalev
Copy link
Owner

hvalev commented Feb 1, 2023

you can mount the complete /dev to your container, e.g. - /dev:/dev or check which is the /dev handle for your usb soundcard using dmesg

@pgcudahy
Copy link
Author

pgcudahy commented Feb 1, 2023

Thanks very much for helping me with this. But even with

    devices:
      - /dev:/dev
    privileged: true

I still get the same error

@hvalev
Copy link
Owner

hvalev commented Feb 1, 2023

I'm not sure then. You could try to start the container with a bash shell and see if you can see the soundcard and try to get it to work. Alternatively, try to get spotifyd without a container, since it should be a bit easier.

@pgcudahy
Copy link
Author

pgcudahy commented Feb 1, 2023

Yeah, odd. I tried with the container dubodubonduponey/librespot and got it to work straight off. Thanks again for trying to debug with me.

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

2 participants