The problem#
Recently I ran a game1 and instead of the expected music, got distorted noise. At first I thought there was something physically wrong with my speakers or the connection to them, but running any other program resulted in normal sound, albeit mixed with the distorted sound of the game. Even more strangely, changing the volume in the game changed the volume of the distorted noise, implying the game was in fact generating the right thing but it was being misinterpreted, so the culprit was neither the game nor the sound driver but somewhere in between them.
As I had recently set up PulseAudio2, I suspected it was
to blame. I opened up pavucontrol
to find the game
omitted from the list of applications producing sound, which suggested
the problem was caused by the game trying to use some way to produce
sound that PulseAudio was not capturing.
The solution#
The short version is that the problem was solved by restarting PulseAudio:
$ killall -9 pulseaudio