Building a Raspberry Pi Music Player for less than $55

December 23, 2015

By the end of this post you will be confident in building a Raspberry Pi streaming audio music player that plugs in to any speaker and is controlled by your smartphone to play internet radio stations, Spotify, last.fm, or locally stored music, or act as an Airplay speaker for your iTunes library or apps like Pandora.

I recently put one together and it's been working great. The hardware components are simple to put together; they mostly just snap into place. Here's what I used for mine:

Grand Total $54.45

Ok, I lied just a little. You will also need an SD card to store the Raspberry Pi operating system and a card reader to write the OS image from your computer. If you don't own these things already, here are some that will work just fine:

Once you have all of the parts, put the Raspberry Pi board into the case and screw the case on. Be sure to ground yourself first to avoid a static charge which could harm this sensitive hardware. Simply plug the WI-FI adapter into one of the USB ports and the player is put together! When put together it will look something like this:

Raspberry Pi Audio Player

Set the player aside for now while you prepare the OS image to be installed. For my build I chose to use Rune Audio, which includes a custom built OS based on Arch Linux and an Open Source player and user interface for controlling your audio player. You can download the disk image here or check the download page for possible future updates. (Several other choices also exist, including Pi MusicBox and Ras Plex.)

When the download is complete (it's roughly 1GB) you need to unzip it. Fire up a terminal and unzip the file:

gunzip RuneAudio_rpi_0.3-beta_20141029_2GB.img.gz

If you're using Windows you can use a program like 7-Zip to unzip the file.

Plug the Micro SD card into the card reader and plug the card reader into your computer, and you're ready to flash the OS onto the SD card.

Rune Audio provides separate instructions for flashing the SD card for Windows, Mac, and Linux. They can be found here:

On my mac this involved running one command to find out which device the SD card was mapped to:

diskutil list

Judging by the 8GB size of the SD card I found the device name, which should be something like /dev/diskX. Then it was simply a matter of writing the image to this disk:

dd if=/path/to/unzipped/runeaudio/diskimage.img of=/dev/diskX 

In the above example you'll want to replace /dev/diskX with the actual device path for your SD card. Be sure to triple check this device path as choosing a different drive could completely mangle another one of your disks.

I wasn't keeping track of exact time but this operation took around 20-30 minutes to complete. Once it's done you can unplug the SD card reader and pop the SD card into the Raspberry Pi. It took me a minute to find where this should be plugged in to:

Raspberry Pi music player SD Card

This should click into place when you push it in. You may need the round side of a paperclip or other small object to help.

Raspberry Pi music player SD Card in place

The Raspberry Pi has no power button, so plugging/unplugging the micro USB power supply turns the device on and off. Once plugged in the device takes about 10-20 seconds to boot up. If you have an HDMI monitor you can plug it in to watch the boot sequence but this is not necessary.

To initialize WI-FI settings I found it easiest to first plug an ethernet cable directly from my router into the Raspberry pi. When the device comes on you can access the media server settings by going to http://runeaudio or http://runeaudio.local on OSX or Linux.

If for some reason those addresses don't work, you'll have to log in to your router's admin console and find the IP address for the device from your DHCP client list. Then you may use this address instead; it should be something like http://192.168.x.xxx.

Navigate to the network page under the Menu at the top right of the screen and set up the password for your WI-FI network for the WLAN0 Interface.

Network settings

Network config

As soon as this is done your audio player is ready to go wireless. Put it in its permanent home, plug in the speakers and you can begin configuring your audio sources at the same URL.

Most of the configuration is pretty self-explanatory but I did find one thing a bit tricky when setting up internet radio stations. Most of these stations are distributed via a .m3u file. The URL to the .m3u file will not work by itself. Instead, open the .m3u file in a text editor and find the URL in it (usually the second line) and use this URL in the RuneUI. You can find tons of internet radio stations here or by visiting your favorite radio station website.

$ cat test.m3u
#EXTM3U
http://test.streamguys.net  <--- GRAB THIS URL 

With this URL you can set up a new MyWebradio on the Library screen

Library

WebradioAdd

Also, be sure to set an airplay name for your media player so that you can stream from iTunes or apps like Pandora.

Airplay

If you have an iPhone, Apple's "Remote" app in the app store is great for controlling iTunes on your computer.

Lastly, to control your media player from your smartphone, just go to the above mentioned local URL on your smartphone and play music from any of your sources. Bookmark this page or set a homescreen bookmark for it to access it more quickly on your smartphone.

 

comments powered by Disqus

About This Site

This site was designed by We Are How.

This site is powered by Sculpin static site generator and the source is available here.

Yotta = 10^24, or 1 000 000 000 000 000 000 000 000, the largest metric prefix.


Contact

Get in touch to find out how we can help you refine your vision and implement a dynamite product that will help your business grow. Our agile product development process is thoughtfully designed to give clients ongoing feedback and visibility from project inception to completion.