HQP NAA - Raspberry Pi

OK ! Here I am listening to Roon/HQP on a Raspberry Pi NAA. It replaced a 5m Belkin USB cable. This is how I got there. It’s aimed squarely at someone with some familiarity with computers, but not necessarily Linux, so apologies if it’s very basic level. It’s also Windows based so apologies for that, and it’s long. but now I’m all apologied out so you’ll just have to wear that.

The goal here was a minimal headless installation, nothing not needed to get HQP by Ethernet in and hi res (including DSD) by USB out to my DAC (Auralic Vega). In future I may expand it to do WiFi and RoonSpeakers, but for now it is just an Ethernet NAA.

Hardware
Raspberry Pi 2 Model B (1 GB)
FLIRC Case
Switching Power Supply (5v, micro USB) (to be replaced by a Powerbank battery, but used for setup)
Verbatim MicroSDHC card (8 GB)
SanDisk MobileMate Duo USB/MicroSD reader
Ethernet CAT6 patch cable (5m)
Mapleshade USB cable (1m)

Install the Pi in the FLIRC case, 4 screws and a double sided sticky pad. Very clean case construction, looks good.
Load the MicroSD into the USB reader and plug it into a PC. Note the drive letter assigned to the card/reader.

Operating System
After reading this comparison I decided to go with DietPi rather than Raspbian Lite. Also @muski has said everything that needs to be said about installing Raspbian Lite.

I downloaded DietPi (Jessie) from Fuzon. The price was pretty good (free, donations accepted). Incidentally the names of Debian Linux releases are characters from “Toy Story”. “Jessie” is the latest stable release with a later version, “Stretch”, out for testing. Unzip/Extract the downloaded archive. DietPi_v102_RPi-(Jessie) is the disk image file which we are about to write to the SDmicro card so put it somewhere you can easily browse to (desktop was good for me).

If you haven’t got a disk imager, download and install Win32 Disk Imager. After install, open it and browse to the image file. Select the drive letter corresponding to the card/reader.

Now STOP. Take a sip of your favoured beverage (Pikes Clare Valley Shiraz 2013 worked for me) and double check that drive letter. Writing a disk image to a drive other than the one you intend results in much weeping, wailing and gnashing of teeth. So don’t do that.

When the image has finished writing, remove the MicroSD card from the reader and plug it into the Pi (it goes in electrodes up on the Pi). Connect the Pi by Ethernet to your router and power up the Pi. You will see some light activity on the Pi as the filesystem expands itself. The Pi will reboot twice during this process.

While the Pi was digesting the OS I went into the router LAN settings and configured a fixed IP address for the Pi. I used the one assigned by DHCP and wrote it down so I could remember it when starting an SSH terminal session. (Edit: Don’t do this, it can cause problems. Leave everything to DHCP for the moment and we will change to a static IP address later. For the moment, just note the IP address assigned by DHCP).

If you don’t have an SSH terminal program you like, download and install PuTTY. Open PuTTY and point it at the IP address of the Pi (check it in the router if you didn’t configure a fixed address as above) and open an SSH terminal session. Login as “root”, password “dietpi”. DietPi will update itself and reboot the Pi again, closing your recently opened terminal window.

Reopen PuTTY as above and DietPi will start it’s configuration steps. It will firstly ask if you want to use a USB drive. I said no to this because the NAA doesn’t have any real need for disk access (I think) and I was content to use the microSD card if it did.

DietPi will then take you to it’s software setup menu:

  1. I didn’t install any DietPi Optimised Software. There is an audio package, but it is not necessary for the NAA.
  2. I did install the ALSA audio system from the Additional Linux Software. This is necessary (and sufficient) for USB audio output.
  3. Dropbear is the SSH server we want.
  4. I chose None for File Server.
  5. I chose None for Log System.
  6. DietPi Config:
    You can change the default user/password here. I didn’t bother.
    Check that Autostart is set to option 7. Starts without a login.

Then hit “Install Go” and watch the fireworks as DietPi configures itself and ALSA. I had a hang while this happened, but I just went back and did the above again and it finished fine second time around. It will reboot again after configuration is complete.

Network Audio Daemon
Incidentally a daemon in LInux is the equivalent of a service in Windows. Starts automatically and all that style of thing.

We don’t need to install the ALSA utils. That all happened when we selected ALSA in the DietPi software config above.

We do, however, have to get the NAA software from Signalyst. I opted for the first armhf (being the chipset in the Pi) Stretch version, networkaudiod_3.1.0-25_armhf.deb, rather than the later 3.1.1-27 version because the later version requires a later C++ library than DietPi Jessie has. I may set out how to upgrade in a later post, but for the moment lets go with what worked.

So the two Linux commands I used were:

sudo wget https://www.signalyst.eu/bins/naa/v3/stretch/networkaudiod_3.1.0-25_armhf.deb

sudo dpkg -i networkaudiod_3.1.0-25_armhf.deb

(Edit: This last line used to have a duplicated package, which I copied from elsewhere but was unnecessary and potentially causing issues, my apologies)

After the NAA has configured itself, type exit to terminate the SSH session.

Now connect a USB cable from the Pi to your DAC. After a short pause, open HQP and change the name of the NAA in Tools/Network Naming. Then go to Settings/Backend and choose Network Audio Adapter. You should now see your NAA and DAC in the Device menu ( it saw the Vega through an Uptone Regen), select them.

You may have to reconfigure HQP settings for the new device, then have a listen.

I found things in general improved with the Ethernet/Pi/Mapleshade combination compared to the Belkin USB cable. There were some pops and artifacts at first, but after a while everything settled down and the Vega exact clock seems much happier with this combination.

Next, possibly upgrading to 3.1.1-27 and battery power for the Regen and Pi.

Edit: The Vega DAC takes DSD 128 by DoP which is all that I have tested. Rene and Jussi have set out below how to get up to DSD 512 direct using Raspbian Lite (Stretch) and the latest version NAA. Thanks guys !

2 Likes

Hey @andybob, great write-up!

In what seems our mutual quest to the ultimate, light-weight, purpose-built NAA Pi, I took a different route:

  1. Install a bare-bones, minimal Raspbian Jessie via raspbian-ue-netinst (loads a micro img, which does the installation directly from the internet, minimal and configurable)

  2. Change jessie to stretch in /etc/apt/sources.list

  3. Upgrade to stretch (apt-get update, apt-get upgrade, apt-get dist-upgrade)

  4. Install libasound2 and alsa (apt-get install libasound2 alsa-utils)

  5. Config for Digiberry Digi+ (remove default sound driver from /etc/modules, add dtoverlay=hifiberry-digi to /boot/config.txt)

  6. Download and install the latest NAA service (wget https://www.signalyst.eu/bins/naa/v3/stretch/networkaudiod_3.1.1-27_armhf.deb, apt-get install ./networkaudiod_3.1.1-27_armhf.deb)

  7. All set! Minimal, easy to update and capable of running the most recent NAA daemon.

3 Likes

Love the sound, just need to improve on the ’ stuck tracks issue’ (which doesn’t seem to be reproducable, but happens too regularly for my taste)…

Is the latest NAA version an improvement?

Wow thanks @andybob and @RBM - I’d been looking for this info for ages but never seemed to get ‘a complete picture’ for the Pi and step by step for non Linux experts.

I’ve done two short evaluations of HQP and can’t honestly say I’ve had that wow moment others have experienced - in fact I haven’t detected much difference between filter settings in my system (not sure what that says about me).

But I was more interested to see how much difference an NAA type solution makes compared to directly connected Mac. This gives me a chance to try.

It’s still early days I guess, but Roon’s Radio function has been playing a mix of redbook, highres and Tidal for over two hours, without any hiccups. I’ll have to play with it some more, but the first signs are encouraging.

@hifi_swlon: You’re welcome and enjoy the ride! :wink:

A post was split to a new topic: Raspbery Pi and IQAudIO boards

Superb write ups @andybob and @RBM

@andybob do you know if dietpi works with USB dacs Andy or is it just i2s?

Cant get mine working with it after following your instructions.

HQPlayer can see it as an NAA but no playback thro Roon.

Its a ifi nano idsd.

Cheers

I just spent some time to update the Raspbian support. The normal Debian Stretch binary package didn’t work for me, so I built a new Raspbian Stretch specific package.

As a starting point I used Raspbian Jessie Lite from here:

Then using raspi-config I expanded the filesystem to fill the 16 GB microSD card and set GPU RAM allocation to 4 MB in order to free suitable amount of RAM to general purpose use. I also set the boot process to wait for network to come up (important)*.

Then I fixed one issue the default config has, by adding discard mount option to /etc/fstab so that potentially TRIM gets called on the media (I didn’t check if this is actually supported though, but at least it doesn’t harm and if it works it is very good).

Then I upgraded to stretch by changing jessie to stretch in /etc/apt/sources.list and running “apt-get update ; apt-get dist-upgrade ; apt-get autoremove ; apt-get clean”.

Now the system is ready with new enough kernel (4.1) and libasound2 (1.0.29) with native DSD support (no DoP). Then you can go and install networkaudiod from:
https://www.signalyst.eu/bins/naa/v3/stretch/raspbian/

With this and compatible DAC you can go without DoP setting at HQPlayer side and reach for example DSD512 with iFi iDSD Micro.

**) In fact in the end I went for fixed IP by uninstalling dhcpcd package and setting up network config in good’ol way in /etc/network/interfaces.

2 Likes

sorry @andybob course you can. Sorted now

1 Like

Messing about with the power to the PI I managed to corrupt the SD card to the point where I couldn’t login with PuTTY and am now reinstalling everything. After a bit of reading I understand the best way to powerdown the Pi is:

sudo shutdown -P now

This allows everything to exit properly and then powerdown.

Somedays I just feel like Corporal Agarn from F Troop.

2 Likes

Yes, this is a known issue for the pi.
Two options: use PCP, which runs fully in memory and seemingly doesn’t corrupt
Leave the pi on.

Maybe there is an enterprising person here who’d like to see if NAA can easily be added to PCP? I like the recipes in this trail :smile: . Maybe this even gives both endpoint options on a pi?

Adding to PCP is tough, since it’s so heavily optimised for running Squeezelite. Had a quick look, but even apt-get and dpkg are not installed by default. It can be done, of course – but since PCP is running Jessie you’d be stuck with the old 2.0 networkaudiod, or you’d have to upgrade to Stretch manually, which will probably break the PCP install.

Then again, the issue is rather moot: I’ve made a backup IMG from my lightweight Stretch + NAA install, so in case card corruption rears its ugly head I’ll be up and running again in minutes.

Just for fun – the emperor’s new clothes:

Playing happily along:

2 Likes

Looks really nice!

Reinstalling has not proven simple. I am working through some issues and found this page very helpful. Still getting halts while unpacking though. It may be that my SD card is completely snafu.

Edit: Everything working again. Let the unpacking have as long as it wants to work. It can be beavering away without any visible sign of activity. If it does get stuck, then the steps in the page linked above should get you started again.

SD Cards don’t especially like the heavy read/write operations that come with installing and updating Linux distros. :smile: I keep an IMG archive of the working install on my MacBook and I have flashed this to a spare SD card. This way, I can dabble around as much as I like – if all else fails > second card in Pi, reflash the first one. Don’t let the music stop!

It’s a fun little box, but more importantly: it’s a flawless NAA. Introducing HQ Player to my Roon / Meridian based system has been amazing and fun, even if the DSP 5200’s limit my upsampling options to 96/24. For now. :wink:

1 Like

It should be just fine as long as you make sure you have the “discard” mount option in use with ext4 filesystem. This enables TRIM commands to the underlying flash storage. This should be always enabled for any other type of SSD storage too. I’ve been running and updating Debian Jessie and Stretch in a CuBox-i for a long time now without problems. (It also has eSATA interface, in case one wants to have a better storage.)

USB storage is bad for the purpose though, since TRIM often doesn’t work for those.

Is that enclosure self-made?

Jussi

I installed the NAA as per your post.

However, for some reason the service does not start by itself on install or after boot. The only way to get it to run is to SSH in and manually start it after which it works perfectly. However, the SSH connection has to be maintained throughout or HQPlayer desktop loses the NAA.

The service does not appear in /etc/init.d