Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Plexamp support for audio playback #1165

Open
chicco-carone opened this issue Oct 13, 2023 · 14 comments
Open

Add Plexamp support for audio playback #1165

chicco-carone opened this issue Oct 13, 2023 · 14 comments

Comments

@chicco-carone
Copy link

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 chicco-carone changed the title Add Plex support for audio Add Plexamp support for audio playback Oct 14, 2023
@prankousky
Copy link

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.

@chicco-carone
Copy link
Author

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

@kerta1n
Copy link

kerta1n commented Apr 15, 2024

+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

@chicco-carone
Copy link
Author

+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
Copy link
Author

@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.

@kerta1n
Copy link

kerta1n commented Apr 21, 2024

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

@DerPicknicker
Copy link

Use music assistant and connect it to Plex

@prankousky
Copy link

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.

@DerPicknicker
Copy link

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

@chicco-carone
Copy link
Author

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

@chrihuc
Copy link

chrihuc commented May 14, 2024

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.

@kerta1n
Copy link

kerta1n commented May 14, 2024

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

@chicco-carone
Copy link
Author

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

@chrihuc
Copy link

chrihuc commented May 14, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants