Raspberry Pi Whole Home Synchronous Audio With Phone App Remotes


Introduction: Raspberry Pi Whole Home Synchronous Audio With Phone App Remotes

The goal is synchronized audio and/or individual sources in any room, easily controlled with a phone or tablet via iTunes Remote(apple) or Retune(android). I also want the audio zones to turn on/off automatically so I turned to the Raspberry Pi and Hifiberry for a set it and forget it solution.

Parts List for one audio zone:

For setup only

  • USB mouse
  • USB keyboard
  • Hdmi display
  • USBpower plug
  • USB to micro USB cable

Step 1: Download to Your PC

  1. Download Sd card formatter (or not, I didn’t need it) This build will only be used as an airport amplifier so 16G is plenty of room and the card came formatted as fat32.
  2. NOOBS On my windows 10 machine, I simply chose my sd card as the destination to unzip NOOBS after downloading.
  3. Install VNC viewer on a PC so you can remote desktop to your Pi after you get it set up. It's already installed on your Raspberry Pi.

Step 2: Install Raspbian OS

  1. Put the SD card in your raspberry and connect the HDMI monitor, usb keyboard and usb mouse
  2. Power the Pi with the mini usb connection. DO NOT use the usb power if your hifiberry amp is installed. (The hifiberry amp powers your raspberry)
  3. The usb mouse and keyboard will work for you at power up. Select your language/keyboard at the bottom of the screen.
  4. Select the Raspian OS.
  5. If using wifi, select your wifi network and sign in. Lots of cool stuff becomes available after your pi joins your network, don’t do it. Just stick with raspbian. Click install. Watch information about your raspberry on the screen while it installs. Just kidding. Go do something and check back later, it's going to take a while.

Step 3: After Raspbian OS Installation

  1. After booting up to your new raspbian desktop, click on the raspberry (it's like the start menu in Windows)
  2. Select Raspberry Pi Configuration and do all the following:
    2. Interfaces
      • Enable SSH and VNC (I prefer VNC, I'll tell you why later)
    3. Localization
      • Set all your stuff(time zone, country,…)
    4. Change hostname
      • Change this to the name of the audio zone. Make the name unique, you are going to have multiple zones.
  3. Reboot.

Step 4: Find the Rasberry's IP Address

  1. Raspberries set up as headless audio sources are not going to be convenient to access directly, you will want to remote into it from a PC.
  2. You will need to know the IP address of your Pi.
    • On the raspbian desktop, if you mouse over the wifi icon in the taskbar, it will pop up an info box where you can see the IP your router assigned to the raspberry. My router has a feature to select devices on the network and always assign the same IP. This was the path of least resistance to assign a “static” IP address to my Pi. A dedicated IP address makes life much easier.

Step 5: Install Stuff

If you haven't attached your sound card / amplifier yet, do that now with your Pi shut down.

Power up your Pi and open VNC viewer on your PC. A VNC server app is included with your raspberry pi and you enabled it in a previous step. Make a new connection telling VNC viewer the IP of your raspberry.

There is a command window short cut on the task bar on your raspberry's desktop. Open the command prompt and enter:

sudo apt-get update

After it finishes enter:

sudo apt-get upgrade

close the command prompt and open the raspberry menu, we'll install some software the easy way.

click Preferences => Add/ Remove Software

search for shairport-sync and install it

do the same for the EQ

Step 6: One More Time in the Command Prompt

We need to know something about the sound card

Open a command line prompt.

Enter the command aplay –l like in the example here.

Notice the hifiberry amplifier is card 1

pi@Balcony:~ $ aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: sndrpihifiberry [snd_rpi_hifiberry_dacplus], device 0: HiFiBerry DAC+ HiFi pcm512x-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Step 7: Make the Asound.conf File

You need a file "asound.conf" located at /etc/asound.conf

Lets make it. (Now we will get to why I like VNC to remote into your Pi versus something like putty)

At a command prompt on your Pi go to the /etc/ directory and enter this:

sudo leafpad asound.conf

If you were using putty, the leafpad command wouldn't work. In that case you would type:

sudo nano asound.conf

The nano command opens a text editor in the command window. Its easy enough to use but a bit clunky. You can not use your mouse and I find it a little hard to read.

Leafpad on the other hand opens up a separate window that behaves like notepad in windows. I find it easier to read and much easier to use.

However you got there, you need to make your asound.conf look like this:

pcm.!default {
	type plug
	slave.pcm plugequal;
ctl.!default {
	type hw card 1
ctl.equal {
	type equal;
pcm.plugequal {
	type equal;
	slave.pcm "plughw:1,0";
pcm.equal {
	type plug;
	slave.pcm plugequal;

Notice the lines that say hw card 1 and plughw:1,0

If your audio device found on the previous step is not card 1 you will need to modify the lines here to reflect your card.

Save your work. It must be named asound.conf and located in the directory /etc/

Close the command prompt. (you can enter the command "exit" to close the terminal)

Reboot! I have forgotten to reboot at this point before and that is so frustrating when you think something went wrong and you start trouble shooting when all you needed to do was REBOOT.

You must REBOOT here.

Step 8: Changing the Eq Levels

After boot up you should now be able to airplay to your raspberry directly from your phone. This will not multi room sync but it's still awesome. Play something.

You may find that the room needs some EQ. Open a command prompt on your raspberry one more time and we'll get the EQ set.

At your command prompt home directory type:

sudo -u shairport-sync alsamixer -D equal

What does this do?

sudo = admin rights

-u shairport-sync = run the command as another user, in this case shairport-sync

alsamixer -D equal = opens of the equalizer

By the way, if you enter:


It will take you to settings for your sound card.

Step 9: Use ITunes From a PC and Save Battery Life on Your Phone

At this point you already have a pretty awesome airport audio player. Now we can take it up a notch by opening iTunes.

Install the iTunes Remote app, or Retune on android. Open up that app and you can link your device to the running iTunes on your PC.

Now you have the awesome of shairport-sync. All your zones are playing as one. You can control the volume in each zone and browse your iTunes library from all devices that you install the app on. Your wife can start music playing and you can open the app on your phone, click now playing and see what is playing as if you had done it yourself and take control of it. Or you can turn off the room that you're in and airplay something else to your zone direct from your phone like you had done before iTunes was running.

We leave iTunes running all the time on a PC in the basement where our very large iTunes library is located on a RAID1 NAS.

I almost forgot to mention, you can also control this system with an apple watch. As the apple watch is water proof I can change songs and adjust the volume while in the shower.

Step 10: Bonus Step: Advanced Shairport-sync Parameters

The way this instructable has your raspberry set up, changes to the shairport-sync.conf file is not required but, I do make this adjustment to my audio zone builds so I better list it here.

Using your preferred method for command line text editing like you did in earlier steps, make one change to the shairport-sync configuration file, /etc/shairport-sync.conf

I uncomment "allow_session_interruption" and change it to = "yes"

// Advanced parameters for controlling how a Shairport Sync runs
sessioncontrol = { // run_this_before_play_begins = "/full/path/to/application and args"; // make sure the application has executable permission. It it's a script, include the #!... stuff on the first line // run_this_after_play_ends = "/full/path/to/application and args"; // make sure the application has executable permission. It it's a script, include the #!... stuff on the first line // wait_for_completion = "no"; // set to "yes" to get Shairport Sync to wait until the "run_this..." applications have terminated before continuing allow_session_interruption = "yes"; // set to "yes" to allow another device to interrupt Shairport Sync while it's playing from an existing audio source // session_timeout = 120; // wait for this number of seconds after a source disappears before terminating the session and becoming available again. };

This will let you hijack an audio zone with your source when someone else is using it.

Without this change, a zone could refuse to play your music when its already in use by someone else. This is not needed if you are using the iTunes remote apps, all devices using that app are just acting as remotes to control the same source. This shairport-sync.conf change is for when you are going to airplay to a zone from a new source, like directly from your phone to a single zone that was already playing from another source. If you think session interruption sounds like audio anarchy which can only lead to bloodshed, ignore this Bonus Step.



    • Creative Misuse Contest

      Creative Misuse Contest
    • Clocks Contest

      Clocks Contest
    • Oil Contest

      Oil Contest

    4 Discussions

    That is a great walk through. I did the same thing but with Apple Airport expresses.

    The only downfall to all of this is the clunkiness of iTunes.

    Its a good idea to make sure your firmware is updated.

    sudo rpi-update

    $ which shairport-sync = will show you where shairport-sync is installed

    Very sweet build. Thanks for sharing!

    Very cool. You should definitely enter this into the Raspberry Pi contest that is currently running.