[mythtv-users] Upgrade from 18.04 to 20.04 - pulseaudio

DaveD mythtv at guiplot.com
Sun Oct 18 17:24:20 UTC 2020

On 10/18/20 5:53 AM, Stephen Worthington wrote:
> I have now upgraded two of my four MythTV PCs from Xubuntu 18.04 to
> 20.04.  I have not had any major problems so far, but on my main
> MythTV system an old annoying minor problem came back again.  This is
> where at random times during the day my Alsa S/PDIF output on the
> motherboard sound card gets muted.  I first had this with 18.04 and
> eventually tracked it down to be a problem with pulseaudio, which I
> solved by disabling pulseaudio by following some instructions about
> how to modify its config files.  With the upgrade to 20.04, those
> modified files must have been overwritten and pulseaudio was running
> again, and exhibiting the same bug.  So this time I thought I would
> track down where pulseaudio was being run from and disable it that
> way.
> It turns out that since 18.04 or maybe a little before that,
> pulseaudio has been being run as a systemd user job, so that it gets
> run once per user (not per session) under the userid of the user
> running the desktop.  You can see its status and journal with these
> commands, run from the desktop user without sudo:
> .....

For years (and many upgrades) I fought against pulseaudio and its overly 
complex configuration and the way the distros integrate it into 
everything, its tentacles invading every aspect of my system and apps 
depending on it and packages breaking without it, etc, etc.  I, too, use 
SPDIF passthrough to my receiver which complicates things immensely 
since that seems to be an atypical (but optimum) configuration, ignored 
by many default configurations and settings.

Then I discovered whole-house audio.  I have my main system in the 
living room, hosting all of our media, including surround sound;  the 
heart of our network.  Then there's the remote frontend/slave backend in 
the bedroom with small but very high quality speakers, the laptop in the 
office with its own receiver and decent speakers, the frontend in the 
dining/kitchen area with decent speakers and the system in the 
garage/patio, also a frontend with its own receiver/speakers.  All of 
them are GB wired network and can play MythTV live TV and recordings, 
but the coup de grace is their ability to play CD quality audio served 
by the main server in the living room (which doesn't necessarily need to 
be playing the same audio) in absolutely perfect sync and all have the 
ability to control the whole system, including the 
volume/playlist/playback of the whole system or any of the individual 
systems.  I don't have my phone playing the audio (yet) but I have the 
same control over volume/playback.  It's more than I had hoped for when 
I began the project, and it's all possible thanks to pulseaudio.

mythfrontend is able to start multiple instances of itself and double 
button presses on the remote would result in two (or more!) instances 
running and competing for the display and sound. Results were odd, at 
best, so I long ago wrote a script for starting it up that first checks 
for a running instance and, if found, kills it first (in case it's not 
visible for some reason). It handles a few other things that I've added 
over the years, including this:

pactl suspend-sink alsa_output.pci-0000_00_1f.3.iec958-stereo yes

and, after mythfrontend exits

pactl suspend-sink alsa_output.pci-0000_00_1f.3.iec958-stereo no

There may be more elegant ways (and may not even be necessary with 
current versions), but this works and has survived many upgrades.

Since giving in and embracing pulse, I have learned that in spite of its 
complexity, it provides a great deal of functionality and is worth 
learning how to work with.  It's not really much more work than figuring 
out how to remove or disable it with every new upgrade.

Dave D.

More information about the mythtv-users mailing list