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:
  1. Downloaded piCorePlayer 3.5.0.
  2. 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.
  3. Inserted the card into the Pi 2 microSD carrier, reassembled the unit, connected it to my home LAN, DAC, USB SSD, and power.
  4. On boot-up, boot messages on touchscreen are upside-down. Don't worry, it will be solved later.
  5. 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.
  6. Enabled Beta software on the main piCorePlayer control Web page. This will come in handy later.
  7. Using the piCorePlayer Web interface, installed LMS. This requires resizing the boot partition, which involves several rebooting dialogs, and then actually installing LMS.
  8. 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).
  9. Make sure that the LMS flag to bypass mysqueezebox is set and saved.
  10. Install jivelite package to manage the touchscreen.
  11. 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.
  12. 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.
  13. 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.
  14. Now you can test that you can control play to your DAC from the touchscreen. Enjoy testing with some known tunes!
  15. 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.
  16. 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.
  17. Backup your whole configuration again to microSD. This is critical!
  18. 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.
  19. Power up the device again. Once it is up, you should be able to access your music and control play from the touchscreen.
  20. 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: