Raspberry Pi 3 MusicBox

They've released a  new Raspberry Pi 3.... you know the one, it looks a bit like this:
well, it looks exactly like that, as it IS that...

Raspberry Pi 3 - Model B Technical Specification

  • Broadcom BCM2387 chipset 
  • 1.2GHz Quad-Core ARM Cortex-A53
  • 802.11 bgn Wireless LAN and Bluetooth 4.1 (Bluetooth Classic and LE)
  • 1GB RAM
  • 64 Bit CPU
  • 4 x USB ports
  • 4 pole Stereo output and Composite video port
  • Full size HDMI
  • 10/100 BaseT Ethernet socketbr
  • CSI camera port for connecting the Raspberry Pi camera
  • DSI display port for connecting the Raspberry Pi touch screen display
  • Micro SD port for loading your operating system and storing data
  • Micro USB power source
With a spec. like that, what was I going to do with it?   Well.....



I have had this "old" wooden radio/speaker box sitting next to my sofa (being used as a table) for a few years now.  The original plan was to put some form of mini-PC into it and have it as a music center.  Well, it looks like there is going to be a space next to the sofa now and I'll have to find another table.



I headed over to PiMusicBox and had a little read, it all seemed quite simple now, just download the image, extract it to the SDCard, change the settings.ini file and boom, jobs a good'un.  Yeah, well, that fell flat on it's face, pretty quick!

I took a look at this BLOG and I took note about the USB amplifier.  I ordered one from Amazon for a very small amount of money (funny thing is, with the Pi3, I don't actually think I need it, but handy to have, if I do need it in the future).

I downloaded the pimusicbox zip file and extracted it:










You'll note that I took a backup copy of the settings.ini file (just incase I need to redo this in the future)
Now, as I'm using a Mac, I need to get that .img file to the SDCard.... I found these instructions.

>diskutil list

I noticed my SDCard is listed as Disk2

>diskutil unmountDisk /dev/disk2
>sudo dd bs=1m if=musicbox0.6.img of=/dev/rdisk2

That took a few minutes and worked nicely.

You can then view the /config folder and modify the settings.ini file (as per the original BLOG instructions) - basically, all you really want to do is to add the NETWORK settings for the WiFi.

***Note: now, I did do this, but after doing the next part, I found that I could not use the internal WiFi interface, I plugged in an external WiFi USB interface and it worked okay.  The pimusicbox software seems to assume it's looking for wlan0.  For the rest of this setup I actually used an old fashion eth0 network cable.  Works fine, but not that ideal for mounting inside the old radio speaker box.... I'll switch back to the USB WiFi later on***

I then put the SDCard into the Pi3 and booted it up.....nothing happened :-(
I plugged in a monitor and I just see rainbow colours when I boot up.  No PiMusicBox.

Then I did some Googling and found this article.

Basically, PiMusicBox v0.6 is built for the Pi2, not Pi3.  To get around this (as you'll note in the screenshot above), you download the Raspbian Jessie image.  As I'm on a Mac, you can just open the .img file and see the contents.  You need to copy from the Jessie image to the SDCard:

>all the *.dat and *.elf files
>bcm27*.* files
>bootcode.bin

Then eject the SDCard, stick it back in the Pi3 and voila! It boots up.  Occasionally there are 3 lines of error code that are thrown to the command-line, but it doesn't seem to cause a problem.

When you boot the Pi3 up with PiMusicBox the last line tells you the IP Address that has been allocated (you "can" go and setup the Pi3 to have a static IP address, which I might do at some point), although it is not that essential.

Then you go to a web-browser and enter http://musicbox.local/   (the http:// part is crucial, otherwise you'll end up in a Google search).  For Android you have to use http://IPAddress/


You can select "Settings" on the left hand side and this will show you the content of the "settings.ini" file, you can make changes to this and then the device will reboot to apply the changes.  It's pretty fast to restart.

Me, being me....well, that was not enough.  I wanted to have an external USB CD-Rom attached and to be able to rip my CDs to FLAC format and then be able to select them from the web-browser and play the music....



BTW - the root password by default is "musicbox".  You can change that in the settings, just don't forget it or you'll have to re-do everything again.


>apt-get install abcde flac eject

Follow this guide on what to modify in the /etc/abcde.conf file.

If, like me, you did as you were told and used : musicbrainz

When you insert a CD-rom and type:

>abcde

I was getting error messages about missing Perl libraries....

>apt-get install cd-discid eyed3 libmusicbrainz-discid-perl libwebservice-musicbrainz-perl

That got rid of the error messages and now when you run >abcde it performs a lookup to musicbrainz to get the CD details.  (I've had it not find a few, but mostly it works okay).

In the abcde.conf file, I told it to copy the files to /music/USB, so whilst it is ripping it outputs to /tmp, when it is finished it copies the files to /music/USB/xxxxx and you see the .flac files.
You can kind of see this on the very badly photographed image here :-)



I "did" set it up to connect across to my "other" Pi device that has a USB 64Gb stick attached with music on it, but I was getting write errors.

I did modify the /etc/fstab file to be:

which seems to make all of the files on the USB stick "chmod 777"... but it still fails to write to the stick when using >abcde.  It's not critical, but I'll figure it out one day. No longer needed.  See below.




The next job is to clean up the old radio speak box and get the Pi3 mounted inside it with some speakers (or re-use the speak inside it?) an then have it as my "retro music player"!


UPDATE:

I was having a think....and I decided that 64Gb USB sticks were not the best idea for storing my (and the missus) ripped CD-Collection....we might need something with a bit more space and reliability.
After a bit of searching about, I settled on a Seagate Personal Cloud 4TB NAS storage device... yep, 4 TerraBytes Baby :-D


It was faffing about when I first booted it up, so I had to stick it on the Tivo box so I could plug it directly into the router.  I had to do an >arp -a  to see the IP address, got there int he end, after a couple of firmware updates.


It behaves just like BOX, except it's sitting in my internal network.


I modified the Raspberry Pi 3 to have a fixed mount to the remote NAS drive by editing the /etc/fstab file.

As I'm using >abcde to rip my CDs and I want to output them directly to /music/Network, I have to have the mount as defined above in the /fstab file, otherwise >abcde doesn't have permissions to write to the NAS.


If you are going to do this REMOVE the values from the PiMusicBox settings.ini file!  They will conflict and cause an issue (you can put that value back later on when you do not need to WRITE to the NAS)

The PiMusicBox settings.ini will automatically create the following for you (cat /etc/mtab)

//192.168.0.9/Public/Music /music/Network cifs rw,relatime,vers=1.0,cache=strict,username=root,domain=PERSONALCLOUD,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.0.9,file_mode=0755,dir_mode=0755,nounix,serverino,rsize=61440,wsize=65536,actimeo=1 0 0

Whilst this is great, you'll notice it has 0755....we need full 777.  To achieve that, as I say, remove the settings.ini values and then edit the /etc/fstab file to now contain:

//192.168.0.9/Public/Music /music/Network cifs username=USERNAME,password=PASSWORD,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm 0 0

Then you can either reboot or perform a >mount -a

Remember though, the PiMusicBox only does a scan of the /music folders on boot up....


Now, when I access the MusicBox web app, I can now select, Browse, Local Files, Cloud and there we go....all the music that we had on CD is now available to stream in .flac quality.



Once I'm finished copying everything to the NAS, I can run the following command to create a playlist that will allow me to Shuffle the entire music collection:

>find /music/Network/* -type f > /var/lib/mopidy/playlists/allMusic1.m3u

I also upgraded to Spotify Premium, so we can stream that too  :-D

Comments