Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Plexamp Headless on Moode 9+
#1
Greetings,

With a new major Moode version along with a recent major Plexamp Headless update now based on node.js 20 I think it's time for an updated guide showing how to get Plexamp Headless running on your Moode player.
There are numerous poorly written guides out there that tend to make the process seem more complicated than it is, this is compounded by the fact that Plex actually don't provide a concise install guide themselves, I hope to show that it's actually a simple process.

To get Plexamp Headless running on Moode we have 5 steps...
1. Download and install node.js 20
2. Download and install Plexamp Headless
3. Run and login Plexamp Headless (Plex Pass subscription required)
4. Create and start the Plexamp Headless systemd service
5. Configure Plexamp's audio settings

To prep, open a web browser and login to your Plex account at plex.tv
   

Next login to your Pi with the moode user account and password via SSH or via Moode's built-in Web SSH client under the Moode menu > Configure > System > Security.
   
   

The 'moode' account password is what you will have set with the Raspberry Pi imager when flashing your Pi's SD card.
Note: If you created a username different to the default 'moode' when installing Moode with the Raspberry Pi imager use that username going forward.


Let's begin;

1. Download and install node.js 20
As shown on https://deb.nodesource.com we run the project's script to setup the node.js 20 apt repository then install the nodejs package.
Code:
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash -
   

Code:
sudo apt-get install -y nodejs
   

2. Download and install Plexamp Headless 4.10.1
The latest version of Plexamp Headless for Raspberry Pi can be found at plex.tv. Do a quick check to see the latest version you should be downloading.
At time of writing the current version is 14.10.1 which requires node.js 20 that we've just installed.
Run the following to download Plexamp Headless v14.10.1
Code:
wget https://plexamp.plex.tv/headless/Plexamp-Linux-headless-v4.10.1.tar.bz2
   

Unpack the archive
Code:
tar xjf Plexamp-Linux-headless-v4.10.1.tar.bz2


3. Run Plexamp Headless and authenticate with Plex
Code:
node plexamp/js/index.js
   
This prompts for a claim code...

In a web browser navigate to https://plex.tv/claim and copy the claim code presented.
   

Paste the claim code into your Terminal window.
Hit Enter then enter a name your player at the prompt.
   
.. so long as the last line says "Plexamp is now signed in and ready!" all is OK, plexamp exits here.

4. Create and start the Plexamp Headless systemd service
If your Moode account username is the default 'moode' or simply not 'pi', edit the file plexamp/plexamp.service with a text editor such as 'nano' and change the user 'pi' on lines...
'User=pi',
'WorkingDirectory=/home/pi/plexamp'
'ExecStart=/usr/bin/node /home/pi/plexamp/js/index.js'
... to moode's user

e.g.
Code:
nano plexamp/plexamp.service
   
   

Save the file (Ctrl+o, Enter in nano) and exit (Ctrl+x in nano).

Setup the service to start now and at boot time;
Code:
sudo cp plexamp/plexamp.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now plexamp
   


5. Configure Plexamp's audio settings
Launch the Plexamp Headless web ui in your browser by going to the Pi's hostname or IP address, port 32500 (e.g. http://moode.local:32500)
   

Amongst the personal settings you will no doubt want to change, firstly we should make the following changes;
Navigate to Settings > Playback
  • Navigate to Settings > Playback > Audio Output > Audio Device and pick preferred audio output device
  • Navigate to Settings > Playback > Audio Output > Sample Rate Matching and set to Smart
  • Set Settings > Playback > Loudness Leveling to Off
  • Set Settings > Playback > Sweet Fades to Off
  • Set Settings > Playback > Limiter to Off
The audio output sample rate matching is important as this will ensure that Plexamp will let go of the audio device when playback has stopped, allowing Moode's mpd and other renderers to play when Plexamp isn't playing.
The rest ensures the PCM being sent to your DAC is as native as it can be.

You will now be able to use Moode as usual and also see your Pi as a Plexamp player in a Plex or Plexamp client/app which you can play your Plex or Tidal library to.


Enjoy
Reply
#2
It might be a good idea to integrate this as a "Renderer". It looks like everything except possibly the claim code process could just be baked in.

Does the tarball contain a license file for the program?
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
Hi @Tim Curtis 

Nice idea, they do include the licenses for the node modules they include in the tarball but according to line one in their main js, js/index.js it seems they've forgotten to add their own license file Smile

Code:
/*! For license information please see index.js.LICENSE.txt */

.. which doesn't exist in the tarball.

Being a paying customer I might raise it with em and see if they have any interest in easing integration with your project, can only ask eh?
Would have a bit of a concern of course with the potential of Plexamp Headless interfering with the default audio device with it's default settings but I wonder if this can be automated/customised in some way.

You might remember we did a similar thing with the Roon renderer a while back and I see that has fallen off Moode as a feature now, tbh I got pretty jaded with Roon, it's way too expensive for what it is, the server is glitchy, poorly written software and the client UI is not what a lot of audio aficionados make it out to be.
I landed on Plex as the server-side is way more efficient and runs on ARM, it does a lot of what Roon does musically with personal library & Tidal integration, better search & suggestions (minus the rich biographies), it does video and live TV so integrates with my HiFi and the home theatre, does remote streaming and video/audio transcoding... and it's cheaper!
Reply
#4
Actually Roon is still there in Renderers but not visible unless it's actually installed. I'm going to fix that so it's visible on the Renderers page but grayed out unless installed. It would be same for PlexAmp unless it can be freely redistributed in which case it would appear, ready to use.

The license should indicate whether the program itself could be bundled and freely redistributed with other software. Everything else including nodejs, renderer page entry, plumbing to start/stop, etc can be included with moode, no prob.

If it has a config file that can be edited to specify the audio device then that it can just be auto-edited to use the audio device specified on Audio Config. It can prolly also use any of the DSP's including Camilla.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#5
@Tim Curtis is free to distribute enough for moode inclusion in the image?
I always thought that moode was always foss oriented, which also requires source to be available.
Reply
#6
(06-02-2024, 01:25 PM)bitlab Wrote: @Tim Curtis is free to distribute enough for moode inclusion in the image?
I always thought that moode was always foss oriented, which also requires source to be available.

No, definitely cannot bundle and redistribute the plexamp code unless it's got a FOSS compliant license which apparently it does not. Its same with roonbridge.

All I can to do is add basic config plumbing as is done for roonbridge. If user installs plexamp on their own then it will get treated as a renderer with Service on/off, Resume MPD and Restart buttons on Renderer Config.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#7
Here's a mockup of Renderer Config with Plexamp settings

   

Assume nodejs is installed, the systemd service file is there and code to change the default user id in the file to the actual userid happens during moode startup. With these in place only steps 2, 3, and 5 are needed in the Guide.

@vinnn, Some questions about Plexamp and nodejs run state

1. What method can be used to determine whether Plexamp is running or not?
For example pgrep <executable_name>

2. How to start/stop nodejs itself?
We don't want this running by default unless its actually going to be used.

ETA: 3. How to determine the version of Plexamp?
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#8
(06-03-2024, 12:35 PM)Tim Curtis Wrote: Here's a mockup of Renderer Config with Plexamp settings



Assume nodejs is installed, the systemd service file is there and code to change the default user id in the file to the actual userid happens during moode startup. With these in place only steps 2, 3, and 5 are needed in the Guide.

@vinnn, Some questions about Plexamp and nodejs run state

1. What method can be used to determine whether Plexamp is running or not?
For example pgrep <executable_name>

2. How to start/stop nodejs itself?
We don't want this running by default unless its actually going to be used.

ETA: 3. How to determine the version of Plexamp?

Nvm,

I managed to figure it out. The plumbing is committed and seems to work ok. I'll just go ahead and make a short help guide and then testing can happen in the field after 9.0.2 is released.

The other option is to do a local build yourself if you are familiar with using the build tooling etc.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#9
(06-06-2024, 10:49 AM)Tim Curtis Wrote: Nvm,

I managed to figure it out. The plumbing is committed and seems to work ok. I'll just go ahead and make a short help guide and then testing can happen in the field after 9.0.2 is released.

The other option is to do a local build yourself if you are familiar with using the build tooling etc.

Thanks Tim for the integration of this new render!
I will migrate to Moode 9 quickly to test this feature.
Reply
#10
I was highly interested in being able to use my plexamp client to stream music to moode.
Over the years, I used to use a simple solution called plexdlnaplayer to bridge my plexamp client to moode's UPNP renderer.

So I haven't touched a headless plexamp installation in quite some time. 

My question now is:

- do you actually need plexamp headless? I mean does it add any additional features or do we simply need the option to stream from a plexamp client?
- how much overhead does plexamp headless add?

I'm asking these questions because a solution like I described above is simpler, its only a tiny, tiny docker container or app (depending on your preferred usage) which bridges plexamp client of UPNP. There are no licensing problems and no distribution problems.

Anyway, I am really happy to see work happening on integrating plexamp clients with moode.
Listening with the latest moOde on a RPI zero w with a MiniBoss DAC PCM5122 32bit 384kHz and a Volt+ AMP on a pair of Monitor Audio Bronze 100 speakers.

pi@moody:~ $ moodeutl -m 
CPU: 1.0 GHz, LOAD: 35% 47C | MEM: 63% used | DISK: 39% used, 4.1G free | PHP: 7 workers
Reply


Forum Jump: