Press "Enter" to skip to content

Categoria: Squeezelite

SqueezeCore: a minimal audio OS running Squeezelite.

The purpose of this project:

I built SqueezeCore because I needed a lightweight, minimal, plug&play OS to use it as a squeezelite player. The whole OS is 17MB and when running it occupies around 60MB of RAM; SqueezeCore must be installed on a USB drive and will run completely in RAM. Perfect to be installed on a thin client!

Requirements

  • RAM: 128MB
  • CPU: 32bit or 64bit, every CPU is ok, it can run on a toaster too
  • USB flash drive: 32MB
  • An ethernet port
  • A monitor for first setup (optional)
  • A keyboard for first setup (optional)
  • A computer running Logitech Media Server

Installation:

Download SqueezeCore .IMG from here: SqueezeCore
Flash the .IMG using Etcher or a similar software

Which version should I download?

1st rule: if you are unsure download the generic .img. It is usually more stable, and has less specific hardware requirements.
If you want to try the RT version please read all the FAQs before.

Changelog

v0.1-ALPHA: initial release
v0.2-BETA: fixed a bug that caused squeezelite not being able to lock on the specified output device
v0.3-BETA: minor fixes
v0.1-RT-BETA: initial release

First Setup:

Using monitor and keyboard (recommended):

Plug into your computer the USB flash drive with SqueezeCore, an ethernet cable (wifi not supported at the moment), a keyboard and a monitor.
Power on and boot from USB.
Now you will have to enter some squeezelite settings like: what audio device use as output, buffer settings and so on; if you have any doubts leave all settings as default and just select your audio output device. (Important: read carefully the options during the setup)
From now on every time you power on your computer squeezelite will start at boot with the defined settings.

Headless setup:

Plug the SqueezeCore USB drive to your computer. Create a file named squeeze.conf inside the “/config” directory. Open squeeze.conf with Notepad++ (or a similar editor that allows you to set the UNIX(LF) newline) and insert the squeezelite options following this example:

hw:CARD=UD501,DEV=0    #1st line: output device
SqueezeCore                     #2nd line: Player Name
SqueezeCore                     #3rd line: Model Name
auto                                    #4th line: [server_address:port], auto to autodiscover
40:4::0                             #5th line: ALSA parameters [buffer:period_count:sample_format:mmap]
4096:3072                         #6th line: [stream_buffer:output_buffer]
45                                        #7th line: process priority [1-99]
                                               #8th line: [OPTIONAL] additional commands

Save, plug your SqueezeCore USB flash drive to your PC, power on, profit!

F.A.Q.

I want bit-perfect audio but in the output device list my dac does not appear as “hw:CARD=card_name” but only “default:CARD=card_name”
You can try to type 0 during output selection to not choose any option, then, in additional options (last question) type “-o hw:CARD=card_name,DEV=0”

I want to reset my configuration! How can I do it?
Directly on SqueezeCore: “rm -f /squeezecore/config/squeeze.conf && sync”
From Windows: delete /config/squeeze.conf

But, what about the RT version?
It is a specific build with a custom Real Time kernel; the hardware requirements are different from the generic version:
Minimal Hardware Requirements for RT:
CPU: Only Intel, Only Core2Duo and newer (Xeon, Core i3 i5 i7, new Pentium and Celeron). 2 core 4 thread (recommended 4 physical cores).
The Other requirements are the same of the generic one.

In the RT version the difference is not only in the kernel but there are other tweaks under the hood like:
The player runs on a isolated core with round robin scheduler.
All the DAC USB interrupts are isolated on one core.
The remaining core are for kernel and the remaining interrupts and software running.

Since the RT version has more strict hardware requirements do you have any suggestion for the hardware setup?
I really like mini-ITX and thin-ITX motherboards with Pentium and Celeron N-series (like N3160) or J-series (like j4105 j3455). Those models have 4 cores and very low power consuption.
About bios settings you can try to disable multi-threading and C-states (but I really don’t know if this can affect the sound performance, you can try and come back here to write your feedback)

Thanks to:

  • Marco Curti for Squeezelite-R2
  • TinyCoreLinux team for their awesome distro. Squeezecore is based on Tinycorelinux.

If you are using SqueezeCore and you like it consider to buy me a coffee: paypal.me

How to compile Squeezelite-R2

In the download area you can find the .tar.gz archives of the source code used to compile binaries available for download on this website:

  • squeezelite-R2_FULL.tar.gz this is the same source code available in the github repository linked below. Compatible with all O.S.
  • squeezelite-R2_Unix.tar.gz this is the source code compatible only with Unix based system, recommended for building in macOS, FreeBSD and ARM devices.

IMPORTANT: the github repository with updated source code and more information about the project is as always at marcoc1712/squeezelite-R2

Linux

IMPORTANT: to correctly stream DSD format you need to have on your O.S. ALSA >= 1.0.29

Those distros are currently (March 2017) compatible:

- Debian: >= 9.0 ("Stretch")
- Ubuntu: >= 16.04
- Mint: >= 18
- Fedora: >= 22
- RHEL e derivate (CentOS, Scientific Linux): >= 6.x
- openSUSE: >= 42.1
- Slackware: >= 14.2
- Arch: current
- Gentoo: current

Install the dependencies:

sudo apt-get install libasound2 libasound2-dev libflac-dev libmad0-dev libfaad-dev libmpg123-dev libvorbis-dev

Compile:

make -f Makefile.debian # or Makefile.linux if you are using the *Unix.tar.gz

RaspberryPi and other SBC

Important: Raspbian is not compatible because it uses an old version of alsa.
Please use a O.S. with alsa >= 1.0.29 such as Ubuntu server 16.10

sudo apt-get install libasound2 libasound2-dev libflac-dev libmad0-dev libfaad-dev libmpg123-dev libvorbis-dev

make -f Makefile.rpi

If you are using RaspberryPi3 with an ARM64 compatible O.S., after installing the dependencies run:

make -f Makefile.rpi_ARM64

macOS

Install brew -> https://brew.sh/

brew install portaudio flac mad faad2 mpg123 libvorbis

make -f Makefile.macOS-64bit

or

make -f Makefile.macOS-32bit

FreeBSD

sudo pkg install portaudio gmake flac libmad faad2 mpg123 libvorbis

gmake -f Makefile.freebsd

RaspberryPi and other SBC

sudo pkg install portaudio gmake flac libmad faad2 mpg123 libvorbis

gmake -f Makefile.raspbsd

If you are using a RaspberryPi3 with an ARM64 compatible O.S. then run:

sudo pkg install portaudio gmake aarch64-binutils flac libmad faad2 mpg123 libvorbis

gmake -f Makefile.raspbsd_ARM64

 

Logitechmediaserver, C-3PO and PCM to DSD conversion

In this tutorial I’m going to illustrate how to implement and enable PCM->DSD conversion on-the-fly on Logitech Media Server. This is possible thanks to the plugin C-3PO and a modified version of SoX and Squeezelite-R2.

For a complete introduction and description of what is Logitech Media Server and how to install and use it you can read this Marco Curti’s guide -> Introduction to Squeezebox Server (translation in English will be available soon)

SOX

First of all we have to substitute the original SoX binary package in LMS with the modified one; go to the directory that contains LMS binaries:

Linux:

cd /usr/share/squeezeboxserver/Bin/ARCH

Where “ARCH” is the architecture of your operative system.

FreeBSD:

cd /usr/local/share/logitechmediaserver/Bin

macOS:

cd /Library/PreferencePanes/Squeezebox.prefPane/Contents/server/Bin/darwin

Windows:

cd C:\Program Files\Squeezebox\server\Bin\MSWin32-x86-multi-thread

Then remove the “old” sox, download the modified one and rename it in “sox”.

*nix O.S.

rm sox && wget https://audiodigitale/repo/sox-VERSION

You can find all the versions of SoX for different O.S. here -> Download SoX

The binaries in the download area are statically linked, so you don’t have to install any dependencies!

If you want to compile SoX by yourself in the download area there is the .tar.gz archive of the same version of SoX used to compile the binaries; otherwise you can also clone this github repository
-> mansr/sox

If you have any doubt follow this guide -> How to compile SoX

C-3PO

To install C-3PO please insert this repository in the lms plugin page :
http://www.marcoc1712.it/downloads/repository.xml

If you want to read more documentation about C-3PO follow this link -> C-3PO Transcoding Helper (translation in English will be available soon)

Project with source code on github -> marcoc1712/C-3PO

Particular instruction for FreeBSD: in this O.S. the directory that contains the binary of perl is different from linux, so you have to modify this file:

/var/db/logitechmediaserver/cache/InstalledPlugins/Plugins/C3PO/Bin/C-3PO

and replace #!/usr/bin/perl with #!/usr/local/bin/perl

Squeezelite-R2

Now your server should be ready to trascode PCM files to DSD, we just need to setup the client:

Please download the correct version for you O.S. here -> Squeezelite-R2

If you don’t know how to use it please read this guide -> Squeezelite-R2 Guide (translation in English will be available soon)

If you want to compile Squeezelite-R2 by yourself in the download area there is the .tar.gz archive of the same version of squeezelite-R2 used to compile the binaries; otherwise you can also clone this github repository -> marcoc1712/squeezelite-R2

If you have any doubt follow this guide -> How to compile Squeezelite-R2

Do you want to install and setup every single option of squeezelite easily? You can do it with Falcon, a practical and user-friendly web interface to manage every aspect of squeezelite! (Only for linux, beta)

Do you already know how to use squeezelite and you just want to start it at boot time?

Init Script (Linux)

sudo nano /etc/init.d/squeezelite

#!/bin/sh
### BEGIN INIT INFO
# Provides: squeezelite
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Script per l'avvio di squeezelite
# Description: ---
### END INIT INFO


#VARIABLES

USER=root
OUTPUT= # Specify output device, default -> default, - = output to stdout
NAME= # Set the player name
LMS= # <server>[:<port>]
ALSA= # -a <b>:<p>:<f>:<m> Specify ALSA params to open output device, b = buffer time in ms or size in bytes, p = period count or size in bytes, f sample format (16|24|24_3|32), m = use mmap (0|1)
BUFFER= # <stream>:<output> Specify internal Stream and Output buffer sizes in Kbytes
SCHEDULER= # <scheduler>:<rt priority> Scheduler: other, fifo, rr. Priority: 1-99 -> 1 min priority 99 max priority
NICENESS= # nice level -20 max priority 19 min priority

#CODE

case "$1" in
start)
echo "Starting Squeezelite"
start-stop-daemon -S --chuid $USER -N $NICENESS -P $SCHEDULER --exec /squeezelite -- -z -o $OUTPUT -n $NAME -s $LMS -a $ALSA -b $BUFFER -D
;;
stop)
echo "Stopping Squeezelite"
start-stop-daemon -K --name squeezelite
;;
*)
echo "Usage: /etc/init.d/squeezelite {start|stop}"
exit 1
;;
esac
exit

Save the file and:

sudo chmod +x /etc/init.d/squeezelite
sudo chown root:root /etc/init.d/squeezelite
sudo update-rc.d squeezelite defaults
sudo update-rc.d squeezelite enable

P.S. Please pay attention when you set the scheduler and the niceness; if you don’t know what are you doing remove “-N $NICENESS -P $SCHEDULER” from the script. If you have any question about this init script ask your questions in the comments below.

Automator (macOS)

Coming soon …

Batch script (Windows)

Coming soon …