Creating an AirPlay Network Audio Player with Volumio

Creating an AirPlay Network Audio Player with Volumio

Volumio Raspberry Pi

raspberrypi29_main
Today is an exciting opportunity to discuss about an electronic kit project that doesn’t need any command input at all!
We will play with “Volumio”, an OS recommended for Raspberry Pi new users.

Because Volumio comes with functions allowing you to play music, you can use Volumio as a network audio player immediately after installing it. Out of all the possibilities, we want to try using AirPlay! Let’s transform Raspberry Pi into an AirPlay-compatible speaker using Volumio!

What is Volumio?

Volumio – Audiophile Music Player
Volumio is an OS that specializes in playing music. Because it is distributed as an image file, you can start using it right away after writing it on an SD card. There are 4 types of compatible devices: Raspberry Pi, SolidRun Cubox, Udoo and Beaglebone Black.

By the way, Volumio was formerly called RaspyFi.

raspberrypi29_img01

Figure 1

If you go to the RaspyFi website, the above will pop up. While they were supposed to have an archive file, the “DOWNLOAD” page is no longer available (as of September, 2015).

Installing Volumio

Let’s start installing Volumio! Download the image file for Raspberry Pi from the download page.

raspberrypi29_img02

Figure 2

The top section of the left menu is for Raspberry Pi.
If you click the “Download” button, a different website (sourceforge.net) will open, and the download will start automatically after a few seconds. The file is a ZIP archive.

Today, the OS we downloaded was the version 1.55 (released in August 2nd, 2015).
When opening the ZIP file, you will find an image file called “Volumio 1.55PI.img.” Then, all you have to do is to write this image to an SD card! Because we were working in a Windows environment today, we used a software called “Win32DiskImager” to do that. Refer to the two below links to downloadWin32DiskImager and see how to use it.

Win32DiskImager
Review of the Raspberry Pi 2 and Comparison with Previous Raspberry Pi Models

Once you have written the file to the SD card, you are set. All you have to do is to boot Volumio, and get to work!

Booting Volumio

To use Volumio, besides the Raspberry Pi, you will also need a LAN cable and a speaker (or headphones). We need to prepare the environment to enable us to use a LAN connection to operate with the default network settings. We will talk about that later, but because I couldn’t connect my iPhone properly with this setup, I used a separate Wi-Fi adapter.

Here’s another tip. Do not connect the Raspberry Pi to the display during the setup. It seems that when connected to the display with HDMI, the sound of the display’s speakers will be prioritized and no sound will come from the Raspberry Pi audio port.
Now, let’s turn on the Raspberry Pi and boot Volumio!
If you access “http://volumio.local/” from the browser of a computer connected to the same network, you will see the following screen.

raspberrypi29_img03

Figure 3

You can start using Volumio right away. No initial setup or command input are needed!

raspberrypi29_img04

Figure 4

You can display the menu by clicking in the top right icon. If you accidentally booted while still connected to the display, restart it using the “Turn off” at the bottom.
Let’s have a look at the detailed settings for later, and try to play to some sounds!

Testing the Sound

raspberrypi29_img05

Figure 5

At the bottom of the screen, you can find three functionalities related to playing music: “Browse”, “Playback” and “Playlist”. Let’s start by “Browse” on the left.

raspberrypi29_img06

Figure 6

By default, only “WEBRADIO” is displayed. If you click on it, you will see a list of radio stations.

raspberrypi29_img07

Figure 7

Double click, or click on the menu icon to the right and select “Add and play” of the station of your choice, and it will start to play! While it may take some time to connect because those stations are internet radios, just hold on patiently (in my setup, the first station called “AudiopholeClassical” took 10 seconds to start playing).
If you can’t hear any sound, click “Playback” in the bottom menu and return to the initial screen.

raspberrypi29_img08

Figure 8

The two circles in the center of the screen show the playback status. The left circle is the playback time, and the right circle is the volume. (The current song title is displayed at the top)

If you can’t hear the sound, the volume may be too low. Adjust it by twisting the short green bar in the right circle.

After testing the sound through headphones, I felt that the most comfortable volume was around 70. Some people said that with volume under 80, they could hear some white noise. So, we recommend adjusting the volume around 80.

raspberrypi29_img09

Figure 9

Here’s the “Playlist” screen.
We had selected “Add and play” when playing the radio. This is where the radio station was “added” to. While this isn’t very useful when listening to the radio, if you want to repeat and play a music file again, this function is very useful.

Playing Music from a NAS

For our next step, let’s play a local music file from a NAS.

raspberrypi29_img10

Figure 10

(Select Network=> select a NAS Music file)
The above image is the screen of a computer after connecting to Volumio using the same network.
As the name “NAS Music” suggests, NAS is included in the standard package! If you want to save music files inside the Raspberry Pi, place them in here.

Similar to “Ramplay,” you can also choose to keep the file temporarily on the Raspberry Pi, but the file will disappear once you exit the program. After some research, it seems that this method requires less work than using the NAS and the sound quality should be better. I personally compared the sound, but from my setup I couldn’t really tell the difference. It may depend on the quality of your headphones or speakers.

As the name “USB Music” also suggests, this function is used when a USB drive is connected to your computer.

“WebRadio” stores the playlist of the internet radios that we had just listened to. By default, you can store up to 50 files! This is more than enough!
Now, let’s place a music file in the “NAS Music” folder. You can store music with the files still divided into folders. The official website lists 6 file formats that can be played: FLAC, MP3, WAV, AAC, ALAC and Musepack.

raspberrypi29_img11

Figure 11

Once you have prepared the file, return to Volumio through the browser.
If you leave it this way, you still can’t look inside the “NAS Music” folder. To reload the NAS data, select “library” from the “MENU” on the right side, and open up the screen for database maintenance.

Once you click the green button “UPDATE LIBRARY” from the upper part of the screen and return to “Browse”, you can see that the “NAS” item has been added!

raspberrypi29_img12

Figure 12

You can play the sound the same way you played the internet radio. Because you are playing a local file, there’s no time lag. The one thing to watch out for is the volume. Because the volume is louder than playing sounds while using the network, we suggest playing the music after lowering the volume a little bit first.

Using AirPlay from a Computer

Here’s today’s main work: playing music with AirPlay!
First, connect to iTunes on your computer. Because these are both connected through the LAN cable, Volumio was recognized when I started iTunes.

raspberrypi29_img13

Figure 13

(Click on blue icon with rectangle and triangle=> click “single” => click volumio)
An icon to select the speaker will be displayed on the upper part of the menu bar. When clicking on the icon, you will be able to choose Volumio (in iTunes ver. 12.2.2.25).

If the sound starts playing from the Raspberry Pi after playing music on iTunes, then this set up was successful! Because all you have done was to switch the speaker. Other functions will work the same. Of course, Apple Music can be played as well.

Using AirPlay from an iPhone

Next, let’s do the same thing with an iPhone!
Connecting to Volumio through iPhone can be set up through the “control center.” You can display the control center by swiping the iPhone screen from the bottom. If Volumio is recognized at this point, an “AirPlay” button will be displayed, like this.

raspberrypi29_img14

Figure 14

If this button is not displayed, it means that Volumio is not recognized. If you turn off and on the Wi-Fi by using the airplane mode, it might get recognized. Another possibility is that the iPhone and Volumio are connected to different networks, so make sure that they’re both using the same network.
If these suggestions do not help, sometimes using a Wi-Fi adapter will solve the issue (I will talk about that in the next section).

If you tap the “AirPlay” button, you can select the output destination from either “iPhone” or “Volumio”.

raspberrypi29_img15

Figure 15

If you check “Volumio”, not only music but all sounds coming from the iPhone will be played through Volumio. However, because you are using the network, a time lag occurs, so this function is not suitable for purposes other than playing music.

Wi-Fi Settings

I have slightly touched upon this previously, but because I could not get my iPhone to properly recognize Volumio, I connected it to a wireless connection using a Wi-Fi adapter. This was possible even when connected to the LAN cable simultaneously. I could solve my problem with this setup, but it might differ depending on your environment.
You can also set the Wi-Fi settings through the menu on Volumio. Select “Network” from the menu list on the upper right hand corner of the screen.

raspberrypi29_img16

Figure 16

Two items, “Wired Connection” and “Wireless Connection” pop up. The setup location is at the lower “Wireless Connection” item. After setting up the network title and password, click on “SAVE CHANGES.”
When you are done with the settings, restart Volumio once and try out the connection with AirPlay.

Summary

We were able to play audio over the network. We could easily use AirPlay as well.
Because we didn’t have to use command at all, I think this was one of the easiest Raspberry Pi projects we have introduced so far. As it is convenient and easy to use compared to other more complex projects, we can use it in our daily life!

For those that don’t feel challenged by this because they are used to using Raspberry Pi, we recommend looking directly into the content of Volumio. It is possible to manipulate the commands like you usually do with Raspbian if you directly connect the display screen and the keyboard and operate, or by SSH connection (if you are using SSH connection, you can login with the Raspbian default pi user information).

raspberrypi29_img17

If you connect the display, a screen like this pops up. It is fun to imagine and explore what kind of packages are functioning in what way inside Volumio!
In the next article, we will get back to a more normal electrical kit project. We are going to operate GPIO from the browser using a software called “WebIOPi”