An Upgrade To A Raspberry Pi Media Server

For the last few years, [Luke] has been running a music server with a Raspberry Pi. With the new Raspberry Pi 2 and its quad core processor, he thought it was time for an upgrade.

The build consists of a Raspi 2, a HiFiBerry Dac to address the complaints of terrible audio on the Pi, an aluminum enclosure, and some electronics for IO and a real software shutdown for the Pi. The Arduino also handles an IR remote and a rotary encoder on the front of the enclosure.

The software is the Logitech Media Server along with Squeezeslave. The front end is custom, though, with functions for shutdown and receiving IR remote codes. Everything is served up by Flask, with a 32GB microSD card stuffed into the Pi to store MP3s. All in all, a great build.

23 thoughts on “An Upgrade To A Raspberry Pi Media Server

  1. Note that the S/PDIF output version would give better results with digital receivers. Of course, if you have a recent digital receiver, you can just plug it into the HDMI output. The Pi isn’t meant for serious gaming so any lag added by the receiver shouldn’t affect usability, although a possible downside is that the receiver might need to be switched on when all you need is the video screen…

    1. you don’t want hdmi. hdmi is full of drm. you DO want spdif since it plays nicely with many digital inputs.

      I use a digital crossover instead of an analog active one of the passive lcr ones you see inside spkrs. keeping the H,L separate all the way to the drivers is a nice architecture and not hard to implement, as long as you stay with pure 2ch pcm spdif (not even 5.1, but 2 ch linear spdif).

      usb to spdif is not hard to do – but as we all know, the pi sucks on usb and can’t be counted on. even worse, if you use a nas for your music, you have to go thru usb to get to ethernet and this will conflict with usb audio.

      i2s audio is probably better here since it avoids usb, but on any ‘sane’ pc system, usb audio (uac2 if you can) is the way to go.

      1. the hifiberry dac is not a great dac. I have used that pcm5102 chip before and its a ‘cellphone audio’ chip, meaning, its NOT hifi. why? it has a gibbs problem where, when the audio levels stay too close to 0db (loudness war, sigh) the internal registers overflow and clip. worse, they can clip in VERY bad ways, like a 180deg inversion of the wave! the only way to protect against this is to digitally attenuate the signal before it hits the dac chip, by 2db or sometimes even 3db. that’s a lot of atten and phones will do this, as they always have dsp ‘in line’ but for hifi you often don’t want to use digital atten (it chips resolution,effective bits from your dac output).

        a few of us (diyaudio) tried the pcm5102, saw it had a major gibbs overflow problem and went with another chip. its a ‘dollar dac’ and so you can’t expect much from it. really a shame the hifiberry guys didn’t do their homework and picked such a bullshit chip when there are so many more that ARE really good.

        1. For a similar build, I simply used the Asus Xonar U3 and I think it sounds great. Both with analogue and s/pdif outputs (with a Yamaha RX-V559 receiver and Alesis M1 mkii passives)
          This also being a $30 DAC, it’s my go-to for adding decent sound to any system. Also a decent amount of oomph for headphones (even 64ohm)
          It’s powered by a C-Media chipset

          1. the asus xonar is a reasonable pci/pcie card. or, were you referring to a usb dongle? I have not seen any usb asus dongles, though.

            usb is really the new preferred spdif (and also dsd!) output. with uac2 (asynch ‘pull based’ i/o instead of ‘push based’ which uac1 is) you can get proper local clocking (pc is no longer the clock master; the dac now asserts a local set of clocks), you can run 24/192 or higher and also support dsd in 2 formats (dsd over usb/pcm, called DoP) and dsd-native. dsd is something to think about long-term; even though right now its a bit early for the dsd material to be buyable by most folks.

            firewire is mostly dead for audio and spdif is a one-way comms path. with usb, you have a bidirectional comms path and you can flow-control the packets, ACK/NAK them plus have a control channel for changing parameters – something spdif will never have.

            fyi

        2. I think you should always control the digital signal going in, you have so many bits, you want to use those in such a way that it encompasses the actual sound signal and not pointlessly overshoots and ignores part of the signal you are trying to output. And if you mess up the input signal then you are doing something wrong. And if a DAC manages to hide that a bit that’s cute, but the problem is still there I would say.

          Nevertheless I have no real idea what the best DAC for the raspi is from the available options, but I’m sure there are really good ones and not so good ones.

      1. i dont think that statement is true.

        if you really cant tell the difference between audio from a CD and mp3s created from said disc, its probably your headphones or speakers are unable to reproduce the differences (dont listen in your car, for example). i think most folks can. \

        now comparing 192kbps v0 to a 256kbps mp3 sure, a little tougher.

      2. When I sit in front of my $4,000+ Home Cinema rig, and compare anything less than 320kps against CD Audio, then yes. Admittedly 320kps MP3s are little harder to notice the difference, but eventually I do. As I was getting older, I wondered if it was all in my head, so I did a controlled listening test about 3 weeks ago. Was surprised that my 40-year-old ears still had that level of fidelity.

          1. Even in a parked car (with good speakers, mind) you can tell the difference between a CD and an MP3CD filled with 128 or 192 audio. But it does depend on the type of music; if there is brass and cymbals you can tell the difference while common pop music would be almost indistinguishable. And it depends on your hearing (my high frequency hearing is +3db or more above average, why yes I saw an audiologist). Pop music balanced for Beats headphones, earbuds, or just driving music is always harder to tell the difference in.

            Admittedly, I only tested this with second-hand Koss studio headphones on a Harman Kardon loaded laptop. Some of the lower bitrate MP3s were converted a decade ago, so they may not benefit from newer encoders. 192 < 320 by a large amount, 320 mp3, ogg and flac lossless are harder to tell the difference in; storage is so cheap now that I feel keeping things in unpatented lossless format for storing and converting down to 192 mp3 for travel devices makes the most sense.

        1. It’s not just the bit depth but also channel separation, MP3’s cheat on that too. And you can tell, although since it’s not discussed a lot the so-called ‘audiophiles’ aren’t taught to pretend notice it. (yes, there is some sarcasm there.)

  2. Matt, Ive got something like 570 albums in mp3 format without some of the cds . So haven’t really got a choice at the moment . But with my hearing and the dac i’m pretty happy the way it sounds at the moment . Possibly in the future i may look in the the lossless format. Luke

  3. I really do not understand all the circuitry for the IR receiver. you only need to hook the IR receiver to pin 18 of the RasPi and power it. nothing else is needed.

    1. Tim, as i don’t leave it on all the time and only switch on when needed. When switching off , thw arduino removes the power a few seconds after a halt ensuring file system is shutdown before removing power.
      I decided to connect the Ir reciever to arduino not the rasPI so i could boot and shutdown via a remote so it works like stand bye mode .

      1. Since IR receiver modules are less than a dollar/euro you could just get one to control the power-supply I suppose. Maybe use an attiny to detect a single command and have it switch the power on and off. That should not be too expensive.

  4. Wow, Logitech media server.

    That brings back memories of my SlIMP3 and it’s lovely VFD display.

    I had it and a couple of Chumby’s as clients to my media server back in the day.

    I wonder if the server itself is still a bunch of Perl.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.