Moode Forum

Full Version: No audio for Spotify with USB DAC
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Hi,
I was running a 6.x moOde for some time now and it was working OK.
As I saw the release some days ago I thought I sholuld give 7.2 a shot.

Setup was quite smooth and after configuring the output device to the USB DAC in the mpd config via the web ui I could listen to radio and local media just fine.

However when trying out spotify and airplay (main purpose for me) it looked like it was playing fine but I could not hear anything.
I got Airplay to work by setting the bitdepth to 32 as I saw that my dac might only support 32.

Spotify is still not working (it was working on 6.x)

Code:
A U D I O   P A R A M E T E R S

Audio device        = DX3 Pro
Interface        = USB
Mixer name        = DX3 Pro
Hardware mixer        = Yes
Supported formats    = S32_LE, SPECIAL, DSD_U32_BE
ALSA max volume        = 100
ALSA loopback        = Off
MPD max volume        = 100
Volume step limit    = 10
Display dB volume    = Off
Audio source        = Local
Output device        = Local
Resume MPD        = No
Volume knob        = 0
Volume mute        = Unmuted
Saved MPD vol        = 0
Preamp volume        = 0
ALSA version        = 1.1.8-1+rpt1
SoX version        = 0.1.2-3


Code:
M P D   S E T T I N G S

Version            = 0.22.6_p0x3
Volume mixer        = disabled
ALSA device        = hw:2
SoX resampling        = disabled
Selective resampling    = disabled
SoX quality        = very high
SoX multithreading    = on
DSD over PCM (DoP)    = no
Replaygain        = off
Replaygain preamp    = 0
Volume normalization    = No
Audio buffer        = 4 (MB)
Output buffer size    = 128 (MB)
Max playlist items    = 16384
Input cache        = Disabled

B L U E T O O T H   S E T T I N G S

Bluetooth ver        = 5.50
Bluealsa ver        = v3.0.0
Speaker sharing        = No
Resume MPD        = No
PCM buffer time        = 500000 (µs)

A I R P L A Y   S E T T I N G S

Version            = 3.3.6
Friendly name        = Kopfhörer Wohnzimmer
ALSA device        = hw:2
Interpolation        = soxr
Output bit depth    = S32
Output sample rate    = 44100
Session interruption    = no
Session timeout        = 120 (ms)
Latency offset        = 0.0 (secs)
Audio buffer        = 0.2 (secs)
Resume MPD        = No

S P O T I F Y   S E T T I N G S

Friendly name        = Kopfhörer Wohnzimmer
ALSA device        = plughw:2
Bit rate        = 320
Initial volume        = 100
Volume curve        = fixed
Volume normalization    = No
Normalization pregain    = 3
Autoplay        = No
Resume MPD        = No

I will keep poking around but any support would be great.
I just saw the command moOde uses to start librespot in the logs and launched it manually via ssh.
Result seems to be a crash as soon as playback starts

Code:
sudo librespot --name "Kopfhörer Wohnzimmer" --bitrate 320 --initial-volume 100 --volume-ctrl fixed --cache /var/local/www/spotify_cache --disable-audio-cache --backend alsa --device "_audioout" --onevent /var/local/www/commandw/spotevent.sh -v



Code:
[2021-04-29T21:28:46Z INFO  librespot::player_event_handler] Running ["/var/local/www/commandw/spotevent.sh"] with environment variables {"TRACK_ID": "5KQPLoxBkpzJMYulVxTR5u", "DURATION_MS": "201471", "POSITION_MS": "18160", "PLAYER_EVENT": "playing"}
[2021-04-29T21:28:46Z ERROR librespot_playback::audio_backend::alsa] Alsa error PCM open ALSA function 'snd_pcm_hw_params_set_format' failed with error 'EINVAL: Invalid argument'
[2021-04-29T21:28:46Z ERROR librespot_playback::player] Could not start audio: Alsa error: PCM open failed
[2021-04-29T21:28:46Z TRACE librespot_playback::player] == Starting sink ==
[2021-04-29T21:28:46Z ERROR librespot_playback::audio_backend::alsa] Alsa error PCM open ALSA function 'snd_pcm_hw_params_set_format' failed with error 'EINVAL: Invalid argument'
[2021-04-29T21:28:46Z ERROR librespot_playback::player] Could not start audio: Alsa error: PCM open failed
[2021-04-29T21:28:46Z TRACE librespot_playback::player] == Starting sink ==
[2021-04-29T21:28:46Z TRACE librespot_connect::spirc] ==> kPlayStatusPlay
[2021-04-29T21:28:46Z INFO  librespot::player_event_handler] Running ["/var/local/www/commandw/spotevent.sh"] with environment variables {"POSITION_MS": "18160", "DURATION_MS": "201471", "PLAYER_EVENT": "playing", "TRACK_ID": "5KQPLoxBkpzJMYulVxTR5u"}
[2021-04-29T21:28:46Z ERROR librespot_playback::audio_backend::alsa] Alsa error PCM open ALSA function 'snd_pcm_hw_params_set_format' failed with error 'EINVAL: Invalid argument'
[2021-04-29T21:28:46Z ERROR librespot_playback::player] Could not start audio: Alsa error: PCM open failed
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', playback/src/audio_backend/alsa.rs:138:45
Tried turning up the volume? Librespot defaults to 0% volume ootb.
hmmm I can try again but pretty sure I did and the crash in librespot is not promising Wink

In general I have tried to set all volumes and initial values to 100% or disabled them to make sure this won't be an issue. I use only the manual volume controll of the DAC anyway.

I just found this issue where someone has a similar problem with the same dac and alsa backend. https://github.com/librespot-org/librespot/issues/333
Someone there resolved it by changing the backend to pulse but I don't really want to make such deep changes in my moOde
Ok I can get it working from commandline now, question is how to make moOde pass the right parameter... (have to dig into the sources I guess)

what moOde does:
Code:
--device "_audioout"

what works:
Code:
--device "plughw:2,0"
Ok got it working for now.
I changed the alsa config in /etc/alsa/conf.d/_deviceout.conf
form
Code:
pcm._deviceout {
type copy
slave.pcm "hw:2,0"
}
to
Code:
pcm._deviceout {
type copy
slave.pcm "plughw:2,0"
}
and rebooted.

However I think it would be great if this is the default (my gues alsa plugins are needed to feed 32 bit to my DAC)
I'm also not sure if this is persistent or if moOde updates the also config at any point... Would be great to have feedback from someone with deeper knowledge

If anyone tries to use this fix be aware that you need to know the card id/index of your dac (2 for me) but most DACs should end up there (0 HDMI, 1 Headphonejack, 2 USB)
ALSA hw sends pcm directly to driver w/o any conversions while plughw will do automatic rate, format, channel conversions if necessary.

Spotify defaults to 16 bit format unless the --format option is specified when launching it so I think adding a bit depth option to Spotify Config similar to what we have in Airplay Config would prolly be the best solution.
https://github.com/librespot-org/librespot/wiki/Options
That sounds like a good option.

From the output of system info it looks like moOde could be aware of the supported bit depths. Best would be if there is only support for 32 bit ("Supported formats = S32_LE, SPECIAL, DSD_U32_BE") that the options for airplay and spotify are automatically enabled.

I will set this to solved for now, is there a place to have a "feature request" ticket to track when this is in?
That might be a better way to handle it and it could also be applied to the Airplay launch string. I'll add "Automatic bit depth detection for Spotify and Airplay" to the TODO list for the next update.
Hi,
I'm suffering from this issue as well, no sound when trying to play Spotify via my USB dac.

Any suggestion how to fix this as I'm uncomfortable with the suggestions above? I do not know how to fix by using the terminal.
Pages: 1 2 3 4