Saturday, June 23, 2018

Building a small standalone digital music player

For the last several years, all my recorded music listening has been from lossless PCM FLAC stored on a Synology NAS. I went through several iterations of Ethernet-based streaming from the NAS, but now I've settled on a Roon server on a Ubuntu Intel NUC that streams to a couple of different Roon endpoints: an Auralic Aries Femto for the living room speaker system, and an Allo USBridge for the study headphone system. Those endpoints connect to DAC>amp>transducer chains.

For work, however, I want my music system there to be standalone for convenience and security. After a bit of exploration, I settled on the following hardware:

Pi 2 single-board computer.

AdaFruid 7'' touchscreen.

SmartiPi touchscreen stand and Pi case.

Pi2 Design 502DAC, to be used as a high-quality S/PDIF source, not as a DAC. A possible alternative would be the Allo DigiOne board, which I did not consider at the time for whatever reason.

Samsung 1TB USB-C SSD for music storage.

sBooster ECO 5-6v LPS to power the above. Probably overkill, but you definitely need 3A@5V, which is more than the typical USB wall wart.

The player connects with a S/PDIF coax cable to my Soekris dac1541 DAC/amp, which on its own it is a very nice source for my MrSpeakers Æon Flow Closed headphones. However, I currently have an extra Neurochrome HP-1 headphone amp, and that sounds even better between the DAC and the headphones than the dac1541's built-in amp.

What remained was to find standalone music player software that would run well on that low-power computer. I started with RuneAudio, which worked but was was sluggish, often missed command touches, and sometimes got stuck doing harder chores. Scrolling through my 1TB music library was really annoying. I also tried Volumio, but I could not get it to run stably on my hardware. Eventually, I heard about piCorePlayer on an audio forum as being really lightweight -- it runs from RAM disk -- and decided to give it a try. All of those three Linux-based players are mainly designed to stream music from a separate server or streaming service, but RuneAudio and Volumio can in principle work standalone from a local USB disk.

My adventure was to try to get piCorePlayer to work standalone, even though it is mainly a replacement for the formerly proprietary networked Squeezebox player. I managed to get this to work thanks to advice from kind users of an audio forum as well as a lot of searches for documentation and other forum info. In brief, I eventually succeeded, and the resulting player works really well, scrolling quickly through my big library and allowing me to select the right album for what I'm working on those precious times I'm not in meetings. Here's what I did:

After downloading and unzipping, used Etcher on my Macbook Pro and a SD-2-microSD carrier to flash the piCorePlayer image onto a 64GB SanDisk microSD.

Inserted the card into the Pi 2 microSD carrier, reassembled the unit, connected it to my home LAN, DAC, USB SSD, and power.

On boot-up, boot messages on touchscreen are upside-down. Don't worry, it will be solved later.

Connected to the piCorePlayer software running on the Pi with the Web browser (Chrome) on my Macbook Pro. For convenience (it will come especially handy later), I assigned a fixed IP on my LAN to the Pi, which is really easy to do with the Web interface to the Ubiquiti EdgeRouter that manages my home LAN.

Enabled Beta software on the main piCorePlayer control Web page. This will come in handy later.

Using the piCorePlayer Web interface, installed LMS. This requires resizing the boot partition, which involves several rebooting dialogs, and then actually installing LMS.

Set up your preferred name for the piCorePlayer, and also tell LMS about it on the LMS configuration page. Mine is "Ebnefluh," after a memorable ski tour I did in April (all my music-related machines are named after peaks I visited on skis).

Make sure that the LMS flag to bypass mysqueezebox is set and saved.

Install jivelite package to manage the touchscreen.

Once jivelite is installed, use its configuration page on your browser to adjust screen rotation. In my setup, I had to select the option to flip upside-down.

Use the LMS Web interface to tell LMS where your music library is in the USB drive, and to get it to index it. There's a page that shows indexing progress. If you did 9 above, you won't be prompted to get a mysqueezebox account.

Wait until your music is indexed. In my case, this stopped somehow, and I had to poke it on the LMS Web interface. But it got eventually done.

Now you can test that you can control play to your DAC from the touchscreen. Enjoy testing with some known tunes!

Just to be sure everything so far is remembered, use the "Backup" option on the piCorePlayer control page to save your current configuration to the microSD card.

The final step is to make your device work standalone. On the beta options on the piCorePlayer control page, click to set a fixed IP address. That gets you to a network configuration Web page. Set DHCP to off, enter your fixed IP address, netmask, default gateway, and default DNS. You should set this to what you have on the LAN you are configuring the device on, so that it talks correctly to it when you bring the device back to it for software updates etc.

Backup your whole configuration again to microSD. This is critical!

Shut down the device, unplug it from power, and let it rest for a while so that its RAM resets. Also unplug it from your network.

Power up the device again. Once it is up, you should be able to access your music and control play from the touchscreen.

Troubleshooting: at step 19, if you see a boot-up message that the device is waiting for network and that stays for a while, outputting periods on the screen, that means that you did on 16 did not stick, probably because you forgot to backup the configuration to microSD before power down. If that is done correctly, the network should come up right away, and LMS will also boot-up quickly. If not, after the long failed wait for network, LMS will not spin up and Squeezelite won't find your music.

No comments:

About Me

I am VP and Engineering Fellow at Google, where I lead work on natural-language understanding and machine learning. My previous positions include chair of the Computer and Information Science department of the University of Pennsylvania, head of the Machine Learning and Information Retrieval department at AT&T Labs, and research and management positions at SRI International. I received a Ph.D. in Artificial Intelligence from the University of Edinburgh in 1982, and I have over 120 research publications on computational linguistics, machine learning, bioinformatics, speech recognition, and logic programming, as well as several patents. I was elected AAAI Fellow in 1991 for contributions to computational linguistics and logic programming, ACM Fellow in 2010 for contributions to machine-learning models of natural language and biological sequences, and ACL Fellow in 2017 for contributions to sequence modeling, finite-state methods, and dependency and deductive parsing. I was president of the Association for Computational Linguistics in 1993.