For some years now, basically since Aimee became old enough to use a computer, I have had a need for decent multi-user sound. Specifically I would often have intricate work open in multiple work spaces on my desktop, and Aimee would want to do some artwork.
I guess Aimee was about two when she started using my computer a fair bit, and I immediately had a separate account for her with lower resolution graphics, easier menus, simple shortcuts and the like. I also had a graphics tablet for her, which she mastered very quickly. Another important reason to have a separate account was that if stuff got really badly messed up I could just nuke the account and start again, and she couldn’t really hurt my configuration.
As you would imagine, lots of the excellent free software for children, like GCompris, and Tuxpaint is very rich in its sound effects, and sometimes the sound is not just desirable, but essential for the activities. So a very annoying persistent problem has been that, once in a while, something in the sound stack in my login would stop Aimee’s sound from working.
Now I share my main PC with two other people, Tamsin and Aimee, and soon Matilda too, so this recurrent problem is more of an issue, it’s also very hard to nail down. Despite protests to the contrary the default ALSA setup still has this problem; ConsoleKit on its own doesn’t seem to get it quite right. I tried PulseAudio for a while, and generally it was an improvement, but the problem did still occur sometimes. I even made sure all the users were members of the right groups including pulse-rt.
Then I found this entry in the PulseAudio FAQ.
Sound doesn’t work when switching users
PulseAudio works with a single user, but when an additional user logs in (fast user switching), sound/audio does not work for the additional user.
Check that no users are part of the “audio” group.
In simple setups (e.g. singe user, without PulseAudio), users must be a member of the “audio” group to access the sound devices (/dev/snd/* (which have group “audio” write permissions)). Switching users will not automatically stop programs using those sound devices though, so those sound devices will not be accessible to a new (faster user switched) user’s programs.
By removing all users from the “audio” group (the PulseAudio server still runs in the “audio” group), PulseAudio is able manage access to sound devices (/dev/snd/*) amongst multiple users with the help of ConsoleKit.
It would never have occurred to me to remove the users from the audio group, but doing so seems to have solved the problem. I almost don’t want to say that, because every “solution” up to now has been partial, but so far no problems, so maybe this will be the fix.