Closed timglong closed 2 years ago
I swear I searched for pBuffer->full() && (abs(median_) > 2)
in issues but somehow I missed #781 ...
--sampleformat 48000:16:*
fixed the issue and I'm back in multi-room business.
Thanks for this fantastic software and all your efforts!
Edit for posterity, this is the exact configuration I'm now using in /etc/default/snapclient
# Start the client, used only by the init.d script
START_SNAPCLIENT=true
# Additional command line options that will be passed to snapclient
# note that user/group should be configured in the init.d script or the systemd unit file
# For a list of available options, invoke "snapclient --help"
SNAPCLIENT_OPTS="-s 7 --sampleformat 48000:16:*"
I also struggled with this problem for two days until I found the solution in https://github.com/badaix/snapcast/discussions/949#discussioncomment-1941407.
The main thing seems to be which device get's picked by snapclient. If the output from snapclient contains something like:
(Alsa) PCM name: hw:CARD=CODEC,DEV=0
or
(Alsa) PCM name: hw:CARD=U0x41e0x30d3,DEV=0
It works for me. If the
,DEV=X
part is missing, I get the sound dropouts and messages from the client.
Maybe it would be possible for snapclient to try to pick a device with a DEV= extension or it might make sense to put a hint on it in the message. Here you can see the difference on the builtin sounddevice of my libreelec system:
2022-01-11 00-43-03.843 [Info] (Player) Player name: alsa, device: sysdefault:CARD=PCH, description: HDA Intel PCH, ALC892 Analog
2022-01-11 00-43-03.843 [Info] (Player) Default Audio Device, idx: 7, sharing mode: unspecified, parameters: <none>
2022-01-11 00-43-03.843 [Info] (Player) Mixer mode: software, parameters: <none>
2022-01-11 00-43-03.843 [Info] (Player) Sampleformat: 44100:16:2, stream: 44100:16:2
2022-01-11 00-43-03.844 [Info] (Alsa) Using default buffer_time: 80 ms, default fragments: 4
2022-01-11 00-43-03.846 [Info] (Alsa) Period time too small, changing from 20000 to 21333
2022-01-11 00-43-03.847 [Info] (Alsa) PCM name: sysdefault:CARD=PCH, sample rate: 44100 Hz, channels: 2, buffer time: 85328 us, periods: 4, period time: 21333 us, period frames: 940
2022-01-11 00-43-03.847 [Info] (Stream) No chunks available
2022-01-11 00-43-03.847 [Info] (Alsa) Failed to get chunk
2022-01-11 00-43-04.082 [Info] (Controller) diff to server [ms]: 2.68904e+08
2022-01-11 00-43-15.451 [Info] (Stream) pBuffer->full() && (abs(median_) > 2): 2314
2022-01-11 00-43-26.159 [Info] (Stream) pBuffer->full() && (abs(median_) > 2): 2243
2022-01-11 00-43-36.867 [Info] (Stream) pBuffer->full() && (abs(median_) > 2): 2215
2022-01-11 00-43-47.575 [Info] (Stream) pBuffer->full() && (abs(median_) > 2): 2323
and
2022-01-11 00-45-43.363 [Info] (Player) Player name: alsa, device: front:CARD=PCH,DEV=0, description: HDA Intel PCH, ALC892 Analog
2022-01-11 00-45-43.363 [Info] (Player) Front output / input, idx: 8, sharing mode: unspecified, parameters: <none>
2022-01-11 00-45-43.363 [Info] (Player) Mixer mode: software, parameters: <none>
2022-01-11 00-45-43.363 [Info] (Player) Sampleformat: 44100:16:2, stream: 44100:16:2
2022-01-11 00-45-43.363 [Info] (Alsa) Using default buffer_time: 80 ms, default fragments: 4
2022-01-11 00-45-43.385 [Info] (Alsa) PCM name: front:CARD=PCH,DEV=0, sample rate: 44100 Hz, channels: 2, buffer time: 80000 us, periods: 4, period time: 20000 us, period frames: 882
2022-01-11 00-45-43.385 [Info] (Stream) No chunks available
2022-01-11 00-45-43.385 [Info] (Alsa) Failed to get chunk
2022-01-11 00-45-43.487 [Info] (Controller) diff to server [ms]: 2.68904e+08
In case of soundcard index 8 with the DEV=0 no errors get logged and no dropouts in sound.
Had the same problem and this fixed it, but using a card with the DEV=0 part seems to disable dmix. I needed dmix to work as I wanted programs besides snapclient to be able to output simultaneously. I also wanted to avoid pointless resampling to 48kHz. This asound.conf seems to be working for me:
pcm.dmix0 {
type dmix
ipc_key 1024 # Any unique value
ipc_key_add_uid false # Let multiple users share
ipc_perm 0666 # IPC permissions for multi-user sharing (octal, default 0600)
slave {
pcm "hw:1,0"
rate 44100
}
}
pcm.dsp0 {
type plug
slave.pcm "dmix0"
}
Run snapclient with -s dsp0
.
Describe the bug Persistent, regular crackles/pops during Spotify streaming. At first (distracted listening) I thought this was just a transient issue, however listening more closely the crackles/pops are audible at regular intervals in line with the messages in the logs. It unfortunately makes this setup unusable.
I really hope this can be fixed as Snapcast is amazing. I pieced together the below setup from comments in various places and was really pumped when I figured out the last issue (sample rate) and everything started working. Then I noticed the crackles and pops, and so far I haven't been able to figure out how to fix it, so it's back to single room audio for the moment.
Steps to Reproduce
/usr/share/alsa/alsa.conf
withdefaults.ctl.card 1
anddefaults.pcm.card 1
to enable USB DAC outputsystemctl restart raspotify
if there are any errors (https://gist.github.com/JeremieRapin/bc35a2632c072a082d48f5503270df16)BACKEND_ARGS="--backend pipe --device /tmp/snapfifo"
in/etc/default/raspotify
source = pipe:///tmp/snapfifo?name=default&sampleformat=44100:16:2
in/etc/snapserver.conf
SNAPCLIENT_OPTS="-s 7"
(in my case) in/etc/default/snapclient
to specify output to USB DACsEnvironment details
snapclient_0.25.0-1_without-pulse_armhf.deb
andsnapserver_0.25.0-1_armhf.deb
Attempted Fixes/Notes
Client debug log:
Snapserver debug log:
PiOffice Syslog
PiOffice Syslog
Syslog Notes The
pBuffer->full() && (abs(median_) > 2):
messages continue as long as Spotify is streaming.