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

rwnano

Active Member
Joined
Jul 21, 2022
Messages
546
Points
43
Location
Gurugram, Haryana, India
So I have a circa 2010 Macbook running Ubuntu. This is connected via WiFi and ethernet to my main internet network. It runs SPotify-GUI and outputs via Topping DAC D10s to RCA cables to my Amp & speakers. I control it using my Smartphone running Spotify as a remote. Have a premium subscription.
Its slightly buggy and MOST TIMES, the bugs are due to the SPotify instance failing, or Ubuntu requiring an update.
  1. Spotify will stop running sometimes and require a restart. This is the GUI - SPotify we are talking about.
  2. The internet connection may be unstable at times - have a slightly loose ethernet plug which requires a refresh. Even though wifi is an alternative, do think I require a better ethernet plug.
How do I make a more stable SPotify streaming solution using my preexisting Ubuntu Macbook ?
  • I have turned off ubuntu updates since they used to trip up the playback at times.
 
How do I make a more stable SPotify streaming solution using my preexisting Ubuntu Macbook ?
You can try installing LMS -- Logitech Media Server and Squuezelite in Ubuntu. It has a plug-in for Spotify and it has been trouble free for me. You can control it from phone as well

LMS can play local / remote files also
 
BTW – old macbooks are pretty reliable BTW – and this one has everything working except for the battery – this has an SSD as well – so its similar to a Raspberry Pi with more RAM, a GUI and keyboard attached. Functionality is there.
You can try installing LMS -- Logitech Media Server and Squuezelite in Ubuntu. It has a plug-in for Spotify and it has been trouble free for me. You can control it from phone as well

LMS can play local / remote files also
So this means the end result is something that can seamlessly switch between playing local FLAC files on the Ubuntu Laptop, Control & PAUSE flac files playback running via a remote control application on my Smartphone running Android, and then play from Spotify from my Smartphone?
 
Someone recommended JELLY-FIN on Ubuntu....

And someone pushed OWN-TONE:

OwnTone


OwnTone is an open source (audio) media server for GNU/Linux, FreeBSD and MacOS.


It allows sharing and streaming your media library to iTunes (DAAP1), Roku (RSP), AirPlay devices (multiroom), Chromecast and also supports local playback.


You can control OwnTone via its web interface, Apple Remote (and compatible DAAP/DACP clients), MPD clients or via its JSON API.


Besides serving your local music, podcast and audiobook media files, OwnTone supports internet radios and Spotify (requires Spotify premium account).


Prior to version 28, OwnTone was called forked-daapd, which again was a rewrite of mt-daapd (Firefly Media Server).


OwnTone is written in C with a web interface written in Vue.js.


Features


  • Stream to
AirPlay (synchronized multiroom) and
  • Chromecast devices

  • Share local library with iTunes and Roku

  • Local audio playback with ALSA or PulseAudio
  • Supports multiple different clients:
  • Remote apps like Apple Remote (iOS) or Retune (Android)
  • Integrated mobile friendly web interface
    • MPD clients
  • Supportsinternet radio
    music and audiobook files, podcast files and RSS and
  • Supports audio files in most formats

  • Supports playing your Spotify library (requires Spotify premium account)
Runs on low power devices like the Raspberry Pi
 
Last edited:
WHich music playback distro and why? I wanted to run both FLAC files on the HDD as well as Spotify
Ropiee, volumio, gentooplayer etc - there are dozens of distros. The biggest benefit you have is less noise - no fan noise and less electrical noise, low power consumption and the ability to control it from other devices.
 
Ropiee, volumio, gentooplayer etc - there are dozens of distros. The biggest benefit you have is less noise - no fan noise and less electrical noise, low power consumption and the ability to control it from other devices.
Thanks for the tip. Having said that, Raspbian is Debian, Ubuntu is Debian too. So operating system wise its the same. Raspbery Pi's have a bunch of SD cards which get corrupted over time due to read-writes. Also, The Pi, its a headless server, while this Macbook has a screen and keyboard attached.
Ubuntu has a more developed GUI than Raspbian. So one can do most of what one does on a Pi, on these old laptops running Ubuntu as well.
The only thing is that Raspbery Pi has good headless installation scripts and controls.
 
Thanks for the tip. Having said that, Raspbian is Debian, Ubuntu is Debian too. So operating system wise its the same. Raspbery Pi's have a bunch of SD cards which get corrupted over time due to read-writes. Also, The Pi, its a headless server, while this Macbook has a screen and keyboard attached.
Ubuntu has a more developed GUI than Raspbian. So one can do most of what one does on a Pi, on these old laptops running Ubuntu as well.
The only thing is that Raspbery Pi has good headless installation scripts and controls.
None of the desktop Linux distros are optimised for audio. Lots of unnecessary services etc are disabled in these and it does make an audible difference if you have a setup that is resolving enough.

The pi can be used headless or connected to a display. Either works. I had tried a pi before but now have moved to a proprietary solution.
 
None of the desktop Linux distros are optimised for audio. Lots of unnecessary services etc are disabled in these and it does make an audible difference if you have a setup that is resolving enough.

The pi can be used headless or connected to a display. Either works. I had tried a pi before but now have moved to a proprietary solution.
Is there any way to optimise the desktop distros for audio? Using the server versions with GUI, etc...?
 
Thanks for the tip. Having said that, Raspbian is Debian, Ubuntu is Debian too. So operating system wise its the same. Raspbery Pi's have a bunch of SD cards which get corrupted over time due to read-writes. Also, The Pi, its a headless server, while this Macbook has a screen and keyboard attached.
Ubuntu has a more developed GUI than Raspbian. So one can do most of what one does on a Pi, on these old laptops running Ubuntu as well.
The only thing is that Raspbery Pi has good headless installation scripts and controls.
The old macbook pros have some serious hardware useful for audio.

I have tons of RPI devices, practically in every room and for each of my headphone and amps. In addition a macmini for headless playback of apple music. One macbook air for spotify screen and two macbook pros one from 2022 and one very old macbook pro of 2011.

Of this the most useful device turns out to be my old macbook pro of 2011. Advantage of old macbook pros

1. Integrated Screen, allowing you to carry the device with you wherever you want it to go.
2. Integrated keyboard and touch pad
3. Powerful CPU. Even my RPI4 struggles when transferring encrypted DSD files. Apart from the encryption speed, RPI 4 runs pretty fast. Due to this even a RPI4 is never able to reach 1 gbps on the gigabit network port when using SSL. It maxes out to around 800 mpbs. My macbook does 1 gbps without a sweat. If not using SSL, there isn't this difference.
4. Integrated IR port. My 2022 macbook pro doesn't have this. The apple tv remote, my apple hi-fi speaker remote, all work seamlessly. I can stop, pause, rewind, play, forward, increase/decrease volume with the remote. Using a remote is any days faster than picking up your android/ios phone, then unlocking it, running some app to do the same thing which can be done in a fraction of a second. It is faster than calling hey google or alexa
5. The macbook by itself can be used as a remote as well as a player.
6. The headphone out of macbook is better than the noisy headphone out of RPI. It has SPDIF output too.
7. The audio can easily be optimized on the mac as long as you don't run Apple's own OS. Run any flavour of Linux and you will be good. I use Fedora Core. Apple's own os OSX is so dumb that it cannot automatically adjust the audio sample rate.
8. If you run linux, you can create your own run level that doesn't run any of the non-audio services. I have created a bunch of systemd scripts that optimizes audio on Linux. Reach out to me if you want to optimize ubuntu on your old macbook.
9. Unlike the Raspbian OS on RPI, upgrade on almost all linux flavours is much better. Unlike RPI you don't have to start from scratch when a new OS version is released. e.g. If you are on Raspbian 11 (bullseye) and you wan't to upgrade to Raspbian 12 (bookworm) you have to again download the OS, burn it to SD card and do all the customization you did before. The upgrade process is still not foolproof and hence even as of now Raspberry PI Foundation recommends to start from fresh. Using a standard linux distribution you can upgrade directly by doing dist-upgrade and all applications get upgraded too.

One disadvantage of the macbook is using the noisy SMPS power supply.
 
Last edited:
Is there any way to optimise the desktop distros for audio? Using the server versions with GUI, etc...?
Yes. Most importantly
1. If possible install a RT linux kernel
2. Use chrt to run the audio in realtime mode
3. Reduce audio thread latency by increasing priority for IRQ daemon
4. Use taskset to audio application affinity and priority. You can dedicate CPU cores just for audio
5. Don't run services like apache, mail. The gui too can be easily disabled by using systemctl
systemctl set-default multi-user.target
6. After disabling the gui, just run vnc service and access it from another desktop/laptop so that the GUI gets used only when a vnc client connects.
7. If you are using a usb dac, then you can adjust nrpacks to reach audio latencies as low as 4-6 microseconds. nrpa cks is an int variable in snd_usb_audio structure used by alsa https://docs.huihoo.com/doxygen/linux/kernel/3.7/usbaudio_8h_source.html

BTW all of these can be done on Raspberry PI too and that's how I run my RPI devices (except for the RT kernel).

After you do all the optimization, all you have to do is run the top command and systemd-analyze blame command for further optimization.
 
Last edited:
So this means the end result is something that can seamlessly switch between playing local FLAC files on the Ubuntu Laptop
Yes
, Control & PAUSE flac files playback running via a remote control application on my Smartphone running Android
Yes
, and then play from Spotify from my Smartphone?
Spotify playback is by Spotty plug-in. So you do not need Spotify app in your phone. You control Spotify playback in your LMS remote
 
from snap store - easy to install - but remote control?
It uses librespot, the same thing that I use. So any spotify client on mac/ubuntu/laptop/desktop/ios/android will also work as a remote. But using the ncspot client will be cumbersome.

You will require to run terminal and run ncspot inside the terminal. You will not able to use the mouse. This is ok for someone like me who is always on the terminal and use vim key bindings to move left, right, up down. It is more for people who don't like moving the right hand to move the mouse and hence reducing the typing speed and productivity. Someone who uses whatsapp for messaging, chrome/firefox browser for most stuff will find it difficult.

ncurses Spotify client written in Rust using librespot
 
Last edited:
Unless you enjoy tweaking away , you can pick a simple wiim mini or wiim pro and get to listening to music a lot sooner.

I dabbled with pi based solutions for a long time but have never been happier since moving to wiim pro.

MaSh
 
Unless you enjoy tweaking away , you can pick a simple wiim mini or wiim pro and get to listening to music a lot sooner.

I dabbled with pi based solutions for a long time but have never been happier since moving to wiim pro.

MaSh
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.
 
Follow HiFiMART on Instagram for offers, deals and FREE giveaways!
Back
Top