Skip to content
ArtMG edited this page Jul 25, 2022 · 38 revisions

Requirement

  • Software to play audio files and online streams
    • preferably using generic services based on widely used open source solutions
      • avoid specific implementations that lock you in or don't provide for expansion
  • headless Raspberry Pi hardware (no screen or keyboard)
  • remote control from android app
    • preferably sending just instructions to the server
      • rather than streaming directly from the mobile
    • if possible managing playlists at the server side
      • avoid relying on the mobile staying connected
    • allow urls to be thrown at server
      • e.g. for YouTube videos

see also

Other topics dealt with elsewhere:

  • Volumio-and-MPD
    • Dedicated headless music player distro based on MPD - see intro below
  • Media Centre
    • Full media centre solutions for Pi, rather than simple audio
  • Multi-room audio
    • looks at technologies for local streaming of audio from one room to another
    • includes SnapCast and SnapOS
  • Bluetooth-audio-sink
    • considers Bluetooth audio receivers (sinks) using the A2DP streaming protocol
  • [https://github.com/artmg/lubuild/blob/master/help/use/Music-and-multimedia.md]
    • Common clients for audio server software
    • options for remote control
    • architecture of DLNA / UPnP
    • how to create and manage playlist files
    • lots of other useful info
  • Audio & Video diagnostics
    • troubleshooting devices and configuration for Audio and Video input and output

Software

Kodi (overkill?)

The requirements CAN be met by using Kodi software, however this ten-foot-interface media centre actually offers a much wider range of features and may therefore also take longer to configure. Also it is designed to be used and configured with a video display, and perhaps not all features can be remote controlled as effectively.

For more on Kodi please see Media Centre

Volumio

https://volumio.org/

Volumio is a dedicated distro, previously known as Raspyfi.

It is based on Linux MPD (Music Player Daemon - see below). It comes with a self-expanding installer ready to go onto an SD card (2GB or more) and a simple browser-based interface to configure all options.

Music can be based on an extended partition, another USB or on a NAS.

For full details see Volumio and MPD

Other Dedicated Distros

These are aimed at RPi hardware and, like Volumio, they use MPD as (part of) their music system:

  • Moode
    • Raspbian + MPD + WebUI (seems to use fork of RaspFi)
    • had a 16k song limit
  • Rune Audio
    • ArchLinux + MPD + webUI (by coders of RaspyFi)
    • not much release July'17 but devs say still active
  • Volumio
    • Rasbian + MPD + webui (fork of RaspFi)
  • PiMusicBox - http://pimusicbox.com/
    • Raspbian + Mopidy + CUSTOM Mopidy-MusicBox-Webclient
      • upmpdcli + shairport
    • support for various Pi DAC boards
    • integrated spotify client?
  • Archphile - http://archphile.org/
    • closed by dev Jun'17
    • ArchLinuxArm + MPD-light + ympd (webui)
    • aims to be minimal install with simple webui (no web config)
    • ? did this aim to be embedded friendly ? (i.e. minimal SD writes)
  • Voyage

others may include:

  • PiCorePlayer
    • Squeezebox player
    • Microcore Linux (LMS) + Triodes Squeezelite
    • [https://sites.google.com/site/picoreplayer/home]

Common web servers

Most distros use MPD and their own web server:

  • Moode / Rune / Volumio
    • all forked from RaspyFi but now diverged
    • richly featured, but embedded into own projects
  • Modipy
    • python tornado - see section below
  • Pi Music Box
    • custom Mopidy-MusicBox-Webclient
  • ympd
    • built on Bootstrap framework
    • light and simple

Music Player Daemon (MPD)

Linux Music Player Daemon (MPD) is a client-server architecture where MPD is controlled by Music Player Clients (MPC) - for more detail see [http://www.musicpd.org/]. the MPD wiki.

The Pi has dedicated distros based around MPD, such as mpdpup, or Volumio (see above). Or you can simply install MPD yourself (e.g. [http://www.instructables.com/id/Linux-music-server-controlled-by-an-Android-device/])

If you're not sure which MPC client to use, try starting on Android with MPDroid and Lubuntu perhaps with QMpdClient. For an exhaustive list of MPC clients see [http://mpd.wikia.com/wiki/Clients], or check out some of our choices at [https://github.com/artmg/lubuild/blob/master/help/use/Music-and-multimedia.md].

Mopidy

MPD server with integrations for many music streaming and radio services

Mopidy is Python-based, but does not run Kellerman's MPD, it simply implements its own server for the MPD protocol [https://docs.mopidy.com/en/latest/ext/mpd/#limitations]

It comes bundled with mopdiy-http which is based on the tornado-web server, again python based but supposedly good for long-term connections and scaling well.

For Arch install instructions see [https://docs.mopidy.com/en/latest/installation/arch/] NB: hit enter if prompted about libgl to accept default

DLNA / UPnP

DLNA is breifly mentioned in Media Centre but is a powerful audio component, either in its own right, or as an add-on to others.

For an overview of the technical architecture, and common software for each component see [https://github.com/artmg/lubuild/blob/master/help/use/Music-and-multimedia.md]

See also technical implementation detail in [https://github.com/artmg/lubuild/blob/master/help/configure/Networked-Services.md]

Integrating with UPnP into MPD

J.F.Dockes explains the difference between front- and back-end integration, [https://www.lesbonscomptes.com/upmpdcli/upmpdcli-or-mpdupnp.html]. He is the author of the upmpdcli front-end used by Volumio, Mopidy, and others to provide UPnP / DLNA control of MPD.

Mopidy also allows this integration with the alternative Mopidy-MPRIS + Rygel

Custom stack examples

simple Raspbian player

This stack is built on Raspbian Lite, to combine ease of deployment with performance.

  • mpd - music playing server
  • mdns - service advertisement

You may also add options like:

  • snapcast - multi-room audio distribution
  • ympd - web frontend
  • minidlna - upnp/dlna renderer
  • upmpdcli - upnp to mpd interface
# Note that on an empty Raspbian Lite 
# mpd plus all dependencies is around 250MB
# as there are all manner of codecs and other libraries
sudo apt install -y mpd libnss-mdns


Other Do It Yourself installs

  • ArchLinux
    • [http://krazedkrish.com/blog/2017/01/04/diy-music-server-with-archlinux-raspbery-pi-or-anywhere/]
    • includes MPD, 'ympd' lite web gui
    • 'minidlna' Media Server + 'upmpdcli' front end control of mpd via dlna/upnp
    • 'vsftpd' for file upload
  • Raspbian
    • [https://www.lesbonscomptes.com/pages/raspmpd.html]

Research notes

headless pi music articles

other candidate software

Server s/w:

Remote S/w:

  • XBMC Remote
  • Unified Remote (URC ?)
  • LIRC
  • For squeezebox also see Logitech Squeezebox Touch hardware

For more details on remote control software clients see [https://github.com/artmg/lubuild/blob/master/help/use/Music-and-multimedia.md]

Network Sync

WinAMP syncs with Windows boxes - what about SMB?

Streaming solutions

Spotify

There is an official spotify client player for linux, but this might be a limiting interface on a headless music server

Mopidy has an extension called Mopidy-Spotify, that appears to be integrated well enough to be controllable via MPD clients. This DOES rely on having a Spotify Premium account, but then Spotify are a commercial enterprise who look to protect their revenue streams, so most solutions are likely to have a similar constraint.

YouTube videos

These are for passing a YouTube video location from a mobile device to a server-based audio player.

Youtube has an Autoplay feature (that can be manipulated via the url) to say what similar video is 'next up' and move on to automatically play each subsequent recommendation

  • What browsers does this support?
  • Can we install such browsers onto minimal players like the Pi?
  • how can we pipe the output properly
  • how to pass the initial URL to the browser?

Need to clarify which methods can provide autoplay...

Also check for Kodi plugins that might already do similar

  • DLNA/UPNP
    • on your music server configure the optional UPNP Renderer add-on
      • in Volumio, Moode, Runeaudio, etc
      • usually provided by upmpdcli [https://www.lesbonscomptes.com/upmpdcli/]
    • on your mobile install:
      • the YouTube app
      • Control Point software such as BubbleUPnP, Allstream, etc
        • Is BubbleUPnP free version limited on this feature?
    • In the Control Point choose your server-based Renderer
    • Use the YouTube app's Share / Send To feature
    • Choose your Control Point app and it should just start playing
    • Notes:
      • This only plays the chosen video, it does NOT autoplay
      • there may be a limitation on the download frequency (e.g. capchas)
  • mopidy-youtube plugin
    • works(/ed) on PiMusicBox
    • appears to download then play
    • at Jul'17 without maintainer since Jan'16
  • omxplayer + youtube-dl (works on command line)
    • [https://6ftdan.com/allyourdev/2015/07/25/play-hd-youtube-from-the-raspberry-pi-command-line/]
  • PiMusicBox
    • MusicBox option for DLNA and Service for YouTube
  • hand-cranked on Volumio through youtube-dl [https://volumio.org/forum/play-soundtracks-youtube-videos-with-volumio-t702.html]
  • mpv video player can interface with youtube-dl with a variety of command line options
    • e.g. pass a YT playlist URL and it plays them [https://github.com/mpv-player/mpv/wiki/FAQ#How_can_I_play_YouTube_playlists]
    • need something to frontend
  • mpv, mplayer and vlc have 'no video' options
  • see autoplay URL option [http://stackoverflow.com/a/7530624]
  • see also [http://www.makeuseof.com/tag/10-youtube-url-tricks-you-should-know-about/]
    • nothing there about autoplay tho
  • see also Youtube-Viewer
  • see also [https://github.com/jeroendoggen/youtube-to-mpd]

FYI: MPEG-DASH = Dynamic Adaptive Streaming over HTTP

youtube-dl
  • [https://rg3.github.io/youtube-dl/]
  • the most widely used tool for manipulating (and downloading) YouTube videos
  • python interpreted scripts
  • download via curl, pip or use debian package youtube-dl
  • has options to choose preferred video + audio formats
    • e.g. -f bestvideo+bestaudio/best
mps-youtube
  • [https://github.com/mps-youtube/mps-youtube/]
  • originally created as a YouTube audio player
  • python
  • install from python3-pip or debian package mps-youtube
  • defaults to using mplayer but can use mpv as alternative
  • see feature request for autoplay next 'relevant' video
    • [https://github.com/mps-youtube/mps-youtube/issues/230]

Hardware

Aside from the Pi, what else do you need? Well, something to listen with. You are unlikely to have your audio hub plugged into an HDMI screen with speakers, a nd you might find plugging headphones into the Pi a bind. You will find some suggestions of speakers and amplifiers further down, but first let's consider whether you want anything installed in the Pi to give your sound a boost.

Please note that this section covers components that can cost from twenty pounds to many hundreds of pounds, and there is no guarantee you will hear the difference, or care enough to actually be happy with what you bought. If in doubt, try something cheaper first, and only upgrade if you find its limits.

DAC

As standard, the sound quality from the Pi is not bad, and is sufficient for many peoples' ears and environments. If you want better sound quality, as an alternative to the on-board audio chipset, use an external sound card or USB DAC (Digital to Analogue Convertor). Some of these are available as HAT expansion boards for the Pi.

Even cheap devices may give an improved sound quality, and by the time you've spent £30-40 you can really notice the difference.

  • IQaudio Pi-DAC+ Full HD Audio Card
  • Behringer UCA202
  • hifiberry
  • Allo BOSS Master DAC

The latter is a also a clock master. Another component driving audio quality is the quartz crystal that makes the clock tick. The cheap crystal on board the Pi can cause jitter. Clock Master boards replace this with a higher quality crystal to give very regular interval calculation during the analogue conversion.

DAC drivers

IQaudIO Pi-DAC+ Full HD Audio Card

This card uses the standard PCM512x driver for the Texas Instruments Audio Stereo DAC chipset [http://www.ti.com/tool/pcm512xsw-linux].

Raspbian provides a Device Tree Overlay file for this specific device, source at [https://github.com/raspberrypi/firmware/blob/master/boot/overlays/iqaudio-dacplus.dtbo]

  • credit p27 [http://www.iqaudio.com/downloads/IQaudIO.pdf]
    • check the current config with aplay -l
      • should show you the built-in bcm2835 devices (jack and hdmi)
    • sudo editor /boot/config.txt
    • comment out the line # dtparam=audio=on
    • add the line dtoverlay=iqaudio-dacplus,unmute_amp
      • consider ,auto_mute_amp instead
    • sync and reboot
    • check the new config with aplay -l
      • should show you
      • card 0: IQaudIODAC pcm512x-hifi-0 as card 0 Device 0 Subdevice 0
    • test as below
# Test alsa audio using commands and files built into raspbian
# play two channel voice test into device 0
speaker-test -D plughw:0 -c 2 -twav
# credit [https://polyvection.com/forums/topic/no-sound-from-my-plainamp/]
# credit [https://www.alsa-project.org/main/index.php/SoundcardTesting]
  • Arch Linux Arm distro appears to have the same Overlay available *
  • On Archphile distro you can use the I2Select command from the cli.

Troubleshooting Notes:

  • pcm512x 1-004c: No SCLK, using BCLK: -2
    • referenced in above manufacturer guide as normal output

Allo BOSS Master DAC

  • sudo editor /boot/config.txt
  • comment out the line # dtparam=audio=on
  • add the line dtoverlay=allo-boss-dac-pcm512x-audio

see section above for more help, detail, tests etc

DACBerry ONE +

Although there is a comprehensive, multi-distro install script that is referred to in the vendor's instructions

https://www.osaelectronics.com/learn/tutorials/dacberry-one-quick-start-guide/#retropie

you may well find that the only change you need for a standard default install is to use the HiFiBerry DAC+ overlay (with which this board is software compatible)

  • sudo editor /boot/config.txt
  • comment out the line # dtparam=audio=on
  • add the line dtoverlay=hifiberry-dacplus

Orchard

The ApplePi board kickstarted by Orchard Audio has been extremely well received. Although reviews from sources like Volumio and the ultra geek Audio Science Review suggest it needs the companion clock adjustment board to shine, they rate it very highly once that is done. They have now announced their new PecanPi board which takes the original ApplePi circuitry and integrates the clockmods and power filtering/regulation to give what could be a very compelling solution, if you have £200 spare from summer 2019.

DAC + AMP

If you want to do away with an extra amplifier, you can drive your speakers directly with a combined DAC and Amplifier. HATs are available for this from around £50-£60, including:

As well as getting amplification at decent quality, if not pure audiophile, these devices add the convenience of soft AND hard control. By connecting a rotary encoder, and perhaps a press button, you have the option of turning the volume up / down and mute on / off both via physical buttons or via software / remote control, with no contention.

These are best with full-range speaker units, which sound good from bass thru mid-range to tweeters, so are usually bigger and dearer. See below for speaker ideas.

Alternatively if you prefer a subwoofer to fill out the low-pitch sounds, then you'll need a 2.1 (mono subwoofer) setup (2.2 - stereo subwoofer also available).

  • Allo Piano 2.1 bundle - £150
    • one reviewer thought this just shy in quality of a £2000 setup [https://community.roonlabs.com/t/allo-reclocker-dac-amp-for-raspberry-pi/16263]

Power Supply

Before smart phones took over the world, power supplies used to be big ugly heavy blocks, which barely clung to the wall socket. Then switching power supplies became commonplace, making them compact and more efficient, wasting less power as heat. Hooray ... except the switching circuitry inside actually creates a lot of 'noise' in the signal, which can impact audio solutions.

Many vendors, reviewers and community members speak of the importance of a clean power supply. You may have noticed, in the DAC section above, mention of clock improvements to clean out the sound. Well another very significant factor in the quality of a sound signal that has to be seriously amplified to hear is that the input voltage must be regular, sufficient and clean. The Pi does enough regulation for binary computing, but DACs that have to generate an analogue signal can have better performance and quality with a power supply unit (PSU) upgrade.

You can add a filter to the USB power cable for around £20, or get a supply with a filter built in for around £50, such as the ifi iPower. Many people rate the iPower highly, but as well as just 'clean', you still have to consider the regular and sufficient. Some people with Pi3+ have written that the iPower gives undervoltage errors.

As opposed to the switching power supplies you find everywhere now, linear regulators do their work inefficiently, but very smoothly. If you are being really serious and spending loads on other components, you might want to consider a proper Linear PSU with a regulated voltage just over 5v. You may also end up with multiple PSUs for different stages of your DAC, but follow vendor recommendations on this. One popular recomendation is Audiophonics LPSU 25 at €90. You can find very similar looking devices on eBay for half that price, but until you get it and check it (with your ears or with an osciliscope) can you be sure it is correctly rated and smooth enough?

Amplifiers

Many people would hook the Pi up to their existing audio amplifier setup. Here are some options if you don't have an existing sound system.

Computer Speaker kit

The cheapet and simplest option is an amplified speaker kit designed for computers, phones or portable media players. They plug straight into the Pi's 3.5" stereo phone jack socket, take mains power, and have the amp built into one of the speakers, often the bass unit if they are a 2.1 speaker kit.

As the stereo speakers tend to be small, they can struggle to deliver bass, so 2.1's extra bass unit helps give more feel to the beat. You can spend between £30 and £150 depending on your budget / taste - Logitech and Creative are common makes, but there are so many available.

At the higher end (i.e. more expensive) you can also get Active Speakers that, contrary to normal 'passive' speakers, each have an amplifier built in.

Dedicated Amplifier

If you already have some speakers then you can get hold of an amplifier. There are many 'entry-level' standalone amplifiers for around £20 although they are rather limited on quality. SMSL does some acceptable deciated amps from £35 upwards, and some people find the SMSL SA-50 at £60 great value, or there is a SA-98E for £100 with a lot more raw power. Behringer is also a popular make in this range, and some FX-Audio models have been very well received.

Those whose ears have been spoiled by more expensive hifi might find these amplifiers a little rough in places, and there is a whole spectrum available to suit their budget and taste. Most low-end to mid-range hifi amplifiers are 'integrated' amplifiers, they have other components built in, which you proabably don't need.

In some cases, spending £200-300 on an integrated device might not net you any significant improvement on the low end dedicated amps, but shopping around and following advice should improve your results. Then there are occasional devices that get outstanding reviews for their price, like NAD D 3020 at £400 or Rega Brio around £600, and these both have solid older versions from a few years back that you should be able to pick up much cheaper. The former has a built-in DAC that you could try using with your Pi, but it might just serve to illustrate the improvement you can get with a modest spend on a Pi DAC hat.

Beyond these mid-range integrated amps, you could look at Power Amplifiers, which are dedicated to taking a line level signal, such as the DAC provides, and feeding it directly to speakers. However these tend to be a top-end product and could cost you a grand or more.

Speakers

Speakers can be a highly subjective choice, and can sometimes work better or worse with particular amplifiers, so specific recommendations can be tough to make. However, if you are looking for compact speakers that are particularly well reviewed and recommended consider: Monitor 50's (£150), QAcoustics 3020 (bookshelf £200) or QI65s (in-ceiling £200), Keff Q350 (£500).

Appliance alternative

Before settling on Raspberry Pi as a hardware platform, we considered using a dedicated audio appliance. As you can see from list of prices below, there is very little available on a budget. And we doubt any of the options below would give you the flexibility of the Pi platform in terms of software functionality.

search terms

  • "network audio player"
  • "audio streamer"
  • "network music player"
  • "network stereo receiver"
  • "music streaming system"

With Amp

  • Cocktail Audio X30 £600 incl CD + HDD
  • Onkyo CRN755 £250
  • Monitor Audio A100 £300
  • Sonos Connect:Amp
  • Simple Audio "Roomplayer+ with Amp" (only iOS or PC) £500
  • Linn Sneaky
  • Squeezebox Touch

Without Amp

  • QED uPlay stream - £70
  • Pioneer N50K £500
  • Cambridge Audio Stream Magic 6 v2 £700
  • Cyrus Xa £1,250
  • Naim NDS/NDX £3,000-£6,000

Other makes to check: Raumfeld, Logitec, Lenbrook, Majik ?

Clone this wiki locally