My ultimate guide to the Raspberry pi audio server I wanted — Perfomance improvements

Mathieu Réquillart
2 min readApr 30, 2021

--

This schema below is the setup exactly as explained in this guide, but it’s not the one I use today. I had to make a few changes to the initial setup I had in mind because of performances issues.

I had audio cracks and lags with Spotify Connect, MPD, and DLNA of course since UpMPDcli uses MPD as backend, especially at the beginning or end of songs. So I monitored the Pi with htop as I was using it and noticed the pi had a high load average, above 1, because the CPU often reached 100% usage, which meant the Pi wasn’t fast enough to perform all calculations in time to render audio, which is something you really don’t want when dealing with Hi-Fi.

I noticed Pulsaudio and LibreSpot used a lot of CPU while running, around 40% each. But there wasn’t much I could do about it at that time (160kbps with Spotify is poor quality enough). I tried to increasing Pulseaudio and MPD priority in the kernel, which improved things without solving my problem completely. Overclocking the Pi did not help either.

But I also noticed something I could act on : the main MPD instance, unlike the USB one, maintained a CPU usage around 15% when it was supposedly idle and even higher in use, so I concluded it was the satelitte connexion with the NAS MPD which was causing this overload. So I dumped the MPD satellite instance on the Pi and MPD CPU usage dropped significantly, especially when idle : 0%.

I already had the MPD database on my NAS since the satellite mode of the Pi relied on its database so I set the Raspberry PulseAudio sink as MPD audio output on the NAS. Then I just had to replace the Pi address IP by the NAS one in M.A.L.P. and ympd to be able to browse music from MPD on the NAS and play it on the Pi.

Since then, LibreSpot had dropped to 30% and Pulseaudio 10%. I’m not sure it was Pulseaudio and LibreSpot updates which caused this or a DAC driver update, or maybe both, but I’m really happy about it because I could improve Spotify quality to 320kpbs thanks to it.

It was really a win-win since I improved the performance of the Pi, lags and cracks disappeared, without losing any feature in my setup, and the Pi became completely independant from the NAS which makes more sense in my opinion.

--

--

No responses yet