Shairport-sync: Starting and stopping playback pops

Created on 13 Dec 2018  Â·  7Comments  Â·  Source: mikebrady/shairport-sync

Starting and stopping playback creates crackling and popping noises on USB audio device (Focusrite Scarlett 2i2).

Leds on device are blink on each new playback start (resetting the driver?).

Looks like problem with ALSA open/close device. If it's impossible to fix this with proper methods maybe it's a good idea to add 'sink release delay' option.

Way to reproduce:
aplay -r 44100 -f S32_LE --channels 2 /dev/zero

3.2.2-OpenSSL-Avahi-ALSA-sysconfdir:/etc
Linux bananapi 3.4.112-BPI-M1-Kernel

alsa-info:
http://www.alsa-project.org/db/?f=0c5dd0d97e994d0fe90a209b7d89395ea450c7c1

fixed in development branch

All 7 comments

Thanks for the post. This happens with some other DACs also, notably with many of the I2S-driven DACs. In those DACs, the popping is not caused by opening and closing the DAC driver so much as with starting (and stopping) the output of a sequence of samples. Therefore, simply keeping the driver open will not fix it. AFAICT the only reliable way to suppress the pops would be to ensure a continuous flow of samples, whether Shairport Sync has material to play or not. This will be a very tricky thing to do, but now that Shairport Sync is a lot more stable, it's something to look at.

Okay, so I made some progress with this, I think, with a little more to do.

I've pushed an update into the unstable branch with some ideas for dealing with this problem. I've tested it on a pHAT DAC running into a decent power amplifier.

On my listening rig, it makes a very big difference, so thanks for the prompt! If you could try it out, I'd be very interested in your experience.

There is a new setting in the shairport-sync.conf configuration file, which will be in /etc or in /usr/local/etc depending on how you set Shairport Sync ("SPS") up. The setting is in the alsa group and it's called disable_standby_mode. (You can see it in the shairport-sync.conf.sample file if you do a full $ sudo make install.)

The new setting defaults to "no" for compatibility with existing setups, but if set to "yes", upon restart, SPS will open the DAC at startup and will keep it running continuously, inserting silent frames when necessary.

It does mean, unfortunately, that the DAC will be unavailable for any other output program. Also, the silent frames are not dithered, so you can hear when the transition occurs from the undithered silence provided here and the dithered silence of a typical silent track. So that will have to be fixed. I also think that there is something wrong with the dithering code in SPS -- it doesn't sound enough like white noise -- but that's something to look at later. In any case, SPS only adds dither if the DAC doesn't have a hardware mixer.

It helps. No click and pops. Amazing! 🎉

Great, thanks. I'll tidy it up a bit before putting it on the development branch. The name and functionality of the setting might change.

Just cleaned up the dithering stuff and pushed it into the development branch. If your DAC can do 32-bit, it's worth trying it out.

3.3d40 (70cd4fe) from development branch runs smooth using S32_LE format (as far as I know Focusrite Scarlett 2i2 doesn't have any other).

Closing this issue – thanks for the prompting.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bangelischan picture bangelischan  Â·  9Comments

ContraVarus picture ContraVarus  Â·  7Comments

jeong840 picture jeong840  Â·  3Comments

vasilisvg picture vasilisvg  Â·  8Comments

moonwatcher picture moonwatcher  Â·  3Comments