snapcast icon indicating copy to clipboard operation
snapcast copied to clipboard

Add Plexamp support for audio playback

Open chicco-carone opened this issue 8 months ago • 14 comments

I've stopped using Spotify as my music player to use plex with the plexamp app and it would be great to be able to play back from that one. I know that plexamp has a headless version too so probably I can capture the audio from that and redirect it into Snapcast but a native implementation would be great

chicco-carone avatar Oct 13 '23 20:10 chicco-carone

This would be awesome! Just set up a mopidy server with snapcast and plexamp as well. Mopidy streams fine, but has issues loading my large plex library - so streaming plexamp directly through snapserver (without going through mopidy) would be fantastic.

prankousky avatar Mar 20 '24 07:03 prankousky

This would be awesome! Just set up a mopidy server with snapcast and plexamp as well. Mopidy streams fine, but has issues loading my large plex library - so streaming plexamp directly through snapserver (without going through mopidy) would be fantastic.

Yea i wanted to set up mopidy with iris to have a nice webui but i couldn't find a way to connect plex to mopidy so i ended up using a vm with the desktop plexamp client and snapserver

chicco-carone avatar Mar 20 '24 08:03 chicco-carone

+1 for this issue

EDIT: @chicco-carone on an unrelated note, how did you integrate the two? Looking to switch over to Plexamp soon and can't figure out a FIFO pipe from anatosun/plexamp-docker

kerta1n avatar Apr 15 '24 01:04 kerta1n

+1 for this issue

EDIT: @chicco-carone on an unrelated note, how did you integrate the two? Looking to switch over to Plexamp soon and can't figure out a FIFO pipe from anatosun/plexamp-docker

For me since I don't have a Plex pass I have a VM in proxmox without audio so there is only a loopback and it captures the audio from the standard client via Alsa. For Plexamp I think that you can pass into the container /dev/snd which should give it access to Alsa and then also in the docker container for snapserver or the native package capture the default Alsa playback device

chicco-carone avatar Apr 15 '24 05:04 chicco-carone

@kerta1n I just found a method that should work for a FIFO from Plexamp. In both pipewire and pulseaudio there is a way to transform a normal output into a Fifo that snapcast can read so you can add a script that creates the Fifo when you launch the container and then use a volume to pass it to the host and then mount the same volume for the snapserver container.

chicco-carone avatar Apr 21 '24 13:04 chicco-carone

Something to note though, UNRAID has no alsa support. I'll have to go try to compile something

kerta1n avatar Apr 21 '24 21:04 kerta1n

Use music assistant and connect it to Plex

DerPicknicker avatar Apr 25 '24 19:04 DerPicknicker

Use music assistant and connect it to Plex

Currently doing this. Unfortunately, while Plexamp is very quick (using regular plex app and chosing plexamp player), Music Assistant takes ages to find library updates and searching it is nowhere near as quick as in plex itself.

I needed two Plex connections in Music Assistant because music and audiobooks are two different libraries. Music is 10655 tracks, audio books 39836 tracks.

So workflow if plexamp was possible: open plex on phone, chose plexamp player, find track, play.

Music assistant: open home assistant app, go to music assistant tab, find track, chose desired output to play, play.

While this is a valid solution and works fine, it would still be nice if there was a way to "natively" do it through snap.

@chicco-carone do you have a script like this that you would share with us? I'm sure it's possible to rtfm and create an individual one, but if there was a solution already, it'd be better for spaghetti coders such as myself.

prankousky avatar Apr 26 '24 04:04 prankousky

You could Add the MA to your homescreen. That safes some time or you use MA for Music and not Plex.

DerPicknicker avatar Apr 26 '24 05:04 DerPicknicker

Use music assistant and connect it to Plex

Currently doing this. Unfortunately, while Plexamp is very quick (using regular plex app and chosing plexamp player), Music Assistant takes ages to find library updates and searching it is nowhere near as quick as in plex itself.

I needed two Plex connections in Music Assistant because music and audiobooks are two different libraries. Music is 10655 tracks, audio books 39836 tracks.

So workflow if plexamp was possible: open plex on phone, chose plexamp player, find track, play.

Music assistant: open home assistant app, go to music assistant tab, find track, chose desired output to play, play.

While this is a valid solution and works fine, it would still be nice if there was a way to "natively" do it through snap.

@chicco-carone do you have a script like this that you would share with us? I'm sure it's possible to rtfm and create an individual one, but if there was a solution already, it'd be better for spaghetti coders such as myself.

This is my current workflow. I have a vm with the normal plexamp client (works with plexamp headless too but i don't have a plex pass) that i can control remotely from another plexamp instance from my phone or pc, i have the snapserver on the same machine configured to capture the fifo /tmp/snapfifo. i use pipewire as the audio for my vm and use this command which creates an output that redirects everything into the fifo for snapcast. pactl load-module module-pipe-sink file=/tmp/snapfifo sink_name=Snapcast format=s16le rate=48000 About the script i'm currently developing a gui for snapcast which supports running a command before and after running the server so i just put that command there and autostart the program and plexamp which sets up everything by itself

chicco-carone avatar Apr 26 '24 18:04 chicco-carone

In case sombody is interested, this is my setup now: PlexServer ----> multiple Docker instances of PlexAmp ----> Alsa Loopback ----> Snapcast This way I can recreate the Sonos feeling a bit, where my wife and I shared the same system, but were listening to different streams. So now each can cast to his/her Plexamp instance and connect via Snapcast whatever player we wish. The PlexServer has its own VM, the rest runs on another VM. All on Proxmox.

chrihuc avatar May 14 '24 10:05 chrihuc

In case sombody is interested, this is my setup now: PlexServer ----> multiple Docker instances of PlexAmp ----> Alsa Loopback ----> Snapcast This way I can recreate the Sonos feeling a bit, where my wife and I shared the same system, but were listening to different streams. So now each can cast to his/her Plexamp instance and connect via Snapcast whatever player we wish. The PlexServer has its own VM, the rest runs on another VM. All on Proxmox.

What guide did you use to setup your Alsa loopback

kerta1n avatar May 14 '24 12:05 kerta1n

In case sombody is interested, this is my setup now: PlexServer ----> multiple Docker instances of PlexAmp ----> Alsa Loopback ----> Snapcast This way I can recreate the Sonos feeling a bit, where my wife and I shared the same system, but were listening to different streams. So now each can cast to his/her Plexamp instance and connect via Snapcast whatever player we wish. The PlexServer has its own VM, the rest runs on another VM. All on Proxmox.

What guide did you use to setup your Alsa loopback

If you have a system without any sound card (like a VM) there is a default loopback one that gets created and you can then capture it with alsa by using the default option in snapcast. If you need to create it there is the snd-aloop kernel module that you can activate or create with pipewire a fifo that snapcast can capture and then point your music source to playback into it

chicco-carone avatar May 14 '24 12:05 chicco-carone

I used the trial and error howto ;) In the end I found that you need to create one dummy interface and then with the snd-aloop kernel module.

In /etc/modprobe.d/alsa-base.conf I added: options snd-aloop enable=1,1,1,1,1 index=10,11,12,13,14 id=plex1,plex2,plex3,plex4,plex5

and in /etc/modules-load.d/snd_aloop.conf snd_aloop

This gives me 5 loopback devices on the start, unfortunately I haven't found a way to give them proper names for Plexamp.

In snapserver.conf I configured them like: source = alsa:///?name=Christoph&device=hw:10,1,0

chrihuc avatar May 14 '24 13:05 chrihuc