PulseAudio

1.0 Introduction

PulseAudio is a fairly complex and potentially abstruse feature of most Linux distros (including when running under Windows Subsystem for Linux) and macOS. You can read about it at exhaustive length here, but the really high-level overview is this: PulseAudio is to audio what X is to video. Allow me to explain!

An application wants to draw its main program window on a screen, so you can interact with it. Using the X Server technology, the application is an “X Client”: it wants to draw itself. To do so, it must find an “X Server”: a PC which happens to have a monitor or screen attached, on which things can be drawn. Most commonly, the X client and server run on the same PC: so you click the Calc icon and LibreOffice Calc launches and draws its main screen on the same PC where you clicked the launch icon. From the outset, however, the X developers recognised that wouldn't always be true: if you're sat at a weedy Raspberry Pi 3, you really don't want LibreOffice laboriously launching itself on that feeble computer. You'll be there 'till Christmas! No: ssh to a really powerful PC running in your home server room under the stairs and have Calc run on that server… but pass its interface drawing instructions to your Pi desktop. The X client is the machine under the stairs, powerful and capable; the X server is your Raspberry Pi, able to draw things on a monitor but not much else. In this way, X made wanting to draw and being able to draw separate things that can be separated over a network connection: you can interact with a thin-client Pi, but the powerful PC under the stairs can be doing all the calculating and computational heavy lifting.

Well: PulseAudio is the same, but for audio. Your PulseAudio client is a program that wants to output audio; the PulseAudio Server is a computer that has a set of loudspeakers attached, able to 'sound' that audio. Generally, we expect client and server to be running on the same physical PC, but the protocol was invented to allow the client and the server to be entirely separate machines, communicating over a network.

Giocoso can use PulseAudio. It's a lightweight program, but it has to do quite a bit of computation and processing to generate an audio stream: that requires a reasonably capable PC. To 'sound' that audio stream, however, only requires a weak and feeble computer that happens to be attached to some sort of loudspeaker output (or headphone or bluetooth output, etc.) Thus, the machine on which Giocoso runs will be a PulseAudio client and the machine which makes the audio stream physically audible will be the PulseAudio server …and those could be two completely separate computing devices.

What's more, a single PulseAudio client could direct its output to multiple PulseAudio servers. Think of a decent PC running under the stairs that is able to output music to a feeble Raspberry Pi running in your conservatory one minute, your kitchen the next, your bedroom sometime later that evening and your main listening room during the afternoon. Without PulseAudio, your conservatory, kitchen, bedroom and listening room would all need their own hefty PCs, each running Giocoso. With PulseAudio, you set up one capable PC with Giocoso, once; you can then direct its audio output to small computing devices in each of those rooms as your needs arise. You'll still need speakers in each of those rooms, of course: audio doesn't manifest itself from nothing! But you could, for example, hook a Raspberry Pi up to a small Bluetooth speaker in each of the rooms, rather than a full-blown PC plus monitor plus keyboard plus amplifier plus speaker.

PulseAudio allows for computing devices to sound forth the audio stream: headless, keyboardless, small and discreet; the need for substantial computers with keyboard, mouse, monitor and speakers is eliminated (unless you want that sort of setup everywhere, of course).

In this article, I'll explain how I use a virtual Giocoso installation on a server hidden in the corners of my house to play music to any room I happen to be in: it all depends on PulseAudio!

[Under Construction]