Get the highlights in your inbox every week.
Squeeze Pi: Adventures in home audio
Squeeze Pi: Adventures in home audio
Using an old Raspberry Pi and open source Logitech software, an audiophile creates a streaming music system for the home office.
I've been a fan of the Squeezebox ever since I acquired Logitech's now-obsolete Squeezebox Touch, which my family is still using.
The Squeezebox Touch provided a family-friendly interface to access our music library, either directly on the device or via a range of mobile applications. Logitech discontinued its development in 2012, but I was happy as they open sourced the Squeezebox's server software as Logitech Media Server and supplied the open source code used on the physical Squeezebox devices.
About a year ago I decided I wanted some decent sound for my home office and wanted to reuse an old Raspberry Pi 1 Model B as the source. Ideally, I wanted something compatible with our existing Squeezebox ecosystem and looked for options. The Logitech Media Server quickly became my choice. The Logitech Media Server software used to manage the audio library is updated by the community with a number of enhancements and big fixes (info on recent builds is available via the Slimdevices forum and its Wiki).
Here are my three steps to creating a near-audiophile experience that you can use with almost any iteration of the Raspberry Pi.
Phase 1: Proof of concept
While the Raspberry Pi Model B comes with a standard 3.5mm stereo audio jack, it has a limited frequency response and is subject to a lot of interference. Later models haven't really improved this, but it's definitely sufficient to test the Pi as a SqueezeBox client.
Baseline hardware and software
- Raspberry Pi 1 Model B with a case
- 128MB SD card
- USB charger capable of 1A output
- 3.5mm stereo audio cable
- Network cable
- Old pair of laptop speakers
- piCorePlayer software
A key aim in the PoC stage was to reuse old, spare equipment—I'd guess that the Altec Lansing desktop speakers I used are about 20 years old, and the 128MB SD card was the smallest spare card I could find. (I later switched to a 1GB SD card, due to reliability issues with the 128MB card.) I also went for a physical network cable, as the device will be operating headless (without a screen), and DHCP over a physical Ethernet cable is simple to implement and test. Another common issue is a poor or unreliable USB power source, hence the 1 amp unit.
I'm a big fan of taking an appliance-centric approach where possible, and piCorePlayer provides a tiny build of Linux with the Squeezelite software client for Logitech Media Server integrated in an easy-to-install form. Under the hood, it's TinyCore-based Linux running in RAM and only mounts the storage when backing up configuration changes. This makes it very resilient to power outages. For audio output, it supports the 3.5mm stereo jack, HDMI audio, and a range of USB digital-to-analog converters (DACs). In addition, there are a wide range of I2C DACs, which plug directly onto the Raspberry Pi, if you want a more audiophile experience.
I downloaded the latest build of piCorePlayer and installed it onto the SD card; note that with a more modern Pi, you'll need to use a microSD card. In addition, Raspberry Pi's don't support booting from USB devices. I used dd to image the SD card via the card slot on my Linux laptop.
sudo dd if=piCorePlayer3.20.img of=/dev/mmcblk0 bs=16M
Optionally, some distros now ship with image-burning tools like Fedora Media Writer.
After booting, the Pi found an IP address via DHCP, and I could connect via a browser to complete the configuration.
Under Squeezelite's settings, I set audio output to analog audio and clicked save. Then I specified a name for my player, which was detected by the SqueezeCenter server software, and again clicked save.
Using my Squeezer Android mobile client, I could now see two Squeezebox clients on my network, the old Squeezebox Touch and my home office piCorePlayer, and I could select and play audio from my library. This was a quick and easy test, but I did have some audio issues. Occasionally I'd get a hum through the speakers if I knocked or moved the Pi, and the audio quality was less than impressive.
Phase 2: USB audio adapter
Because I was still trying to reuse existing hardware in Phase 2, I grabbed an old USB audio adapter that came with a Logitech headset, hoping this would provide a more reliable audio experience than the onboard 3.5mm jack.
The USB adapter was automatically detected by the Pi. Via a browser, I just needed to change the audio output to USB and the output setting to front:CARD=Headset,DEV=0. After clicking save, I got more reliable audio through my 20-year-old speakers via the USB adapter.
There is a great guide for various USB devices on the piCorePlayer site; I've updated it to included the USB IDs for the Logitech adapter.
Phase 3: Audiophile quality?
I had some spare bookshelf speakers that are considerably better than the laptop speakers, but no power source to drive them. At this stage, I could have used an HDMI-ready small amplifier and avoided the USB and 3.5mm outputs, but I'd heard of small amplifiers with built-in USB DACs and decided to explore that route.
I picked up a Topping VX1 amplifier from a local supplier after reading a large number of positive reviews. This is a gorgeous device with enough power for a small home-office environment. The USB DAC is automatically detected by modern Linux kernels and works well with piCorePlayer.
Next steps: Is there a phase 4?
You may be wondering if I would I do it the same way again if I were starting from scratch.
Mostly. I'd consider using a device like a Pi Zero if I were purchasing hardware. There are some great audiophile add-ons for this device, and it has an incredibly small footprint.
For the amplifier DAC, I'd hoped to use something along the lines of the device being developed by my old friend Bdale Garbee. These small devices combine a PCM2705C USB DAC with a TPA3118D2 Class-D audio amp and could provide a simple, low-cost, and considerably more open solution as an alternative to the Topping VX1 amplifier. For more about Bdale's solution, see his presentation from linux.conf.au 2016 or visit his project website.
If I hadn't already been a Squeezebox user, I might have considered a music player daemon (MPD)-based solution, perhaps using something like Mopidity.
I'm considering getting a touch screen to provide an even more complete Squeezebox Touch-like experience. There is a fully open source implementation of the Squeezebox UI that is compatible with touch screens for the Pi. In addition, my daughter will soon outgrow her current stereo, which might provide an opportunity to play with a Pi Zero to build another Squeezebox-compatible frontend.
But right now, I'm too busy enjoying the excellent audio quality in my home office while writing this article for Opensource.com to think about what's next.