Building a Raspberry Pi-based streamer - a guide for the nervous

Discussion in 'Digital: DACs, USB converters, decrapifiers' started by Kattefjaes, Feb 19, 2017.

  1. Kattefjaes

    Kattefjaes Mostly Harmless

    Friend
    Joined:
    Sep 5, 2016
    Likes Received:
    5,096
    Dislikes Received:
    41
    Trophy Points:
    113
    Location:
    London, UK
    This is a guide to building an inexpensive but good quality DIY music streamer/source, that outputs clean SPDIF to drive an external DAC. It uses an audio-centric version of Linux running on a Raspberry Pi 3, and a readily available audio board.

    This solution is best suited to driving inexpensive DACs like the Modi Multibit and the Bifrost Multibit. The board used can take a BNC connector*, for use with the Gungnir Multibit if you really want or you can just use Coax etc.- but once you're into four digits for your DAC, you can probably justify a more expensive source. If you are using a Yggdrasil or similar, you probably already have a kickass AES source, and probably don't need to read this, unless you fancy tinkering with a tiny second system.


    * But that would involve soldering, which might scare some folks off. We'll avoid anything like that for now, to keep it simple.


    There are three parts:

    • Preamble - explanations of what/why. Shopping lists, basic hardware setup, getting the OS installed etc.
    • The slightly fiddly bit - how to update the kernel, because the one in the standard image isn't new enough.
    • The main config - setting up Runeaudio to see the soundcard, music, misc tweaks.

    It's split like that because hopefully the the distro we're using will be updated so the second part isn't necessary, soon. However, it'd be handy to remember how to do it, if another card comes along that needs a newer kernel.



    Preamble

    Sound quality is dependant on your whole chain. The weakest link is your highest quality. When ceaselessly searching for better sound, standard procedure is to improve the most harmful bottleneck.

    There has been a lot of interest recently in using better sources than janky motherboard SPDIF, or worse yet, USB. While it's a nice idea to get a lower-jitter/noise source, things can get out of hand. If you only have a Modi Multibit, spending $500 on source, D2D converters or anything else is just a bit nuts- the money is better spent on a nicer DAC. There's also a lot of snakeoil out there, which does little or nothing to help ("USB reclocking" is a particularly useless promise).

    (About Jitter)
    Jitter?
    Everyone probably knows what stray electrical noise sounds like, but what does jitter sound like? The sort of periodic jitter that you get from a low-quality computer-based source essentially sounds like frequency smearing. Higher frequency transients lose their crispness, staging becomes muddy and instrument separation suffers. It's hard to describe- once you get rid of it, though, the difference is stark. It's a bit like having a camera that's always slightly out of focus. Once you get your front/back focussing fixed, everything is crisper and clearer- even though it's the same lens and same camera.

    Luckily, there is an easy solution, though you have to get your hands a little dirty. As you probably know, as you're reading this thread, you can build a cheap high-quality source using a tiny credit-card sized Raspberry Pi computer, with an inexpensive digital audio output card. Using a nice custom Linux distribution (don't panic), we can turn a tiny machine like this into a networked music player that can play audio from network shares, and function as a UnPnP, Airplay and Squeezebox renderer.

    DSC_1710-Edit-Edit.jpg

    So how does all of this stuff work together, in practise?

    The system we're going to set up is very flexible, and can be used in a variety of ways. For now, we'll just consider the most straightforward and efficient use case- using MPD.

    MPD ("Music Player Daemon") is a free headless music player. It is designed to play music reliably, and be easily controllable over the network. It exposes its control interface fully, so that it's easy to develop remote control apps for it.

    There are many interfaces for it. A lot of the audio-centric mini-distros for the Raspberry Pi include their own web interface:

    rune.jpg

    In addition to that, there are mobile apps, which make it easy and convenient to control the music from a smartphone or tablet:

    mpd.jpg

    The Raspberry Pi sits on your network, mounting your network drive full of music. You control the music player on the Pi remotely over the network- and the Pi plays the music out of its fancy digital sound card (with nice solid clocks) over SPDIF. The SPDIF is plugged into your DAC. Because you're feeding it a good, clean low-jitter audio stream, your DAC makes happy noises.

    This means that you can use almost anything as a remote, too- so can switch your computer off, if it's a bit noisy.


    Prerequisites

    I'm going to explain how to build an easy, functional network streamer from inexpensive, readily-available parts which are in production at the time of writing. We're going to focus on straightforward, inexpensive and easy- no soldering nothing likely to burn your house down. There are more complex and exotic ways to approach this, but those are out of scope for now. This is a guide for the nervous, not for smartarses. If you're a smartarse, you don't need a guide- you know what you're doing :)

    However, there are some things that we're going to assume that you already have. If you don't have these things, and are not sure how to get them, then feel free to run away. Don't let me complicate your life with my nonsense!

    You will need:

    • A sane network, with the usual guff like DHCP etc.. 99% of people have this, you'd have to go out of your way not to have it.
    • A small amount of networking knowledge - the ability to type an IP address in without pain etc..
    • Working Wifi or the ability to run a network cable to near your DAC, as you prefer.
    • A CIFS/SMB network share full of music. This probably should come from a nice little NAS, though you could share from a computer if you must. However, a NAS is probably nicer- we're trying to decouple stuff from your noisy computer!
    • A DAC that supports TOSlink or coaxial SPDIF.
    Shopping list

    You're going to need:

    • A Raspberry Pi 3 - this is the actual tiny computer that's doing all the work. They kick ass, it's a quad core 64 bit ARM machine, with built-in Wifi.
    • A Hifiberry Digi+ Pro - this is an small digital audio board that plugs into the Pi. It has a pair of decent-quality clocks, and should provide a nice clean feed at all your favourite sample rates.
    • A case - this will hold the Pi and the audio board easily, with cutouts in place for the SPDIF connectors.
    • A USB power supply. It should be able to push over 2A. Here's a cheap one. However, if you prefer to pay slightly too much, here's a less noisy option. Despite the snakeoil marketing, it apparently works reasonably well. (There are much more expensive options, but let's keep it simple for now)
    • A memory card - you need a MicroSD card. Make sure it's at least class 10/UHS-1, so things aren't too sluggish. An 8GB card is probably plenty, actually- but given that a 16GB is nearly the same price, it's nice to have breathing space. Try to get a reputable brand from a reputable seller- don't buy from ebay or an Amazon marketplace seller, there's a lot of dodgy memory cards out there.
    • A card reader - the card above has a microSD to SD adaptor, so a reader for either is fine. A lot of laptops and monitors have built-in card readers, so chances are that you're all set. If you don't have one, they're not expensive.
    • A spare network cable. You'll need it for setup, at least. You can use Wifi later, if you prefer, so it doesn't need to stretch all the way from your network switch or router to your DAC!

    Put it together


    I'm not going to provide a step-by-step illustrated guide to how you plug the hardware together. It's very easy and it only goes one way- it'd be an insult to your intelligence (and great personal beauty).

    Essentially, don't worry- just plug the Digi+ Pro into the header on the Pi, and use the supplied plastic standoffs to support the board rigidly. Clip it into the case and then pull the pre-cut tabs off from in front of the SPDIF It all only goes together one way. Fit the lid, and that's most of the hardware work. Easy, huh?

    Next, you need to download an image of the operating system that we'll be installing. We're going to be using a special audio-centric version of Linux called Rune Audio. At the time of writing, it is the most functional and slick choice out of the available audio-centric minidistros for the Pi.

    (On choice of distribution)
    At the time of writing, of the three most popular choices:
    • Volumio doesn't support the Digi+ Pro at all, and it makes it hard to upgrade the kernel.
    • Moode supports the Digi+ Pro out of the box, but messes up the Pi 3 wireless config. It's also a bit ugly.
    • Rune Audio can support the Digi+ Pro with a kernel update. It works well with the Pi 3 on-board Wifi and has a tolerable web interface.
    Rune Audio feels like the best trade-off. It takes a little more effort to get it working (until they publish a version with a newer kernel), but it's possible to get all the hardware working, and the web interface is relatively quick and looks decent.

    Go to the download page and grab the Raspberry Pi image. You'll need to write the image to your microSD card. Read the relevant instructions that match your desktop OS:
    (Note, at the time of writing, the download page contains 0.3, which will require a kernel update to work with your Digi+ Pro. It's very easy, the second post will walk you through it. However, the current 0.4 beta is looking surprisingly decent, and works without any update needed- you can find that here. The choice is yours. The 0.4 beta does fix a couple of annoying but non-fatal bugs, though.)

    The instructions are a bit spotty, and you can easily accidentally write a still-compressed image to the card, which won't work. For the sake of simplicity, it's best to decompress it yourself first. On linux, it's just "gunzip <filename>". On MacOS, you can just double-click it in the Finder. On Windows, grab a copy of 7-Zip (you should have it anyway, it's really handy), and that will handle it for you.

    Once you've unpacked it, the filename should change from something like:

    RuneAudio_rpi2_rp3_0.4-beta_20160321_2GB.img.gz

    to something like:

    RuneAudio_rpi2_rp3_0.4-beta_20160321_2GB.img

    ..and it will have increased in size from just under 800MB to a little bit over 2GB.

    Anyway, assuming you've decompressed the image correctly, write it to the memory card. It will take a while, as they're pretty slow. You're unlikely to see more than about 10MB/sec write speed. Zzzz. This might be a good time to make a cup of tea.

    Once you have written the image to the card, you can insert the it into the Pi. You'll find the card slot at one end, underneath. The cutout in the case should make it easy to spot. Install the card with the metal contacts upwards.

    Run a network cable from the Pi to your network switch/router. Then plug the power into the Pi. You should see a tiny red light inside, and then a tiny green light blinking. The LEDs around the network port will come on as the machine boots, and before too long (maybe a minute, if not a lot less), it will have booted.

    After a while, you may be able to just point your web browser at http://runeaudio, and get a pretty blue interface. It takes a while for it to become reachable by name, though. If for any reason, you can't reach it by name, you'll need to get to the web interface via the IP address.

    newrune.jpg

    Use your router's web interface to find out what IP the Pi is using. If you're not sure how to do that, you could also use a Bonjour Browser (here's one for Windows) to look for "runeaudio", but you really should know how to see what's connected to your router, as a rule. If you're not sure how, ask the person who set up your router to help!

    Once you've found which IP the Pi (identifying itself as "runeaudio") is using, point your browser at it (e.g, http://192.168.2.10 or whatever). You should get the pretty blue interface.
     
    Last edited: May 13, 2017
  2. Kattefjaes

    Kattefjaes Mostly Harmless

    Friend
    Joined:
    Sep 5, 2016
    Likes Received:
    5,096
    Dislikes Received:
    41
    Trophy Points:
    113
    Location:
    London, UK
    Updating the Linux kernel and setting up the Digi+ Pro

    Note: 0.4 is now stable and usable, and has a new enough kernel that it supports the Digi+ pro out of the box. If you choose to use 0.4, you can skip the kernel updating and go onto the next post. (Details of how to update the kernel are left here for people who prefer to play it safe with 0.3, and also in case we need them for another purpose in future.)


    Right, let's rattle through what you need to do to get the sound card up and running.

    First we need to get the kernel updated, as the version that comes with Runeaudio is too old to support the Digi+ Pro. We're going to log in and fix that. Don't panic, it's not hard. This section looks long and text-heavy but a lot of it is explanation. You can get through it really fast.

    First of all, you need to have found the IP address of your Pi, as described in the first post. We're going to use this to log in via the "SSH" (Secure Shell) protocol and take care of business.

    If you're on Mac or Linux
    Mac and Linux users have it easy, they already have an SSH client. They just need to open a terminal and type something like:

    ssh [email protected]

    Obviously, substitute your own IP address there. The password needed is "rune".

    If you're on Windows
    Windows users need to download an ssh client. Luckily, there is a good, free ssh client for Windows. Download and install PuTTY. Fire it up, and fill in the "Host Name (or IP address)" box with the IP of your host. Leave the port as 22. Leave the "Connection type" radio button on "SSH". Hit the "Open" button. The user name is "root" and the password is "rune".

    Once you're logged in
    However you logged in, you should now be at a prompt that says:

    [[email protected] ~]#

    Now it's time to update some software. It's dead easy, so don't worry. I would suggest copying and pasting the commands, so you don't make annoying typos. Copying and pasting works as normal in Linux and MacOS. While using PuTTY, the right mouse button will paste within the PuTTY window.

    First, you need to do:

    pacman -Sy --force raspberrypi-firmware raspberrypi-bootloader linux-raspberrypi

    This will kick off a software update. When it asks you:

    :: Proceed with installation? [Y/n]

    ...Just hit return to accept the default, "Y". It will take a few minutes. This is where you'll be really glad that you didn't cheap out on a slow, noname card. If you start to worry that it has died, you should still be able to see the little green light blinking inside the case. Next, do:

    mv /etc/modules-load.d/raspberrypi.conf /root

    Now we need to reboot so that we're running the new kernel- go to the top right menu in the web interface, and choose "turn off" and then "reboot".

    Wait for the Pi to boot up, and the web interface to become responsive.

    Log back in with SSH, like you did before. Sometimes it takes a bit longer for the SSH server to wake up after boot, so don't panic if the web interface is working and the sshd apparently isn't. Once you're back at the now familiar prompt:

    [[email protected] ~]#

    ..we can do the rest of the job. First up, we're going to check that your kernel upgrade worked. Run:

    uname -a

    You should get a response something like:

    Linux runeaudio 4.4.49-1-ARCH #1 SMP Fri Feb 17 18:30:23 MST 2017 armv7l GNU/Linux

    as long as the version number after "Linux runeaudio" is 4.4.xx or higher, then your kernel upgrade is in place, well done. If it hasn't, go back and try again, or blame Canada.

    The next command to run is:

    redis-cli set kernel "`uname -snr`"

    Definitely paste that one- it's far too easy to screw up those tiny backticks. Assuming you ran the command correctly, you should get the response:

    OK

    Which is a little noncomittal, but what we're after. Next, let's do something not strictly necessary, but useful- check that the Pi can see your Digi+ Pro. To do that, type:

    aplay -l


    You should see something like:

    **** List of PLAYBACK Hardware Devices ****
    card 0: sndrpihifiberry [snd_rpi_hifiberry_digi], device 0: HiFiBerry Digi+ Pro HiFi wm8804-spdif-0 []
    Subdevices: 1/1
    Subdevice #0: subdevice #0


    There's your Digi+ Pro, all set up as a system sound card. Win.

    (If you don't see something along those lines, the Digi+ Pro isn't showing up- you need to check the board is properly plugged in, and that you did the kernel update properly, as above.)

    Ok, that's the slightly annoying bit done, it gets easier from here!
     
    Last edited: Jun 15, 2017
    Deep Funk, Mkoll, hikergrl and 15 others like this.
  3. Kattefjaes

    Kattefjaes Mostly Harmless

    Friend
    Joined:
    Sep 5, 2016
    Likes Received:
    5,096
    Dislikes Received:
    41
    Trophy Points:
    113
    Location:
    London, UK
    Configuring Runeaudio

    Now everything is more or less working, there are just a few config changes needed to make it a usable network music player.

    First up, via the menu in the top right of the web interface, go to "settings". Set your timezone. Apply settings. Scroll down a bit to "Features Management", You can choose what you do here, depending on what you need, but I'd suggest turning of "local browser". Whether you turn on Airplay and UnPnP is up to you- and you can always come back and change your mind later. Remember to apply your changes.


    If you opted for 0.4, so you didn't have to update the kernel, you still need to tell Linux to load the kernel module for the Digi+ Pro. In the same "settings" page, under "RuneOS kernel settings", you'll find a drop-down for "I²S kernel modules", you need to set that to "Hifiberry Digi Pro", like so:

    kernelmods.png

    Apply settings - you'll probably be asked to reboot. If you're aren't, go to "Turn off", in the menu, and choose "reboot". When the Pi comes back up, and you can interact with the web interface again, continue with the instructions below.


    Go to settings/MPD (via the usual menu). Make sure "Hifiberry Digi" is selected and disable volume control:

    mpd-snd.jpg

    Hit "SAVE AND APPLY".

    The next job is to pick up the network share full of music. I made an extra username and password that only allows re-only access, so that random music players on my network can play the files, but can't screw them up if there's a bug. Paranoid, but possibly a good idea.

    Anyway, go to settings/sources. Add new mount. In "source name", just enter a descriptive name for the share. I'm boring, so I am calling mine "FLACs". Assuming you have a normal SMB/CIFS share from a NAS, you don't need to change the protocol.

    mounts.jpg

    Fill in the IP address with the IP of your NAS. "Remote directory" is just the name of the share that you set up on your NAS that holds your music. In a feat of imagination, mine is called "music", so that's what I filled in here. Whether "guest access" is on or not is down to you- how is your NAS and share set up? I don't allow guest access, so it's off for me. If you're not using guest access, you will need to fill in the username and password for the share. Click "save mount".

    If you did everything correctly, you should be returned to the previous page, with a new mount next to a green tick. If you made some sort of typo filling in the details of the share, don't worry, just go back into it and correct it.

    Once you have the share mounted, an MPD database update will start. It will scan all the files on your share to build a catalogue. Depending on how much music you have, and how fast your NAS is, this could take a while.

    Once the "updating" spinner in the bottom left goes away, it should say "Library" instead. Go into library/albums. I know, it's functional rather than pretty, but you should see familiar album titles. click the right hand burger menu on an album of your choice, and do "add and play". Music should now be coming out of the TOSLink/SPDIF on the Pi!

    Go to "playing" at the bottom of the web interface, and you should see the player interface, numbers going up in a sensible way. The right hand circle won't do anything, as we have disabled software volume control. It's probably worth plugging into your DAC, and having a quick listen, to check everything is working reasonably well.

    player.jpg

    One last vital step- we're going to change the password to log in via SSH. You've probably read about botnets of IoT (Internet of Things) devices- these generally exploit huge lists of default passwords for an easy life. You should change your password, just to make your Pi less likely to be used for evil, or just vandalised. Even if you're on a private home network behind NAT and a firewall of sorts, this is good practise.

    Log back into your Pi via SSH, as detailed in the second post. Once you're back at the prompt, run:

    passwd

    Now you'll be asked for a password, which you'll need to type twice. Don't forget it, as while a nerd with physical access to your memory card can get you back in, it's annoying to have to ask. Use a sensible password, not just "password" :)


    You're basically done- you have a working network streamer. There are a couple more things, but they're optional. You can stop here if you don't want to use Wifi or use a mobile device as a remote. Enjoy.



    First is Wifi config. If you want to set up Wifi, go to the usual menu, to settings/network. When you click WLAN0, you should go to a Wifi setup page, with list of networks. Click yours, and fill in your usual Wifi password- this should be very familiar territory. Remember to "SAVE PROFILE" when you're done.

    Once it's all set up, you can click "show" under "Wi-Fi stored profiles" and bring up your new connection, to check if the signal strength looks decent. The Wifi antenna in the Pi3 isn't the best, and the Digi+ Pro does block it a bit, so it's worth checking that it's working.

    Assuming that it looks good, you can just experimentally try unplugging the ethernet cable. Because the wired interface's address was showing up as "runeaudio" on your network, you won't be able to use it by name right away- this should settle down after you reboot the Pi. If you don't want to reboot it right now, you can just use the IP address in your browser- remember the trailing slash- e.g., something like:

    http://192.168.2.10/

    ..though you can just pop a reboot if you prefer, and carry on just using

    http://runeaudio/

    Finally- if you have a mobile device, you can use an MPD remote app to control the player. There are plenty for both iOS and Android. This is a lot slicker than using the (slightly clunky) web interface. So far, I've had the best experience with "MPDroid" for Android. However, don't hesitate to try others out. It's actually pretty nice to control the music from your portable device, have it coming out of your DAC, without needing to have your computer on.

    Streaming Services

    A lot of people are using subscription music streaming services, and there are shedloads of them, too many for any sane person to try. I signed up for trials for two of the most popular, Tidal and Spotify, to experiment with getting them working through the Pi streamer from Android.

    (iOS users can just use Airplay in the usual way, of course, and don't need any help there. Just turn on the Airplay renderer in the Rune Audio settings.)

    Spotify looked promising, as both Rune and Volumio had some sort of support for it. Note the past tense there. Sadly Spotify is a bit of a bust right now, as Spotify have screwed their own API provision up- which means a lot of things that used to speak Spotify no longer work properly. This broke all the cool open source hacks that talked Spotify- including the popular Pi minidistros. I couldn't find an obvious way to make Spotify work here, barring hacky things like intercepting sound from a computer using Asset UnPnP or simply sending from Airplay on my iPad- bleh!

    (Disclaimer: Haven't yet checked to see what "Spotify Connect" uses, and if that can be easily fudged. Their own marketing materials are very light on detail..)

    So Spotify is apparently a bust right now (bits of the support work sometimes). What about Tidal?

    Surprisingly, the situation is a lot brighter with Tidal- there are off the shelf UnPnP controllers with integrated Tidal support. I'm going to focus on one for Android- Bubble UnPnP.

    Bubble's cheap- the licence costs £3, and there's a restricted free version, so you can try it out before you part with any cash. It allows you to select from a variety of media sources, and choose where to render them- either locally or on a network renderer.

    It handles all sorts of media- including local files and "cloud services". The latter is an incredibly broad category, including stuff like Google Drive, Dropbox, Quobuz and yes, even Tidal!

    Essentially, in order to use it, you just install the BubbleUnPnP app, and choose your source- in our case, going into Cloud and then choosing Tidal. At some point you'll be prompted for Tidal account details, which you enter as normal. Next you choose your renderer- you should see your Rune Audio renderer in the list. Having chosen that, you're actually ready to go. Before you get too far, it's worth going into Android's battery settings, going to the menu in the top right (the three dots menu) and into optimisation. Go into the main list of optimised apps, and set Bubble UnPnP to be "not optimised". This prevents power management from sleeping it at awkward times.

    bubble.jpg

    You can then use the slightly weird rendering of the Tidal interface to queue up music as you would the normal Tidal client. If you're looking for the search, hit the chevron ("<") in the top right of the screen, and you'll see a magnifying glass icon appear. Most of the other stuff works as you'd expect- though I haven't had much luck making new playlists via Bubble- that may be better done in the Tidal web client, or the normal Tidal client. Favourites seem to work fine, though- as does searching.

    The UI is a bit cluttered, so it's worth going into settings, and hiding the cloud services that you don't want to use, simply to cut down on scrolling. Anyway, Tidal works, and lossless sounds pretty decent, as long as you're not listening to a terrible remaster with crushed DR. Play with it for a while, to check it gets on well with your Android device before paying for the Bubble UnPnP licence app from the Google Play Store. If it all works well, then just enjoy!

    I haven't experimented with MPD clients for iOS much yet, though they do exist. For Tidal, Linn Kazoo is a surprisingly solid option though. It's a free iPhone/iPad app that will let you control Tidal playback on your Pi endpoint.

    kazoo.jpg

    ("Surprisingly" solid because the Android and Windows versions are hilariously buggy, and left me with a very negative impression of the current state of Linn's offer.)

    It's a free download, isn't locked to their hardware or otherwise crippled. It will drive Tidal, and unlike using Airplay, it doesn't have to stream all the audio through your iOS device, so it's a lot lighter on battery life. You can populate a playlist and then leave the Pi to fend for itself.

    I believe that Kazoo needs an OpenHome renderer, rather than just a base UnPnP target, so I am running BubbleUnPnP server on my NAS, which has the ability to create proxy renderers like OpenHome, UnPnP/DLNA etc. for some devices that can't do that.

    There's loads of other stuff that you can do with this setup (for example, control it from JRiver of UnPnP), but although we've barely scratched the surface, I think this is quite long enough already...
     
    Last edited: May 13, 2017
    Deep Funk, Mkoll, ultrabike and 26 others like this.
  4. Kattefjaes

    Kattefjaes Mostly Harmless

    Friend
    Joined:
    Sep 5, 2016
    Likes Received:
    5,096
    Dislikes Received:
    41
    Trophy Points:
    113
    Location:
    London, UK
    Bonus/advanced tweaks

    Because everyone has nervosa, there is always tweaking to be done- reducing noise by possibly inaudible levels are a very popular tweak. Surely if you do enough of these, the difference is real.. amirite?

    You don't have to do any of this stuff, so ignore it if it makes you nervous, you'll still get great sound.


    Disable wireless

    OK, here's the first one- disabling all the wireless stuff on the Raspberry Pi. If you have decided that the convenience of a wireless endpoint isn't as important as the nervosa angle of reducing all possible sources of noise, you can turn off the WIFI and Bluetooth chipsets, by preventing the operating system from loading the drivers for them.

    Only do this once it's already working on your wired network. Connect via SSH as above, and:

    nano /etc/modprobe.d/disable_rpi3_wifi_bt.conf

    Remove the "#" at the start of each "blacklist" line. Hit ctrl-x to exit, remembering to say yes to save. Reboot. Job done.



    Downclock the Pi

    Lowering the clock speeds of CPU, RAM and GPU will reduce the RF noise. It's possible that making RAM speed an integer factor of the CPU clock might reduce some RF harmonics too. Don't laugh. In any case, it can't hurt, and will make it use less power and run cooler.

    SSH in, and then:

    nano /boot/config.txt

    Scroll down to the bottom and add the following:

    boot_delay=1

    arm_freq=800
    sdram_freq=400
    core_freq=400
    gpu_freq=300
    over_voltage=-4
    sdram_over_voltage=-4
    gpu_mem=16


    Hit ctrl-x to exit, saving what you did. Reboot.

    (Idea blatantly lifted from Archimago. Even a stopped clock and all that...)



    Add a BNC out

    If you have a DAC that supports BNC in, theoretically, you should get better results from using BNC rather than coax. You can solder a BNC connector onto the board very easily. If you want one that's sure to fit, Hifiberry themselves offer one:

    https://www.hifiberry.com/shop/accessories/bnc-jack-gold-plated/

    You literally just poke the relevant bits through the holes on the board and solder them. If you need advice on through hole soldering, there are decent videos on youtube. You will need to pop the Pi out of the case, and temporarily remove the small nylon nuts, and unplug the Digi+ Pro for this.

    Don't be scared, this is a super-easy job, and even a cack-handed git like me was able to do it in a couple of minutes. I did use the magnifier on my "helping hands" though, as the pads are a bit small.

    Et voila:

    pi_bnc.jpg


    Note that you shouldn't use the coax and BNC at the same time- this is probably because they're connected in parallel. The impedance would get weird, though I doubt that anything would explode. Using optical out at the same time should be fine, however.

    Transformer isolation

    If your DAC is grounded (i.e. uses a grounded three-pin IEC or similar, like the Yggdrasil or Gungnir Multibit, rather than a wallwart without a proper ground and a two wire cable like the Modi Multibit), you can take advantage of the Digi+ Pro's transformer-isolated output on S/PDIF over coax or BNC. To do that, simply open the jumper on the board. Don't throw the jumper away, just park it over one of the pins, in case you ever need it again. This should give you a slightly electrically-cleaner connection.

    Cloning a live system

    I wanted to clone the running system onto another card (it's easy for sudden power loss to corrupt things as Rune doesn't do a read-only filesystem thang). If you want to do the same, here's a way to do it. This is some slightly gnarly command-line stuff; ignore it if you hate this sort of thing.

    For this, you'll need a USB microSD reader that you can plug into the Pi, and a spare card that you don't mind overwriting. I'm assuming you haven't expanded any partitions post-install in your Runeaudio setup, so the running system is only using a couple of GB on the live card. This means that a 4GB card or bigger is probably sensible for the cloning. I have a pair of class 10 32GB cards for my Pi, as they're good value these days, and give you plenty of space for future nonsense. However, because the install is only using a couple of GB right now, it's a lot quicker to check what's in use, and only copy that.

    Take the spare micro-SD card and stick it in the USB reader, then plugged that into the Pi. Then SSH in and to see what the new device was called, I typed:

    dmesg

    The last few lines of dmesg output should be something like:

    [ 4413.654561] usb 1-1.5: new high-speed USB device number 4 using dwc_otg
    [ 4413.765864] usb 1-1.5: New USB device found, idVendor=0781, idProduct=b7b1
    [ 4413.765879] usb 1-1.5: New USB device strings: Mfr=3, Product=4, SerialNumber=5
    [ 4413.765888] usb 1-1.5: Product: MobileMate Micro
    [ 4413.765896] usb 1-1.5: Manufacturer: SanDisk
    [ 4413.765904] usb 1-1.5: SerialNumber: 000000267003
    [ 4413.766973] usb-storage 1-1.5:1.0: USB Mass Storage device detected
    [ 4413.769266] scsi host0: usb-storage 1-1.5:1.0
    [ 4414.765846] scsi 0:0:0:0: Direct-Access Generic STORAGE DEVICE 9407 PQ: 0 ANSI: 0
    [ 4415.096180] sd 0:0:0:0: [sda] 61521920 512-byte logical blocks: (31.5 GB/29.3 GiB)
    [ 4415.097007] sd 0:0:0:0: [sda] Write Protect is off
    [ 4415.097019] sd 0:0:0:0: [sda] Mode Sense: 03 00 00 00
    [ 4415.097820] sd 0:0:0:0: [sda] No Caching mode page found
    [ 4415.097831] sd 0:0:0:0: [sda] Assuming drive cache: write through

    [ 4415.102883] sda: sda1 sda2
    [ 4415.106457] sd 0:0:0:0: [sda] Attached SCSI removable disk

    This means that the external card is called "sda", or more fully, "/dev/sda" (sda1 and sda2 are just the partitions left on the card, we don't care about those). Next we need to find out about the current in-use system card. I'm using 32GB cards, but only using a tiny bit for Rune, so it's a lot quicker to only clone as much as we're actually using. To see what's in use, we need to look at the live microSD card. To see what it's called, you can do:

    Code:
    mount | grep "on\ \/\ "
    (Using a code tag there, or the forum turns it into pirate smileys. You might want to copy and paste this command, it's easy to mis-type.)

    ..which should return something like

    /dev/mmcblk0p2 on / type ext4 (rw,relatime,data=ordered)

    This tells us that the root filesystem (called "/" in the land of *nix) is mounted on mmc block device 0, partition 2. Don't worry if that makes no sense to you- it's just a way of describing a storage device. To get the name of the whole device, we just remove the partition bit of the address, so the root device is:

    /dev/mmcblk0

    Yours should probably be the same, but if it isn't adjust the next line as needed. To find out what's actually in use for partitions overall on this device, you can do:

    fdisk -l /dev/mmcblk0

    which should produce output something like:

    Disk /dev/mmcblk0: 29.3 GiB, 31499223040 bytes, 61521920 sectors
    Units: sectors of 1 * 512 = 512 bytes

    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x00005f47

    Device Boot Start End Sectors Size Id Type
    /dev/mmcblk0p1 2048 206847 204800 100M c W95 FAT32 (LBA)
    /dev/mmcblk0p2 206848 4384767 4177920 2G 83 Linux


    The bits that are relevant here are the sector size and the last sector number of the last partition. This tells us exactly how much data to copy/where to stop. We now know enough to do the cloning. It takes a single command, into which we'll plug the info from above. It looks like this (don't copy/run it yet, you need to check it's correct):

    dd status=progress if=/dev/mmcblk0 of=/dev/sda bs=512 count=4384768

    The "if=" bit, the input, points to the root device, the output ("of=") points to the external card. The block size ("bs=") should be 512, as above. The last sector number is used for "count=", but for the sake of paranoia and off-by-one errors, I like to add one to it. That won't harm anything, and it's a good idea.

    The "dd" command copies raw data block by block from one card to another. Don't get the input and the output the wrong way around, that would be bad.

    Assuming that you have checked the command's arguments and corrected them for your system as needed, run it! (Obviously, you need to avoid things like stray spaces in the middle of args and things, so take care.)

    You should see it chug away for a while, and at the end, you should see something like:

    2242871808 bytes (2.2 GB, 2.1 GiB) copied, 1267 s, 1.8 MB/s
    4384768+0 records in
    4384768+0 records out
    2245001216 bytes (2.2 GB, 2.1 GiB) copied, 1270.32 s, 1.8 MB/s


    Viola! That's everything done. You can pull the new card out now- it doesn't need unmounting or anything, as we never mounted any filesystems. It will contain a full bootable clone of your current system.

    -------------------


    OK everyone, there's my large, rambling braindump about building a Raspberry Pi-based music streamer. Please let me know if I've bolloxed something up, and I'll go fix it.

    I've corrected a ton of typos already- apologies for any that slipped though- as well as any places were it just turns into gibberish. It's hard to proof-read something when you've been staring at it for long enough :)
     
    Last edited: Aug 29, 2018
    Deep Funk, Mkoll, ultrabike and 18 others like this.
  5. Lasollor

    Lasollor Friend

    Friend
    Joined:
    Apr 18, 2016
    Likes Received:
    293
    Dislikes Received:
    0
    Trophy Points:
    63
    Location:
    Japan
    Awsome guide!
     
  6. Br444m

    Br444m Acquaintance

    Joined:
    Feb 14, 2017
    Likes Received:
    38
    Dislikes Received:
    1
    Trophy Points:
    13
    Location:
    NL
    rtaylor76 likes this.
  7. beemerphile

    beemerphile Friend

    Friend
    Joined:
    Dec 19, 2015
    Likes Received:
    446
    Dislikes Received:
    0
    Trophy Points:
    63
    Location:
    Danielsville, GA USA
    Much to learn over here. Does you advice to we Yggdrasil owners mean that the SQ of these devices is not as good as say an Auralic or Aurender box?
     
  8. silvrr

    silvrr Rando

    Joined:
    Dec 16, 2016
    Likes Received:
    16
    Dislikes Received:
    1
    Trophy Points:
    3
    Location:
    Chicago
    Great write up, I prepared something similar over on head-fi awhile back. Whats the reason for the kernal update?

    Does runeaudio have a hotspot option? Ive been using volumio lately (just what I have, rune is just as good) but the hotspot option is really nice for setup. It creates a hotspot that you can connect to to get the initial network setup complete. I used it at a recent meet and just let people control it with their phones.

    I haven't tried the digi+ but a word of warning to anyone wanting to try the USB out. It can be finnicky with certain DACs. My modi was a no go, Parasound Zdac played perfectly, Chord Mojo was a snap, crackle pop due to the USB setup (no galvanic isolation) , Schiit Jot DAC works fine.
     
  9. Grahad2

    Grahad2 Red eyes from too much anime

    Friend
    Joined:
    Jan 26, 2017
    Likes Received:
    1,218
    Dislikes Received:
    2
    Trophy Points:
    113
    Location:
    Singapore
    You don't need to uncompress USB Image Tool, but you have not removed the .gz extension post extraction (not quoting to make it unconfusing once fixed).

    I find Rufus the fastest at doing imaging, but it's optional (the website itself describes 2 tools, which should be enough already.)
     
  10. Lasollor

    Lasollor Friend

    Friend
    Joined:
    Apr 18, 2016
    Likes Received:
    293
    Dislikes Received:
    0
    Trophy Points:
    63
    Location:
    Japan
    The whole meaning of this setup is using a hat (like the Digi+ Pro). In my opinion you should never use the usb out from the PI.
    You need to update the kernel because the the Digi+ Pro requires an up-to-date kernel (at least summer 2016) and Rune Audio (and Volumio too) runs on an older kernel.
     
    Dino likes this.
  11. Vansen

    Vansen Gear Master (retiring)

    Staff Member Friend
    Joined:
    Nov 19, 2016
    Likes Received:
    2,298
    Dislikes Received:
    3
    Trophy Points:
    93
    Location:
    Seattle
    I laughed my ass off at these two quotes. Having a few Cisco carts under my belt, I'm pretty sure that you're most likely to fall into the 1% if your job title is something along the lines of "network engineer."

    I'm also a pretty sure that I've been guilty of falling on the far end of this graph at some point...

    [​IMG]

    And I love the guide. I've been contemplating a venture down this path as an experiment, and this certainly helps point me in the right direction where I've had questions or have simply been too lazy so far.
     
  12. haywood

    haywood Almost "Made"

    Joined:
    Oct 22, 2015
    Likes Received:
    213
    Dislikes Received:
    1
    Trophy Points:
    43
    I've used the command line tools a few times to write disk images but Etcher provides a slick graphical interface and is free: https://etcher.io/

    The best suggestion if you're thinking about this is to just do it, the cost is ludicrously low for this hobby. The pain points are mainly choosing a distro because switching between them isn't fast (unless you have a stash of microsd cards) and setting up your shared folders where errors if any tend to be cryptic.

    If you do decide to jump in check out the other threads while you wait for your gear to arrive, there is lots of good advice, examples from people who have gone before, and information on a sweet new hat that people here had a chance to help with.

    http://www.superbestaudiofriends.org/index.php?threads/raspberry-pi-i2s-to-spdif-hat.1990/

    http://www.superbestaudiofriends.or...-a-cheap-transport-that-made-me-happier.1970/
     
    hikergrl and FlySweep like this.
  13. shabta

    shabta Almost "Made"

    Contributor
    Joined:
    Jan 14, 2016
    Likes Received:
    126
    Dislikes Received:
    0
    Trophy Points:
    43
    I wish this had been around when I started down this path, might've saved me some time...
     
    Dino likes this.
  14. Kattefjaes

    Kattefjaes Mostly Harmless

    Friend
    Joined:
    Sep 5, 2016
    Likes Received:
    5,096
    Dislikes Received:
    41
    Trophy Points:
    113
    Location:
    London, UK
    There are certainly some slight improvements possible that way. I just wanted to keep this really simple though- with plug and play bits, so no-one needed to do any soldering or anything else scary.

    I really wanted to make it accessible to people who don't normally do DIY stuff- as it's a bit of a shame how badly people are getting ripped off with decrapifier snakeoil. There's loads of scope to refine it, with clever powering, different boards, all sorts of stuff. Have a look at the stuff that @Michael Kelly and @Scott Kramer have been up to though, if you want to go down this route- they've done some fantastic work.

    You don't, and it's supposed to handle it, you're right. However, if you're careless, it will write the compressed image to the card- which obviously won't boot, and lead to lots of frustration and staring at the little red light on the Pi.

    I tested this bit on a non-technical volunteer, and it turned out to be a small gotcha. So while you're totally right, uncompressing it isn't strictly necessary, if can save time and a bit of pain for people who don't understand as much as you.

    Hah, I wasn't trying to patronise people- but I know we have a very mixed audience whose expertise falls all over the place. Some people do have network and computer nerdery, some people have expertise that lies elsewhere. They help us with their time and insight when we need help with "why is my tube amp buzzing in one channel?" or how the hell to choose a tweeter, so it's only fair that computer nerds reprazent too.

    I'm glad you like the guide (though that's a bit of a grand word). I've seen people interested but not sure where to start, so I've been quietly fiddling with some of the options for a while. I tried to be pragmatic and find a balance between "doesn't suck" and keeping it really simple to implement.

    Although the Digi+ Pro works nicely out of the box with a modern kernel, most of the RPi audio minidistros have quite old kernels (often 4.1.xx or so).

    Have a look at the little spoiler tag in the first post about choosing a distribution, it explains the tradeoffs that I made, in settling on Rune.

    No idea, to be honest. I wanted to focus initially on wired networking because the Wifi isn't great on the RPi 3. I know Volumio and Moode do, but I've not tried on Rune. Trying to keep it straightforward means you miss stuff out.

    (I like Volumio too, and have it running on another Pi- but the kernel is too old for the Digi+ Pro, and it's non-trivial to update the kernel, due to the way it boots from an initrd. Until the Volumio team update, it's not worth the hassle of using it with the Digi+ Pro)

    The whole point was to get away from USB and the like :)

    USB audio is pretty bad, it not only tends to carry a load of electrical noise (as you've noticed), but it works asynchronously, and is then clocked by the USB receiver. Most off-the-shelf USB receiver chipsets are really poor, and use cheap clocks- causing all sorts of jitter, and thus mushy, indistinct sound (the effect being more pronounced as you go up through the frequency band). It doesn't matter how hard you "reclock" the clockless USB audio going in, the DAC itself buggers it up again.

    While there are a few DACs with crazy quality clocks to avoid this problem (the GeekOut stuff has famously killer clocks, as well as good electrical filtering), most don't. Generally, the USB is only present in stuff like the Schiit DACs as a convenience factor (and because they want to actually sell to a wide range of users). It is pretty much always your worst option.

    If you've been using your DAC over USB, the difference in clarity with a stable SPDIF source, especially in the higher frequencies, will be be a pretty striking. Even the difference between motherboard SPDIF and a decently-clocked source is quite nice.

    Sorry, end of lecture, but you've hit on exactly why all of this is worth doing- it's a project to build a cleaner source for your DAC for a small amount of money.

    I do have a Fulla 2 plugged into another Pi, which feeds a small integrated receiver, but that's a modest system for non-critical listening.. and it's just fine for what it is. The above is when you're trying to fine-tune the sound of a setup where you will hear the difference.
     
    Last edited: Feb 21, 2017
    hikergrl, auri, Br444m and 1 other person like this.
  15. pedalhead

    pedalhead Friend

    Friend
    Joined:
    Oct 2, 2015
    Likes Received:
    2,114
    Dislikes Received:
    4
    Trophy Points:
    93
    Location:
    Oxfordshire, UK
    Last edited: Feb 21, 2017
    FlySweep, Lasollor and Kattefjaes like this.
  16. Kattefjaes

    Kattefjaes Mostly Harmless

    Friend
    Joined:
    Sep 5, 2016
    Likes Received:
    5,096
    Dislikes Received:
    41
    Trophy Points:
    113
    Location:
    London, UK
    Oh, good find. Worth trying out the underclocks and seeing how it shakes out. Picoreplayer is incredibly slim and efficient, the more feature-packed distributions are a bit heavier so it'll be interesting to see if there are any ill effects.

    (Also, I think Picoreplayer works out of the box with the Digi+ Pro, so people happy with a Squeeze-y style setup could find that a great option. It's super-efficient and boots very fast, also.)

    Pi 3 can occasionally get warm, so it might be worth some underclocking for people in really hot climates, too.

    The only bit that is a bit problematic is:

    ..worrying about the science is what keeps things interesting!
     
    pedalhead likes this.
  17. pedalhead

    pedalhead Friend

    Friend
    Joined:
    Oct 2, 2015
    Likes Received:
    2,114
    Dislikes Received:
    4
    Trophy Points:
    93
    Location:
    Oxfordshire, UK
    Yep, I'm using an RPi 3 with his underclock settings in my speaker system and it sounds great. No idea if his settings make any difference, but they don't hinder and they make sense from a power consumption and heat point of view. I'm using an iFi psu but wouldn't have bothered tbh if I'd read his article first.
     
    CarlTorn and Kattefjaes like this.
  18. Kattefjaes

    Kattefjaes Mostly Harmless

    Friend
    Joined:
    Sep 5, 2016
    Likes Received:
    5,096
    Dislikes Received:
    41
    Trophy Points:
    113
    Location:
    London, UK
    Definitely worth a go with that underclock, i reckon. If you can run cooler and draw less power with no unpleasant side-effects, that's always worth it.

    I have one of those iFi thingies too, bought out of interest- since I've got it, I might as well use it. I'm not hearing obvious noise floor issues even over coax out, but it stops me wondering.

    I feel like I'm missing the joke about that TEAC DAC though:

    ..and better yet, this: http://www.changstar.com/www.changstar.com/index.php/topic,1276.0.html

    Was this a notorious hype piece of its day?
     
    Last edited: Feb 21, 2017
  19. Madra

    Madra Rando

    Joined:
    Oct 18, 2015
    Likes Received:
    22
    Dislikes Received:
    0
    Trophy Points:
    8
    Great Write up @Kattefjaes . I am really tempted to build myself a Pi with a Digi Hat.
    Just a question: What does it take to stream Tidal with such a setup?
     
  20. Grahad2

    Grahad2 Red eyes from too much anime

    Friend
    Joined:
    Jan 26, 2017
    Likes Received:
    1,218
    Dislikes Received:
    2
    Trophy Points:
    113
    Location:
    Singapore
    Yes. I would take a Sansa Clip Zip over the TEAC. It was the Chord of its era.
     

Share This Page