After installing the November update, librespot gives this error on playback:
osmc@osmc0:~$ /usr/bin/librespot --name DEBUG --device-type speaker --backend alsa --bitrate 160 --disable-audio-cache --enable-volume-normalisation --volume-ctrl linear --initial-volume 100
[2021-11-27T18:43:27Z INFO librespot] librespot 0.3.1 bbd575e (Built on 2021-11-26, Build ID: a6e0Ery3, Profile: release)
[2021-11-27T18:43:35Z INFO librespot_core::session] Connecting to AP "gew1-accesspoint-a-rvkf.ap.spotify.com:4070"
[2021-11-27T18:43:35Z INFO librespot_core::session] Authenticated as "aqsi57rjbdnmoxlvc7flv9qo7" !
[2021-11-27T18:43:35Z INFO librespot_playback::mixer::softmixer] Mixing with softvol and volume control: Linear
[2021-11-27T18:43:35Z INFO librespot_core::session] Country: "NL"
[2021-11-27T18:43:35Z INFO librespot_playback::convert] Converting with ditherer: tpdf
[2021-11-27T18:43:35Z INFO librespot_playback::audio_backend::alsa] Using AlsaSink with format: S16
[2021-11-27T18:43:38Z INFO librespot_playback::player] Loading <Nomad> with Spotify URI <spotify:track:75zwzv0Q6ZJdkBrJUYvtAC>
[2021-11-27T18:43:38Z INFO librespot_playback::player] <Nomad> (456200 ms) loaded
[2021-11-27T18:43:38Z ERROR librespot_playback::player] Audio Sink Error Invalid Parameters: <AlsaSink> Hardware, ALSA function 'snd_pcm_hw_params_set_buffer_time_near' failed with error 'EINVAL: Invalid argument'
Is there an option I can set to fix this or should I downgrade?
Just a guess:
mv .asoundrc .asound.backup
and do a reboot and try
I don’t have an .asoundrc
in the osmc homedirectory. Normally librespot is started with the raspotify systemd unit (doesn’t work currently either), that looks like this:
# /lib/systemd/system/raspotify.service
[Unit]
Description=Raspotify (Spotify Connect Client)
Documentation=https://github.com/dtcooper/raspotify
Documentation=https://github.com/librespot-org/librespot
Documentation=https://github.com/dtcooper/raspotify/wiki
Documentation=https://github.com/librespot-org/librespot/wiki/Options
Wants=network.target sound.target
After=network.target sound.target
[Service]
DynamicUser=yes
SupplementaryGroups=audio
Restart=always
RestartSec=10
# Some of these may be implied by DynamicUser=yes
RestrictRealtime=true
RestrictSUIDSGID=true
RestrictNamespaces=true
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK
ProtectHostname=true
ProtectControlGroups=true
ProtectKernelLogs=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectProc=invisible
ProtectHome=true
ProtectSystem=strict
ProtectClock=yes
DevicePolicy=strict
DeviceAllow=char-alsa rw
DeviceAllow=/dev/null r
DeviceAllow=/dev/random r
DeviceAllow=/dev/urandom r
UMask=077
CacheDirectoryMode=0700
CacheDirectory=raspotify
PrivateTmp=true
PrivateUsers=true
ProcSubset=pid
NoNewPrivileges=true
PermissionsStartOnly=true
LockPersonality=true
MemoryDenyWriteExecute=true
RemoveIPC=true
CapabilityBoundingSet=
#SystemCallArchitectures=native
SystemCallFilter=@system-service
SystemCallFilter=~@privileged @resources
SystemCallErrorNumber=EPERM
Environment="DEVICE_NAME=Raspotify (%H)"
Environment="BITRATE=160"
Environment="CACHE_ARGS=--disable-audio-cache"
Environment="VOLUME_ARGS=--enable-volume-normalisation --volume-ctrl linear --initial-volume 100"
Environment="BACKEND_ARGS=--backend alsa"
Environment="DEVICE_TYPE=speaker"
ConfigurationDirectory=default
/etc/default/raspotify
:
# /etc/default/raspotify -- Arguments/configuration for librespot
# Device name on Spotify Connect
#DEVICE_NAME="raspotify"
# The displayed device type in Spotify clients.
# Can be "unknown", "computer", "tablet", "smartphone", "speaker", "tv",
# "avr" (Audio/Video Receiver), "stb" (Set-Top Box), and "audiodongle".
#DEVICE_TYPE="speaker"
# Bitrate, one of 96 (low quality), 160 (default quality), or 320 (high quality)
BITRATE="320"
# Additional command line arguments for librespot can be set below.
# See `librespot -h` for more info. Make sure whatever arguments you specify
# aren't already covered by other variables in this file. (See the daemon's
# config at `/lib/systemd/system/raspotify.service` for more technical details.)
#
# To make your device visible on Spotify Connect across the Internet add your
# username and password which can be set via "Set device password", on your
# account settings, use `--username` and `--password`.
#
# To choose a different output device (ie a USB audio dongle or HDMI audio out),
# use `--device` with something like `--device hw:0,1`. Your mileage may vary.
#
#OPTIONS="--username <USERNAME> --password <PASSWORD>"
# Uncomment to use a cache for downloaded audio files. Cache is disabled by
# default. It's best to leave this as-is if you want to use it, since
# permissions are properly set on the directory `/var/cache/raspotify'.
#CACHE_ARGS="--cache /var/cache/raspotify"
# By default, the volume normalization is enabled, add alternative volume
# arguments here if you'd like, but these should be fine.
#VOLUME_ARGS="--enable-volume-normalisation --volume-ctrl linear --initial-volume=100"
# Backend could be set to pipe here, but it's for very advanced use cases of
# librespot, so you shouldn't need to change this under normal circumstances.
#BACKEND_ARGS="--backend alsa"
Any other ideas? Can this be related to the November update? Any changes in how sound devices are handled? It looks like librespot can’t find a suitable device, implying that it’s in use? I tried stopping the mediacenter service but that made no difference.
osmc@osmc0:~$ librespot --device ?
[2021-11-28T21:15:57Z INFO librespot] librespot 0.3.1 bbd575e (Built on 2021-11-26, Build ID: a6e0Ery3, Profile: release)
Compatible alsa device(s):
------------------------------------------------------
It looks like the matter is in hand over there.