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

Couldn't read volume from alsa device with name... (alsa, usb dac) #261

Closed
matt-garman opened this issue Jun 28, 2019 · 8 comments
Closed
Assignees
Labels
advice Advice within issues that people could find helpful later on enhancement A new feature that would improve Spotifyd
Milestone

Comments

@matt-garman
Copy link

matt-garman commented Jun 28, 2019


EDIT: If it happens that you stumble across this issue and your alsa device isn't recognized, it might be due to unusual naming. White-space doesn't work inside of the configuration and has to be passed through CLI arguments for now. Example:

spotifyd --mixer "D70 "

~Sven (SirWindfield)


I'm using v0.2.11, precompiled armv6 version on a Raspberry Pi 3. My audio device is a USB DAC, the Topping DX3 Pro. Playback works as expected with the config device = plughw:CARD=Pro, but so far I've only been able to use software volume control (volume-control = softvol). But the device supports hardware volume control; I'm using it in MPD. FWIW, here is the relevant section of my /etc/mpd.conf:

audio_output {
        type            "alsa"
        name            "My ALSA Device"
        device          "hw:1,0"        # optional
        mixer_type      "hardware"      # optional
        mixer_device    "hw:1"  # optional
        mixer_control   "DX3 Pro "
}

In fact I use an MPD client's volume control to change the volume while actually listening through spotifyd. Either that or load up alsamixer in a terminal window.

Here is the output of aplay -l:

Click to expand
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pc
m5102a-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Pro [DX3 Pro], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

And here is the output of aplay -L:

null
    Discard all samples (playback) or generate zero samples (capture)
sysdefault:CARD=sndrpihifiberry
    snd_rpi_hifiberry_dac,
    Default Audio Device
dmix:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_dac,
    Direct sample mixing device
dsnoop:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_dac,
    Direct sample snooping device
hw:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_dac,
    Direct hardware device without any conversions
plughw:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_dac,
    Hardware device with all software conversions
sysdefault:CARD=Pro
    DX3 Pro, USB Audio
    Default Audio Device
front:CARD=Pro,DEV=0
    DX3 Pro, USB Audio
    Front speakers
surround21:CARD=Pro,DEV=0
    DX3 Pro, USB Audio
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Pro,DEV=0
    DX3 Pro, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=Pro,DEV=0
    DX3 Pro, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Pro,DEV=0
    DX3 Pro, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Pro,DEV=0
    DX3 Pro, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Pro,DEV=0
    DX3 Pro, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Pro,DEV=0
    DX3 Pro, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=Pro,DEV=0
    DX3 Pro, USB Audio
    Direct sample mixing device
dsnoop:CARD=Pro,DEV=0
    DX3 Pro, USB Audio
    Direct sample snooping device
hw:CARD=Pro,DEV=0
    DX3 Pro, USB Audio
    Direct hardware device without any conversions
plughw:CARD=Pro,DEV=0
    DX3 Pro, USB Audio
    Hardware device with all software conversions

I have tried all the following "control" params in my /etc/spotifyd.conf:

#control = "Pro"
#control = "DX3 Pro"
#control = "DX3 Pro "
#control = dx3pro
#control = PCM
#control = pcm
#control = hw:1
#control = dmix:CARD=Pro,DEV=0
#control = plughw:CARD=Pro,DEV=0
#control = hw:CARD=Pro,DEV=0
#control = "DX3 Pro  Playback Volume"

All of them result in an error like this:

ALSA lib control.c:1373:(snd_ctl_open_noupdate) Invalid CTL DX3 Pro  Playback Volume
14:41:11 [ERROR] Couldn't read volume from alsa device with name "DX3 Pro  Playback Volume".

Am I using the wrong value(s) for device, mixer, and/or control?

Thanks!

@jvanwouw
Copy link

jvanwouw commented Aug 2, 2019

I'm having the same issue on my laptop, which has an AMD HDMI audio out and built-in Realtek ALC3228 and to which I have a JDS Labs DAC connected (set as default). Both "default:CARD=DAC" and hw:0,0 result in messages such as "[ERROR] Couldn't read volume from alsa device with name "default:CARD=DAC".", "ALSA lib control.c:1373:(snd_ctl_open_noupdate) Invalid CTL hw:0,0", and "[ERROR] Couldn't set volume: Error("snd_mixer_attach", Sys(ENOENT))".

@jvanwouw
Copy link

jvanwouw commented Aug 2, 2019

Somehow the errors have disappeared after setting:
"device = hw:DAC,0 # run aplay -L for possible values
control = hw:DAC # device for the mixer, if not the same as 'device'"
Not sure whether it was the change from "0" to DAC or setting "control" (which is commented out by default). I tried this after reading #87 BTW, don't set "volume-control" to "softvol" as someone suggests in that thread as it resulted in silence during playback for me. Only once I set it back to the default "alsa" everything fully worked. I should mention that like you I am only using ALSA (I discovered that if you install openSUSE Leap 15.1 with only a "generic desktop environment" (it really just installs IceWM with an openSUSE theme), e.g. without KDE or GNOME, pulseaudio is not installed, even though its config file is there).

@matt-garman
Copy link
Author

@jvanwouw - could you post the output of "aplay -l" (lower-case el) and "aplay -L" on your system? Thanks!

@J-u-n-o
Copy link

J-u-n-o commented Sep 15, 2019

In the past had something similar, but could also be another application.
At that time I wished at startup, or (reduce startup time) after not finding the selected audio device, the application list/logs all devices, as found by the audio library.

@whyscream
Copy link

I'm seeing similar errors. I'm running a self-compiled binary on i386 linux, with default settings. Previously I was running v0.2.8 without any issues, but after upgrading to v0.2.20, I' seeing errors:

Dec 24 22:04:25 julie spotifyd[30838]: 21:04:25 [INFO] Loading config from "/etc/spotifyd.conf"
Dec 24 22:04:25 julie spotifyd[30838]: 21:04:25 [INFO] Using alsa volume controller.
Dec 24 22:04:25 julie spotifyd[30838]: ALSA lib conf.c:4738:(snd_config_expand) Unknown parameters CARD=Intel
Dec 24 22:04:25 julie spotifyd[30838]: ALSA lib control.c:954:(snd_ctl_open_noupdate) Invalid CTL default:CARD=Intel
Dec 24 22:04:25 julie spotifyd[30838]: 21:04:25 [ERROR] Couldn't read volume from alsa device with name "default:CARD=Intel".
Dec 24 22:04:26 julie spotifyd[30838]: 21:04:26 [INFO] Connecting to AP "gew1-accesspoint-a-7zx7.ap.spotify.com:443"
Dec 24 22:04:26 julie spotifyd[30838]: 21:04:26 [INFO] Authenticated as "username-redacted" !
Dec 24 22:04:26 julie spotifyd[30838]: ALSA lib conf.c:4738:(snd_config_expand) Unknown parameters CARD=Intel
Dec 24 22:04:26 julie spotifyd[30838]: ALSA lib control.c:954:(snd_ctl_open_noupdate) Invalid CTL default:CARD=Intel
Dec 24 22:04:26 julie spotifyd[30838]: 21:04:26 [ERROR] Couldn't read volume from alsa device with name "default:CARD=Intel".
Dec 24 22:04:26 julie spotifyd[30838]: ALSA lib conf.c:4738:(snd_config_expand) Unknown parameters CARD=Intel
Dec 24 22:04:26 julie spotifyd[30838]: ALSA lib control.c:954:(snd_ctl_open_noupdate) Invalid CTL default:CARD=Intel
Dec 24 22:04:26 julie spotifyd[30838]: 21:04:26 [ERROR] Couldn't set volume: Error("snd_mixer_attach", Sys(EINVAL))
Dec 24 22:04:26 julie spotifyd[30838]: 21:04:26 [INFO] Country: "NL"
Dec 24 22:04:26 julie spotifyd[30838]: 21:04:26 [INFO] Using alsa sink
Dec 24 22:04:27 julie systemd[1]: Started A spotify playing daemon.

Output of aplay -L:

null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=Intel
    HDA Intel, ALC888 Analog
    Default Audio Device
sysdefault:CARD=Intel
    HDA Intel, ALC888 Analog
    Default Audio Device
front:CARD=Intel,DEV=0
    HDA Intel, ALC888 Analog
    Front speakers
surround21:CARD=Intel,DEV=0
    HDA Intel, ALC888 Analog
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Intel,DEV=0
    HDA Intel, ALC888 Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=Intel,DEV=0
    HDA Intel, ALC888 Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Intel,DEV=0
    HDA Intel, ALC888 Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Intel,DEV=0
    HDA Intel, ALC888 Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Intel,DEV=0
    HDA Intel, ALC888 Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Intel,DEV=0
    HDA Intel, ALC888 Digital
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=Intel,DEV=0
    HDA Intel, ALC888 Analog
    Direct sample mixing device
dmix:CARD=Intel,DEV=1
    HDA Intel, ALC888 Digital
    Direct sample mixing device
dsnoop:CARD=Intel,DEV=0
    HDA Intel, ALC888 Analog
    Direct sample snooping device
dsnoop:CARD=Intel,DEV=1
    HDA Intel, ALC888 Digital
    Direct sample snooping device
hw:CARD=Intel,DEV=0
    HDA Intel, ALC888 Analog
    Direct hardware device without any conversions
hw:CARD=Intel,DEV=1
    HDA Intel, ALC888 Digital
    Direct hardware device without any conversions
plughw:CARD=Intel,DEV=0
    HDA Intel, ALC888 Analog
    Hardware device with all software conversions
plughw:CARD=Intel,DEV=1
    HDA Intel, ALC888 Digital
    Hardware device with all software conversions

my config file:

[global]
username = <redacted>
password = <redacted>
backend = alsa
device = default:CARD=Intel # Given by `aplay -L`
mixer = PCM
volume_controller = alsa
bitrate = 160
cache_path = /var/lib/spotifyd
volume_normalisation = true
normalisation_pregain = -10

Note: the errors went away when I set volume_controller=softvol, but now the music plays way softer than before.

@arcamagna
Copy link

I have same problem as OP. I have a Topping D70. I'm guessing the problem occurs from the space in the mixer control name - in my case its "D70 " (note trailing space). Quotes around the control name don't help.

Hardware audio is supported in MPD provided the mixer control name includes the space:

audio_output {
type "alsa"
name "D70"
device "hw:0,0"
mixer_type "hardware"
mixer_control "D70 "
}

@mainrs
Copy link
Member

mainrs commented Jan 17, 2020

Everything after the = is interpreted as the value of the field. All white-space is removed beforehand. So this is kind of intended but definitely not wanted.

What might help would be passing down the value as a program argument: spotifyd --mixer "D70 ". This should work as CLI arguments are used as is IIRC.

On fixing this issue. The "official" v1.0 release (the next release I will start working on after my finals) will include a lot of breaking changes (including moving to TOML), which will eliminate bugs like these and allows us to make a lot of name changes to the cli names to make them more stream-lined (like having all alsa specific arguments prepended with alsa. mixer for example only applies to that backend IIRC).

@mainrs mainrs self-assigned this Jan 17, 2020
@mainrs mainrs added the enhancement A new feature that would improve Spotifyd label Jan 17, 2020
@mainrs mainrs added this to the v1.0.0 milestone Jan 17, 2020
@arcamagna
Copy link

Many thanks, that got it working.

Good luck with the exams!

@mainrs mainrs added the advice Advice within issues that people could find helpful later on label Jul 14, 2020
@mainrs mainrs closed this as completed Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
advice Advice within issues that people could find helpful later on enhancement A new feature that would improve Spotifyd
Projects
None yet
Development

No branches or pull requests

6 participants