Now that Christmas is over, I needed to find the next “thing” for my Raspberry Pi. After some googling, I decided to give Pi Musicbox a try. Musicbox is basically a spin of the Raspbian Linux distribution with Mopidy allowing you to play all sorts of streaming services like Spotify, TuneIn, SoundCloud and local sound files on a ‘headless’ Raspberry Pi.
In this post, I will describe a bit of the work I had to do to get Pi Musicbox working to my satisfaction including some of the issues I am still encountering.
- Read the overall instructions to set it up for Pi Musicbox.
- More detailed instructions available as well.
- Raspberry Pi B+
- Mini SD card + SD card adpater
- (*) Ethernet cable + Internet connection
- AmazonBasics USB Powered Computer Speakers (A100)
The first thing I had to do was ‘dd’ the musicbox image into my mini SD card using a SD card adapter on my laptop which is running Fedora 21:
sudo dd bs=1M if=musicbox0.5.2.img of=/dev/mmcblk0
Once that was done, I mounted the card on my laptop and modified the config/settings.ini file in the MUSICBOX partition. In that file, you can set the root password for your server, enable ssh, set up wifi (*), configure your Spotify account (**) among other things.
(*) I started my set up using my canaKit wifi usb dongle, but once I started doing things with samba mounts to share music, I quickly noticed a lot buffering issues with the system while trying to play music, so I gave up on the wifi and plugged it in directly into my router’s ethernet port.
(**) You must have a Spotify Premium account for you to be able to connect to it via Pi Musicbox.
After saving my changes to settings.ini file, I unmounted my card, took it out of the adpater and plugged it into the Pi. Once it booted it up, I just accessed http://192.168.1.30/ (the IP my router gave my Pi) from my laptop.
Depending how fancy you want to go with your set up, this is probably be the part of the project that will take most of your time. In my case, I wanted to make the songs I had on my mac playable from the Pi.
I shared a Music folder I had with some albums on my mac, and mounted the share o the Pi.
MusicBox has a set of options in the settings.ini to allow you to enter a Samba share information in there for the system to scan, but I could not get that to work with a share coming from a mac, so I went and edited the /etc/fstab on my pi and added:
//192.168.1.79/music /mnt/music cifs username=myusername,password=mypassword,nounix,sec=ntlmssp,noperm,rw 0 0
My guess is that Musicbox tries to mount a samba/cifs share without using the sec=ntlmssp option, which is required to mount a share from a Mac OS X host in Linux. Again, it is just a guess at this moment.
Note that I am mounting the above on /mnt/music. I had to modify the /etc/mopidy/mopidy.conf file. I had to set media_dir option to /mnt/music
My premium membership to Spotify had expired, and when I first started playing with Musicbox the part related to Spotify would just spin on the web interface and nothing would happen. I ended up finding the log for the application and noticed when mopidy started it said non-premium accounts couldn’t access the content I was trying to access.
The log location for mopidy on Musicbox is: /var/log/mopidy/mopidy.log
Remember to enable ssh and set a root password on the settings.ini (as previsouly mentioned) so you can access the log file.
Probably my second favorite feature on Musicbox is the ability to interact with TuneIn, which allows you to listen to local radio stations that have an online presence. And, in case you are wondering, my favorite feature in the Spotify connectivity.
As much fun as I am having in setting this up, there are a few issues I am fighting with. Some of them may be of my own doing, and others may be related to mopidy itself, but at this point, I just see them as problems. So, this is meant to be for information’s sake and not criticism on the project at all.
- Samba configuration on settings.ini doesn’t seem to work with OS X shares.
- Streaming from a samba share via wifi (using the canaKit wifi dongle at least) doesn’t quite work. Too much buffering.
- local file refreshes doesn’t seem to work unless the system is rebooted.
- I tried running ‘mopidy local scan‘ to force a file scan, but it aways fails with the error: UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc3 in position 4560: ordinal not in range(128)
- I also had the error above on the mopidy.log when I was trying to scan for thousands of files on my Samba share. I reduced the files to about 480, and made sure only files with “ascii” characters where available and then my local files showed up on the web interface.
- Manually restarting (or stopping and then starting) mopidy doesn’t seem to trigger a local file scan either.
Yet another great little afternoon project for the Raspberry Pi. I now have a music/radio streaming service in the house that can be remotely accessed via a web interface. It doesn’t require a monitor or TV, no keyboard or mouse. Just a network connection and some speakers. That’s all I have to say about that.
2,983 total views, 2 views today