Plexamp on Raspberry PI playback pauses after changing tracks

After changing a couple of tracks/titles when casting, the playback sometimes stops and resumes after a second or so. This happens on both a Rasberry Pi 3b+ and 4. Sample rate matching is set to ‘Strict’ and I’m using a DAC connected via USB. Clearing the cache from the web interface seems to resolve this issue, but it is very annoying.

Almost certainly a caching/buffering/network issue, and/or related to changing sample rates on the DAC. Without Plexamp logs, we’ll all be guessing.

FWIW, it’s not normal or expected behavior.

See attached the Raspberry Pi log file.
Pausing problems occurred from 21:54 hrs onwards and cache (via webinterface) was deleted on 22:09hrs.
Plexamp.1.log.zip (95.6 KB)

It looks like Dire Straits - Private Investigations ran into some underflows, which would have resulted in pauses in audio.

Almost certainly means network wasn’t fast enough, or some combination of that, slow SD card and high bit-rate audio. People also have had luck with reducing the number of tracks to cache ahead, and limiting the network bandwidth (both of these in Plexamp settings).

Many people have managed to play high bitrate FLAC successfully, so it’s not an inherent issue with the app.

Thanks for looking into that. The problem was not with Dire straits - Private investigations, but exactly at Dec 27, 2023 21:54:00. There is a lot of activity at that time in the log; perhaps this has something to do with the pausing?
FWIW, the raspberry pi is wired connected via an 100mbs switch and the plexamp cache is limited to 256MB/next song only.

There’s nothing that indicates Plexamp was aware of the pausing at that time, which makes me suspect that it may have to do with your audio interface instead. Also possibly slow SD card, but these are just guesses.

Eliminate variables until you discover the root cause.

I think I solved this by creating a symlink for the cache directory to a ramdisk (on a RPI 4 with 2 GB ram).
Edit the /etc/fstab file →
sudo nano /etc/fstab

Add the following line to /etc/fstab →
tmpfs /home/pi/Library tmpfs defaults,size=1024M,uid=1000,gid=1000 0 0

Use CTRL+X to save the file & reboot

(please set the cache to 256MB max and only to the next song)

Edit: 512MB was not enough, still skipping/buffering :frowning: The cache directory keeps on growing beyond the 512MB limit (the log shows ERROR - Cache: Error writing to cache), which is strange because the cache limit is set to 256MB. I will try 1024MB to see if this works…

Edit2: That didn’t work. Cache directory keeps growing, so I decided to delete the cache every minute by a crontab job →
crontab -e

Add the following line:
/1 * * * * rm ~/Library/Caches/Media/

PS. Found out in an old post and by testing that the move to NodeJS v20 results in performance issues on raspberry pi 3 and 4 when playing high-res files (flac 24bit 192khz and higher). This results in stuttering, and network bandwidth issues. This can be solved by reverting back to nodejs v16 and plexamp v4.9.5.

To to this, you can use the followoing instructions when you’re on nodejes v20 and plexamp v4.10 or later:

  1. Switch to older nodejs version
    see How to Switch to an Older Version of Node.js

Install nvm →
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash

Exit terminal and reopen

Install and use the desired Node.js version →
nvm install 16.20.2
nvm use 16.20.2

  1. Install plexamp v4.9.5
    See Install Headless Plexamp for your Raspberry Pi to create a Plex endpoint | How To Hi-Fi

curl https://plexamp.plex.tv/headless/Plexamp-Linux-headless-v4.9.5.tar.bz2 > plexamp.tar.bz2
tar -xvf plexamp.tar.bz2
sudo nano plexamp/plexamp.service

Change line ExecStart=/usr/bin/node /home/pi/plexamp/js/index.js to —>
ExecStart=/home/pi/.nvm/versions/node/v16.20.2/bin/node /home/pi/plexamp/js/index.js

sudo systemctl disable plexamp
cd plexamp
sudo cp plexamp.service /lib/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable plexamp
sudo systemctl start plexamp

  1. Optional: change motd
    sudo nano /etc/update-motd.d/20-logo

sudo reboot

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.