How to get audio passthough working with Manjaro and Plex Media Player?

I came across an interesting problem when trying to get audio passthough though S/PDIF working correctly on Linux.
There’s like almost no working instructions that I could find, so I’m going to do those here.

Requirements

  • Manjaro system, the only one tested
  • KDE/Plasma Desktop
  • Confident using CLI
  • Audiosystem connected though S/PDIF connector which supports decoding

Basically, you’ll need to let the application OWN the entire audio system, for the time you’re using that particular application which means that you cannot use Spotify at the same time for example.

I was not able to get it work with the pulseaudio settings on the desktop, so I just killed the process with the following commands:

systemctl --user mask pulseaudio.socket
systemctl --user stop pulseaudio

No need to use sudo.

After that, you’ll have no working audio in your system, but that’s fine as you’ll be dedicating and forcing the app to use pulse backend, which is pretty old but works.

The command to get Plex Media Player launched with pulse backend, you need to do the following (Fish shell):

env AE_SINK=ALSA plexmediaplayer

The bash way to do the same:

AE_SINK=ALSA plexmediaplayer

Now your audio should be attached to Plex Player, so any other app is unable to use it. Keep that in mind. You need to set up S/PDIF device to use in Plex settings, and it should work.

To restore pulseaudio, the following commands need to be executed:

systemctl --user unmask pulseaudio.socket
systemctl --user start pulseaudio

Please let me know if you have troubles or if you found this useful in any way or form. I had my share of hard time trying to get the information required.

Helpful resources: https://www.reddit.com/r/archlinux/comments/6dutqp/alsa_jack_pulseaudio_driving_me_insane/
Kodi Wiki
https://wiki.archlinux.org/index.php/PulseAudio


© 2018-2021 Skyler Mäntysaari