Making a more reliable DiY streamer - unstable Spotify instance on Macbook running Ubuntu

Update: instead of Spotify GUI installation via snap, I have installed the Spotify GUI in Ubuntu via debian repository. This should work better than the snap. Let's observe this and I'll report back on here on its long term stability. For a while I tried hacking away at spotifyd and raspotify and others on this thread.
 
Last edited:
Yes. Most importantly
1. If possible install a RT linux kernel
realtime Linux Kernel - ?

EDIT:

2:
Theoretically rt means less performance. Generally for max performance you want max buffering and for rt you want zero buffering.
True. But Pipewire is where the buffer sizes are set. The only thing I'm changing is normal kernel vs the -rt kernel, which uses the PREEMPT_RT config.
I'm not talking about pipewire buffers, but about everything else too. If a system wants real time capabilities it should sacrifice any pipelining.
Hmm. I understand that in theory. But in practical performance terms there appears to be something wrong with the Debian -rt kernel config. I'm testing the Liquorix and Xanmod RT kernels with this exact same setup and they perform very well.

It is not that there is something wrong with the Debian real time kernel. You are comparing apples and oranges. Most of the tweaks to the two custom kernels that you were talking about don't have anything actually to do with real time settings anymore. They stick with the outdated naming because of how much information on the internet leads people astray to assuming that they need a real-time kernel in order to achieve low latency work.

Thanks, that actually does make sense according to my testing. When trying to push the limits even more of lowest latency + highest throughput this is what I found, ranked from best to worst (#4 and #5 are much worse):
  1. Xanmod (non-RT)
  2. Liquorix
  3. Debian standard
  4. Xanmod-rt
  5. Debian-rt

Exactly, the 2 that beat stock Debian are making the last few mods that haven't been applied to the standard kernel yet.
The primary reason these other mods haven't been applied is that they have either not been thoroughly tested enough to prove that they are safe for typical users, or if there are known issues, they are not easy to mitigate.
And, since the difference in performance is real but small, I am erring on the safe side and trusting the standard kernel :)


Yeah, I agree that those mods are probably not ideal for a general purpose kernel. The gains are minimal anyway, what really makes a huge difference is 1) Tweaking Pipewire or Jack for low latency (I strongly prefer Pipewire myself) and 2) many of the configurations recommended here.

I am using Pipewire's Virtual ALSA device because it allows me the most control while embracing the future (Pipewire) over the past (JACK).
I love everything that JACK enabled. I am truly grateful for the work the devs put into it. But, at this point, it makes sense to acknowledge that the future is Pipewire.
And, I agree. The rtcqs tweaks are the bomb!!


For me the best thing about Pipewire is its native integration of PulseAudio + JACK protocols. I used to spend an inordinate amount of time trying to bridge the two together with very hackish methods that were prone to failure, and JACK was hard to configure to the latency requirements. With Pipewire I just have to change a single quantum setting to get the low latency that I need, and apps that need PulseAudio just work together with the others that think they're using JACK.

I used Erick Eickmeyer's Ubuntu Studio Tools (now just StudioTools) to configure JACK+Pulse. I usually found that the .deb for the most recent Ubuntu LTS would work for Debian (sacrilege, I know).
I kept doing that until I was confident that I could reproduce my workflow in Pipewire directly. Discovering the Virtual ALSA devices were just icing on the cake.

Unfortunately, most of the online advice you will read about using real-time kernels for audio production are very outdated. Most of the tweaks that were important for low latency work, originally exclusive to real-time kernels, have been migrated to the mainstream kernels.
Real time does not equal low latency in general. The best uses for the remaining features exclusive to real-time kernels are not the ones that overlap with low latency applications.
Anyone who is being honest about their own actual evaluations will agree with the account that you have documented here.
 
Last edited:
true. You will not use RT kernel for doing multiple jobs. If you run multiple jobs, first few jobs will run in real time. Performance of new jobs fired will suffer because already one job is hogging the entire attention of the CPU. Use RT only if you are sure that you will run your hardware for just one job (e.g. just for audio and you will absolute not be using the computer for browsing, chatting, etc).
 
Will try in the future:


Features​



  • Headless music server OS
  • Bitperfect and gapless playback
  • Extensive audio format support
  • Native DSD playback up to DSD512
  • PCM resolutions up to 384kHz/24bit
  • High quality audio resampling including PCM to DSD conversion
  • Convolution filtering for DRC and equalizer
  • "Play from RAM" to minimize CPU load and disk activity during playback
  • Automatic audio device configuration with multiplayer support
  • CD ripping with AccurateRip™ verification, automatic metadata tagging and cover art
  • Supports external file servers as music source
  • Easy configuration and installation through the web interface
  • WiFi hotspot support (if compatible hardware exists)
  • Software update via web interface
  • Network-attached storage (NAS) service
  • Whole system included in about 200MB ISO-file

Daphile is based on the open source Squeezebox Server, Squeezelite and Linux.
Since Daphile is used and configured completely via the web interface the user is not required to have any Linux skills.




 
1. I like tweaking.
2. I enjoy digging into the engineering and how things work on the weekend.
3. I have a bunch of old hardware lying around that I don't want to throw out.
I have moved from Moode to Volumio and currently using GentooPlayer on RPI4. Can't be happy more. If you are going the RPI4 way, Try GentooPlayer as OS. They have a week of trial. Never liked WiiM mini, was not to my liking.
 
Update: Spotify is running more stable in Ubuntu Linux after I uninstalled the Snap version and installed the regular apt get install version. Thanks mbhangui
Update: had to restart the Spotify GUI on Ubuntu due to a non responsive event. First restart of the application in two weeks which is okay as per me.
Still looking for ways to make it - Spotify - more stable.
 
Picoreplayer is purpose built to run an audio server based on LMS. Been running it for several years, and am quite happy. Offers good potential for tinkering too. Think someone suggested it earlier, but it didn't seem to have gone anywhere
If it's something you considered and dropped, fair enough.
 
To enhance the stability of your Spotify streaming setup on your Ubuntu-running MacBook, you can take several steps:

1. Update and Upgrade Ubuntu:

  • While you've turned off automatic updates to prevent playback interruptions, it's essential to manually update your system periodically. Consider updating when it's convenient for you to ensure that you have the latest stability fixes and improvements.
bashCopy code
sudo apt update
sudo apt upgrade

2. Improve Internet Connection:

  • Fix the loose Ethernet plug or replace it with a more secure connection.
  • Consider using a wired connection instead of WiFi for a more stable network connection.

3. Optimize Spotify-GUI:

  • Ensure that Spotify-GUI is up to date. You can check for updates within the application or reinstall it with the latest version.
bashCopy code
sudo apt remove spotify-client
sudo apt install spotify-client

4. Manage Spotify Crashes:

  • To address Spotify instance failures, you may create a script that automatically restarts Spotify when it crashes. Create a script, for instance, named restart_spotify.sh:
bashCopy code
#!/bin/bash
while true; do
spotify
sleep 5s
done
Make it executable:
bashCopy code
chmod +x restart_spotify.sh
Run it in the background:
bashCopy code
./restart_spotify.sh &

5. Use a Dedicated Spotify Connect Device:

  • If the GUI continues to be problematic, consider using the Spotify Connect feature on a dedicated device like a Raspberry Pi or a spare computer. This way, your MacBook becomes solely a server, and your smartphone can control playback through Spotify Connect.

6. Address WiFi Issues:

  • If WiFi is more stable for you, consider prioritizing it over the unstable Ethernet connection. You can disable the Ethernet connection temporarily or configure the network manager to prefer WiFi.

7. Scheduled Updates:

  • Schedule system updates during periods when you're not actively using Spotify to avoid interruptions. Use the unattended-upgrades package to automate security updates.
bashCopy code
sudo apt install unattended-upgrades

8. Monitor System Logs:

  • Regularly check system logs (/var/log/syslog) for any errors related to Spotify or network issues. This can provide insights into the cause of interruptions.

9. Premium Support:

  • Contact Spotify support if issues persist, especially since you have a premium subscription. They might offer specific guidance or solutions tailored to your situation.
By implementing these steps, you should be able to create a more stable Spotify streaming solution on your Ubuntu MacBook.
 
To enhance the stability of your Spotify streaming setup on your Ubuntu-running MacBook, you can take several steps:

1. Update and Upgrade Ubuntu:

  • While you've turned off automatic updates to prevent playback interruptions, it's essential to manually update your system periodically. Consider updating when it's convenient for you to ensure that you have the latest stability fixes and improvements.
bashCopy code
sudo apt update
sudo apt upgrade

2. Improve Internet Connection:

  • Fix the loose Ethernet plug or replace it with a more secure connection.
  • Consider using a wired connection instead of WiFi for a more stable network connection.

3. Optimize Spotify-GUI:

  • Ensure that Spotify-GUI is up to date. You can check for updates within the application or reinstall it with the latest version.
bashCopy code
sudo apt remove spotify-client
sudo apt install spotify-client

4. Manage Spotify Crashes:

  • To address Spotify instance failures, you may create a script that automatically restarts Spotify when it crashes. Create a script, for instance, named restart_spotify.sh:
bashCopy code
#!/bin/bash
while true; do
spotify
sleep 5s
done
Make it executable:
bashCopy code
chmod +x restart_spotify.sh
Run it in the background:
bashCopy code
./restart_spotify.sh &

5. Use a Dedicated Spotify Connect Device:

  • If the GUI continues to be problematic, consider using the Spotify Connect feature on a dedicated device like a Raspberry Pi or a spare computer. This way, your MacBook becomes solely a server, and your smartphone can control playback through Spotify Connect.

6. Address WiFi Issues:

  • If WiFi is more stable for you, consider prioritizing it over the unstable Ethernet connection. You can disable the Ethernet connection temporarily or configure the network manager to prefer WiFi.

7. Scheduled Updates:

  • Schedule system updates during periods when you're not actively using Spotify to avoid interruptions. Use the unattended-upgrades package to automate security updates.
bashCopy code
sudo apt install unattended-upgrades

8. Monitor System Logs:

  • Regularly check system logs (/var/log/syslog) for any errors related to Spotify or network issues. This can provide insights into the cause of interruptions.

9. Premium Support:

  • Contact Spotify support if issues persist, especially since you have a premium subscription. They might offer specific guidance or solutions tailored to your situation.
By implementing these steps, you should be able to create a more stable Spotify streaming solution on your Ubuntu MacBook.
Thank you so much for your lovely support
 
Buy from India's official online dealer!
Back
Top