Click here to Skip to main content
15,916,692 members
Articles / Internet of Things / Raspberry-Pi

Raspberry Pi as low-cost audio streaming box

Rate me:
Please Sign up or sign in to vote.
4.71/5 (18 votes)
5 Nov 2014CPOL12 min read 439.2K   33   30
How to build an audio streaming box with a Raspberry Pi micro computer that streams online audio streams or local audio files to your audio system/speakers


This article describes how to extend your audio system with a Raspberry Pi micro-computer to play any local music or audio stream from the internet (including Spotify Premium etc.). The best thing is, that you don't need to have any keyboard, mouse, monitor or TV attached to this box: hide it somewhere behind your audio system and remotely control it with your mobile phone (Android, iOS or anything else!) or PC (via any web browser). Yes, there are out-of-the-box solutions available i.e. from Sonos and Bose, but they start at around US$200. This solution will do the same and even some more for around US$70. You only need very basic hardware skills and some basic software skills. Just follow these steps to get your next-level-audio-system.

Image 1



Have you ever heard of Raspberry Pi? It's a low-cost micro-computer that is able to run Linux and has endless extension possibilities. This little micro-computer originally was developed to teach children at school, but it has now become very popular for all kind of DIY-projects. It costs only about US$35 and opens up endless possibilities of what you can build with it.
The official website can be found at


Hardware components

There is only a handful of hardware components you need to build this versatile amazing little audio box:

Raspberry Pi

To build this audio box, you can either use a Raspberry Pi B or the newer version Raspberry B+. This article will focus on using the new model B+. It comes with 700MHz Broadcom CPU, 512 MB Ram, 4 USB ports and a 100MBit ethernet port.
You can order it from here. Cost: about US$40. (Readers from Germany see the notes at the end of the article).
Image 2

Case for the Raspberry Pi

The Raspberry Pi computer comes pretty "naked", so you want to give it a case to protect it and make it look good. Depending on where you will put your audio box later, you can use a cheap and ugly or a nice expensive case. Please remember that you don't need any visual contact to your audio box, everything is remotely controlled via your mobile phone or web browser. We prefer using the cheapest cases for about US$9 like this one:
Image 3

MicroSD card

The Raspberry Pi needs an SD card to store the OS and data on it as it has no internal storage built in. The size of the SD card depends on if you want to store some music on the SD card as well to play local audio files from it or if you have stored all your music files somewhere on a network attached storage. If the audio box has access to your music files on a Windows shared folder, you can use a small SD card with with 2 or 4 GB. We currently prefer 8 GB class 10 cards, as these are pretty cheap right now. These currently cost around US$7. You can order them from here.
Image 4
If you are using a Raspberry Pi model B+, be sure to order a microSD card as the B+ model only has a microSD card slot. If you are building this audio box with a model B, you can also use the bigger SD card.

Power supply

Be sure to use a power supply that gives enough power. When using a Raspberry B+, you should look out for a 2A power supply like this one. Cost: around US$9.
Image 5

Wifi adapter

Depending on where you put your audio box later, there may be no ethernet cable there. But no problem: just plug in a wifi USB adapter and you should be fine. We made some very good experience with these edimax USB adapters that cost around US$9 and can be ordered from here.
Image 6

That's it: for around US$70 to US$100 we have all the hardware we need.


Audio output

The Raspberry Pi never had a good reputation in audio output through the 3.5mm analog audio jack. But there are three things that you can easily do to improve this:

  • use the new Pi model B+: it now has a dedicated low-noise power supply which results in a better audio quality than the previous versions of the Raspberry Pi.
  • use a USB sound card: to improve the audio output, you can just plug a USB sound card like this one to your Raspberry:
    Image 7
    This will result in a slightly better audio output, but don't expect any wonders from the cheap ones. Cost: about US$6. If you are an audiophile person and want excellent audio quality output, even in digital quality, use the third option:
  • add a HifiBerry or Wolfson audio card: these are small add-on boards that have an excellent audio quality and just cost about US$40.
    Image 8



Put the hardware together

When you have all the hardware components, start assembling the box:

Image 9


There you are, all assembled:

Image 10


Prepare the SD card

Now that we have all the hardware assembled, let's get the software part of this box installed.

Download Pi MusicBox

We recommend using Pi MusicBox. It's a great piece of free software developed by Wouter van Wijk. The current version is 0.5, which can be downloaded directly from here.

Connect SD card to your computer

To be able to write the necessary files to the SD card, you need to plug the SD card to your computer. You can do this by either using a microSD-to-SD card adapter (that usually comes with the microSD card) or by using a microSD-USB-adapter like this one. These cost only about US$6.

Image 11


Write the SD card

After the download of Pi MusicBox has finished (be aware: it's pretty large... 230MB), unzip the included .img file. To write this disk image file to your SD card, you will need a software that is able to do this. When you're sitting in front of a Windows system, just download and install the free Win32 Disk Imager. After installation, run it and select the correct drive letter setting "Device" (REALLY check this to avoid erasing another drive by error!) and select the unzipped .img file:

Image 12

Click "Write" to write the image file to the SD card.

Mac OS: If you're sitting in front of a Mac, use these instructions to write the .img file to the SD card.

Linux: And if you're sitting in front of a Linux desktop machine, use these instructions to get the .img file onto the SD card.

Connect to your network

If you have the chance that your new Pi MusicBox has direct LAN network connection, you're already set. Put the SD card into your Raspberry Pi now and plug the LAN cable. The Pi should have access to your network.

But when you're using Wifi network, you first need to enter your Wifi settings in the config file of Pi MusicBox:

  1. Open the file settings.ini from the "config" folder of the SD card in a text editor on your PC:

    Image 13

  2. Enter your Wifi network name (SSID) and Wifi passwort in the settings.ini in the next to "wifi_network" and "wifi_password". Don't forget to save the settings.ini file afterwards.

Please be aware that Pi MusicBox only supports WPA Wifi, no WEP!

Remove the SD card from your PC and plug it into your Pi. We're now done with these setups steps and can now start to configure Pi MusicBox in the next step.


Configure MusicBox

After you've plugged the power supply to the Pi, give it some time to boot up. Then open your webbrowser and open the url http://musicbox.local/. You should see the Pi MusicBox home screen:

Image 14

Let's do some customization to the default settings of your Pi MusicBox. Click on "Settings" in the left menu or the home screen button. These are the settings explained:


Wifi Network Name and Wifi Password: The SSID and password of your Wifi network (see explanation on how to connect your Pi to Wifi above in "Connect to your network".

Workgroup: Enter your workgroup name of your Windows network.

Enable SSH: If you want to directly connect to the Pi MusicBox via SSH, enable SSH access with this setting. This is only necessary for very advanced changes to the Pi system. Normally, you don't need SSH access in normal operation.


Device name: This is the name of Pi in your network. This will also set on how you will access the web control page of your Pi MusicBox. I.e. if you enter "livingroom" here, you need to access the Pi via http://livingroom.local/ then.

Autoplay Url: Enter any url that the Pi MusicBox will start to play after boot.

Wait time: Before playing the "Autoplay Url" after boot, it will wait for this amount of time in seconds.

Root password: By default, the root access to the underlying linux system is username "root" and password "musicbox". But as that's not very secure, you should change the password to some very secure one here. Be sure to use numbers and special characters in the password to make it hard to guess.

AirPlay Streaming: Do you want to stream directly from your iOS device to the MusicBox? Just enable this setting and it should show up in your AirPlay devices list on your iPhone, iPad, etc. when these are in the same network as the MusicBox.

DLNA/uPnP/OpenHome Streaming: If you want to stream audio directly over these protocols, just enable this setting.


Initial volume: This is the initial volume of the MusicBox after boot. In our setups, it was always best to set this setting to "100" and instead set the volume at the connected amplifier to the volume you want. That resulted in slightly better audio output quality in analog audio setups.

Audio output: Depending on how you connect your audio amplifier to the Pi, you can manually set the audio output here. Normally, leaving it to "Automatic" should work for most setups.

Downsample USB: On the older Raspberry Pi model B, the DAC was not that good, so enabling this downsampling here could result in slightly better audio output if you're using analog audio output. With the newer Raspberry Pi B+ or if you have an audio card attached, you should disable this setting.

Music files

Scan Music Files: If you want MusicBox to scan for music files on reboot, enable this setting. But be aware: this will scan all attached SD cards, USB drives and also all network drives (see below). This could take some time, depending on the amount of subfolders and music files in all folders.

Network Drive: Enter the path to a samba shared folder in your network where you have stored all your music files (i.e. \\server1\music\). Be sure to enter the correct username and password below so that MusicBox can access the shared folder. Note that the music files in this folder will not automatically update. You'll need to enable "Scan Music Files" above so that MusicBox will scan this folder for new files on the next boot.

Resize filesystem: It might be that you're using a larger SD card than the .img file was that you've written to the card. If you enable this setting, the file system will be expanded on next boot to use the whole SD card. You can then store more music on the SD card locally. This is a beta feature, use with care!


These are a handful of services where MusicBox can get the audio files from. Each of them have separate settings that are explained individually there. This list changes from MusicBox version to version.


Local music

You have multiple possibilities to add local music to the Pi MusicBox so that you can then play these via the "local audio" function in the web frontend:

  • Network shared folder: See instructions above on how to let Pi MusicBox scan a shared samba folder in your network for audio files
  • Attached USB drive: Just load all your music to a USB drive and attach it to the Pi. When you enable the "Scan Music Files" setting and reboot the Pi, all these audio files are available for playback
  • SD card: When you use a large enough SD card for this whole setup, you are able to put some music on the SD card as well. To load music to the SD card, just attach it to your PC (see above) or access the Pi while it's powered on via Windows Explorer (i.e. \\MusicBox\). You can then copy music to the Pi's SD card.


Mobile access

Pi MusicBox was built to control your music output from mobile devices. So you can use any smartphone to control the audio playback. Just open the webbrowser and navigate to the url of the Pi MusicBox (i.e. http://musicbox.local) and you'll be able to control the audio playback:

Image 15

This also works from mobile phones of your friends at your home party! Just give them access to you Wifi network and the url of the MusicBox and anybody can control the music.



The Pi MusicBox was built to run in your local network. Do never put it outside your firewall so that anybody from outside has access to the Pi! It's your own task to secure any access to the Pi.


Getting help

If you encounter any problems while trying to build this audio streaming box, you have multiple possibilities to get help:

  • Pi MusicBox FAQ: The maker of Pi MusicBox has published a very good FAQ online here
  • Mopidy forums: There is a forum to discuss Mopidy/MusicBox issues here
  • Add comment below: Just enter your problem or question as a comment below. Please note: the better and more detailed you describe your problem, the more likely you'll receive a helpful answer


Readers from Germany

German: Hier die Links zu den Hardware-Komponenten, wie sie aus Deutschland bestellbar sind:


Next steps

This is just a start to give you an idea of the basics. There are endless possibilities on how to extend this system.

What are you going to add? Let us know!


11/05/2014: Initial release of article




This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
CEO Scavix Software GmbH & Co. KG
Germany Germany
Scavix Software offers high quality software development and consulting. That's what customers like Intel, AMD, eBay and Sage Software trusted in the last years. Be it on the desktop, in the web browser, on a mobile phone, on a tablet or on the TV: we can make your software visions come true.
Are you our next customer? Don't hesitate to contact us.


Written By
Software Developer (Senior) Scavix Software Ltd. & Co KG
Germany Germany
Working as Software Developer for years with all kinds of programming languages
from basic microcontroller programming in ANSI C to high level C# Application Development.
Focusing on website and webservice programming in the last few years with PHP, MySQL, JavaScript,...

Comments and Discussions

QuestionI know this is an OLD article, but if anyone can help . . . Pin
DamonJGray21-Jan-23 10:43
DamonJGray21-Jan-23 10:43 
QuestionAudio In Pin
Member 1348061923-Oct-17 4:55
Member 1348061923-Oct-17 4:55 
QuestionMusicBox and Spotify free Pin
Member 133908122-Sep-17 19:14
Member 133908122-Sep-17 19:14 
QuestionLogin to raspbian information(OS user pass) Pin
moha1218-Jan-17 4:24
moha1218-Jan-17 4:24 
QuestionLogin to raspbian information(OS user pass) Pin
moha1218-Jan-17 4:24
moha1218-Jan-17 4:24 
QuestionWhat? Pin
Member 1282392630-Oct-16 6:17
Member 1282392630-Oct-16 6:17 
AnswerRe: What? Pin
Member 1282392630-Oct-16 6:27
Member 1282392630-Oct-16 6:27 
QuestionI cannot get it to work on the pi zero Pin
Member 1276546828-Sep-16 11:49
Member 1276546828-Sep-16 11:49 
QuestionI can't seem to make it get past the 4pixel boot screen - any advice? Pin
Member 1248074523-Apr-16 17:53
Member 1248074523-Apr-16 17:53 
QuestionRe: I can't seem to make it get past the 4pixel boot screen - any advice? Pin
Jeff Blasius17-Sep-16 10:13
Jeff Blasius17-Sep-16 10:13 
SuggestionRe: I can't seem to make it get past the 4pixel boot screen - any advice? Pin
Member 1275443222-Sep-16 7:02
Member 1275443222-Sep-16 7:02 
GeneralRe: I can't seem to make it get past the 4pixel boot screen - any advice? Pin
Jeff Blasius22-Sep-16 7:51
Jeff Blasius22-Sep-16 7:51 
GeneralMy vote of 5 Pin
raddevus28-Feb-16 11:17
mvaraddevus28-Feb-16 11:17 
QuestionTrouble building "Raspberry Pi as low-cost HD surveillance camera" for Pi 2 Pin
Member 88999459-Feb-16 7:51
Member 88999459-Feb-16 7:51 
Questionmusicbox.local Pin
Member 123137268-Feb-16 0:30
Member 123137268-Feb-16 0:30 
QuestionDoes the player time its self out after time? Pin
Member 1226650115-Jan-16 4:44
Member 1226650115-Jan-16 4:44 
QuestionSpotify Pin
Member 121925157-Dec-15 17:10
Member 121925157-Dec-15 17:10 
QuestionMultiple Flash Drives Pin
Member 1153863425-Mar-15 11:56
Member 1153863425-Mar-15 11:56 
QuestionEmbarrassing Question Pin
Member 1153863419-Mar-15 3:28
Member 1153863419-Mar-15 3:28 
AnswerRe: Embarrassing Question Pin
Christoph Buenger19-Mar-15 4:42
professionalChristoph Buenger19-Mar-15 4:42 
GeneralRe: Embarrassing Question Pin
Member 1153863419-Mar-15 9:30
Member 1153863419-Mar-15 9:30 
Questionmy way Pin
sunny tambi28-Feb-15 9:17
sunny tambi28-Feb-15 9:17 
GeneralIoT Contest article? Pin
Kevin Priddle7-Nov-14 10:26
professionalKevin Priddle7-Nov-14 10:26 
GeneralRe: IoT Contest article? Pin
Christoph Buenger9-Nov-14 21:29
professionalChristoph Buenger9-Nov-14 21:29 
QuestionMy vote of 5 Pin
Abhishek Nandy6-Nov-14 20:03
professionalAbhishek Nandy6-Nov-14 20:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.