Pimoroni's pulseaudio config?

I was just looking through Pimoroni’s pulseaudio installer (which is part of the installation for Speaker pHAT). Is there any repo where this installer lives and / or where the reasoning behind it is explained?

My understanding is that, on a high level, it’s doing these things:

  1. Purges and reinstalls pulseaudio (to get original config files)
  2. Creates /etc/systemd/system/pulseaudio.service
  3. Patches /etc/pulse/client.conf
  4. Patches /etc/pulse/default.pa

The patches specifically seem to:

  1. Set pulseaudio as a service running in system mode. This seems discouraged by the pulseaudio team, but I’m guessing the idea is to save resources?
  2. Enables local socket /tmp/pulseaudio.socket - I’m guessing to make system mode work.
  3. Enables a TCP socket that only accepts local connections - I don’t really understand why this is needed?
  4. Enables pivumeter if available.
  5. Sets a timeout for module-suspend-on-idle.

Is my understanding here correct? What’s the reason for enabling TCP and, for that matter, system mode in the first place?

This is to place an always-on Pulse Audio between the audio source and ALSA, having the effect of keeping the ALSA sink constantly running and avoiding any weird conditions on the i2s bus. It’s to eliminate most of the “pop” effects caused by opening/closing the audio stream, and also to prevent an overheating issue caused by the weird state in which the Pi leaves the i2s bus under some conditions. We’re rolling out hardware tweaks to mitigate this same issue, but for the time being software is the only way to be sure.

The - long - timeout for module-suspend-on-idle will cause Pulse to keep the ALSA sink open, playing “silence”, and running the i2s clock and LRclock (frame clock). Without it, ALSA can end up in a situation where it runs the i2s clock but not the LRclock and the DAC chip we use doesn’t like that.

There’s no public reasoning for this- apart from the chronicle of its creation on these very forums.

I’ve experimented with this a bit and wrote this guide as a “minimal” setup for Speaker pHAT, so leaving it here if anyone’s interested: Setting up Speaker pHAT or pHAT DAC with pulseaudio

In short, it just installs pulse, enabled hifiberry and runs pulse as system service. I also added instructions on how to forward sound from another system through pulseaudio.

1 Like