Super Budget Digital Audio Streaming Recipe
This is a recipe I've been working up for a couple of weeks that I wanted to share with you all. As the title suggests it's primarily a budget approach but realistically there's no reason you can't up the spend on the sound card to something more esoteric and get a really hi-fi result from it.
The magic of this system is that you can essentially have your own personal Spotify using the subsonic / madsonic media server software. You can stream music around your home to different computers and you can remote control your base station machine using your mobile phone (as well as being able to stream to that phone also, so you can have your music when you're out and about too!) You could also skip the soundcard completely and just use the pi as a streaming server to other devices that do have a sound card / converter attached to them.
You can also use it to run an XBMC media server although this guide is more focussed on Subsonic as that's the one I've enjoyed using the most (I don't do a lot of telly / films, I like choons!)
On first glance, if you've not delved in to computers all that much it looks quite involved and complicated but if you're reasonably methodical and happy to use google (and this thread) I think you'll find it's all quite straight forward really.
Hardware
Raspberry Pi – model b
http://raspberrypi.rsdelivers.com/pr...b/7568308.aspx
£26
Pi power supply – this is the better 2amp model, wouldn't skimp any further on this
http://raspberrypi.rsdelivers.com/pr...i/7653311.aspx
£10
Pi case (optional)
http://raspberrypi.rsdelivers.com/pr...r/caseclr.aspx
£5
SD Card – 16gig is a good idea if you want to go the Berryboot route, outlined below, and have multiple OS flavours available on your Pi
http://www.ebuyer.com/397949-lexar-1...d-lsd16gfbeuhd
£10
1TB USB Hard drive – if you already have a NAS solution this may not be necessary – it's useful to have one as the pi runs faster from a USB drive anyway but just get a smaller / cheaper one if you're hosting your media elsewhere
http://www.ebuyer.com/238460-intenso...-drive-6002560
£60
Audio interface – Burr Brown converters, RIAA compensated inputs (switchable to line ins if you have better pre for phono input) Optical output (for if you have a better converter)
http://www.amazon.co.uk/Behringer-UC...?tag=qrb-su-21
£23 – Confession 1. I don't have this soundcard myself however I've checked that it is compatible with linux and has a standard USB driver so should work 'out of the box'
Other bits and bobs – Ethernet cable and internet connection / access to home router. HDMI cable (if you want to do video to a television, it also has uses for getting setup which are explained when we get to software setup), another computer with an sd card reader – this guide assumes you have one running linux, preferably Debian or a Debian derivative (Ubuntu, Crunchbang, Mint etc)
Hardware setup
This should be pretty fool-proof!
Simply plug all the relevant items in to their relevant sockets (HDMI to TV, Ethernet to router, hard-drive and sound card in USB and power in to the mini usb socket on the pi)
If you want more USB devices you should consider a powered hub to hang them off.
Software Setup
A general point, it's really helpful if you know how to use SSH to connect remotely to another computer on your home network, if you also set up your router so it always assigns your pi the same address then you can connect to it using SSH at a command prompt just type: ssh pi@192.168.1.whateveripyouvesettheroutertogivetothepi (assuming you've left the default user name at pi) if you've left the default password too (naughty naughty!) then when you're prompted for the password it's raspberry if you haven't it's whatever you changed it to. If you've kept he default hostname you can also do ssh pi@raspberrypi and that should get you to the password prompt too.
This little sequence will log you in to the pi remotely and the next prompt that comes up is the pi rather than the machine you're typing on, cool huh? If you're on windows you should look in to installing PuTTy and WinSCP as these are the tools you need to complete the same tasks from a windows box.
Getting the Pi up and running
Berryboot
http://www.berryterminal.com/doku.php/berryboot
Your Pi doesnt' have a BIOS but it doesn't mean you can dual (or multi) boot it with different OS flavours. Berryboot gives you a very simple route in to this. Simply download the Berryboot zip file and extract its contents in to a freshly formatted (FAT32) SD card, slip it in the Pi and switch on. Then just follow the on-screen instructions and you can have a range of different Pi Compatible OS flavours available (I did this so I can have a 'straight' Debian install as well as an xbmc install).
Confession 2: I 'cheated' slightly in doing this section myself as I have an old usb wireless keyboard with a touchpad mouse on it that I've got on the other USB socket on the pi, so I just navigated the berryboot menus using that. If you don't have one I suspect you could probably do it using just a wired keyboard and tabbing through the berryboot menus. If you have neither and are confident with these things you can do a 'headless' installation using VNC to remote in to Berryboot and control it that way, there's guidance on how to do this on the berryboot website.
In the first instance select Debian Wheezy and tell berryboot that you'd like to install to the USB hard-drive, now go and get a cuppa and a couple of hob-nobs cos it's going to take a while to download and install. This is all automated, you should be able to watch the bars go by on your telly via the hdmi output.
When the first boot menu runs set the appropriate timezones etc and make sure you select 'don't boot in to graphical interface' and 'run SSH server on startup' finalise the install and let it complete. This is a good moment for a cuppa, it's gonna take a little while to work through this. (Confession 2(a) I did this on the telly using my USB keyboard explained in Confession 2)
Recommended: Once the installation is complete log in over ssh to the pi and run the traditional debian sequence of commands to make sure the software is fully up to date
To check for updates
sudo apt-get update
To install non critical upgrades
sudo apt-get upgrade
To install system upgrades
sudo apt-get dist-upgrade
For each of theses you'll see a load of stuff happening and eventually you'll be returned to the prompt where you can go for the next one. Once they're all done reboot for luck ;-)
sudo shutdown -r now
You've now got a fully up to date and functional computing device!
Java
Once you've got your basic debian installation up and running.
After a bit of playing it's clear that madsonic works much faster with the latest version of Java, I used the tutorial from here: http://www.savagehomeautomation.com/...x-develop.html to get it upgraded on my pi. The main difference I took was to just download the java files straight to the pi rather than to another box first and copying them across, to do this I
Key steps:
SSH in to Pi and navigate to the home folder (should actually be there by default, if in doubt use pwd to determine the present working directory if it's not /home/pi then do cd /home/pi to change to that directory)
Code:
wget http://www.java.net/download/JavaFXa...ov_2012.tar.gz
will download the tarball to the pi's home folder
Thereafter it just follows the steps in the guide:
unpack the Oracle JDK .gz file using this command:
tar xvzf ~/jdk-8-ea-b36e-linux-arm-hflt-29_nov_2012.tar.gz
Make a folder to move the files to:
sudo mkdir -p -v /opt/java
and move them:
sudo mv -v ~/jdk1.8.0 /opt/java
you can now delete the source:
rm ~/jdk-8-ea-b36e-linux-arm-hflt-29_nov_2012.tar.gz
To complete the JDK installation let the system know there is a new JVM installed and where it is located:
sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/jdk1.8.0/bin/java" 1
And finally tell the system that we want this JDK to be the default Java runtime for the system:
sudo update-alternatives --set java /opt/java/jdk1.8.0/bin/java
I also followed the stages describing how to add the java_home environment variable for good measure.
Subsonic / Madsonic
We'll start with Subsonic just to get you going, if enough folk are interested and can't work it out for themselves we can carry on to Madsonic further down the thread.
Get the installer for Subsonic:
You can find the latest stable version or the latest beta version on the Subsonic download page. Make sure you follow the download links to SourceForge *until you see a ‘Direct Link’. Right click that link and select ‘Copy Link’. You can then right-click the ssh window to paste the URL there.
SSH in to the pi
wget [right-click paste url or shift - ins to paste]*-O subsonic.deb
Once downloaded install the package
sudo dpkg -i subsonic-x,x.deb (with the x's replaced with your version number, probably 4.7)
There's some good instructions here: http://mj2p.co.uk/?p=7 the variation I've used is that rather than creating the new user (subsonic_user) I've just kept the username 'pi' and that's the one that I've adjusted /usr/default/subsonic to refer to so that subsonic runs with only user privileges rather than admin (root) privileges.
Home Run
The final significant hurdle to cross is that you need to amend the version of FFMPEG that's installed as the one that comes with subsonic doesn't work on the pi, again the instructions to do this are here: http://mj2p.co.uk/?p=7 and it's a simple install of a couple of packages, the deletion of the wrong ones and a copy of the correct one in to the right location.
The final simple step is to make a media folder and copy your media in to it. I'm not going to preach on how to organise your media, I have everything in idividual album folders in a folder called music and that works fine for me! From Windows using WinSCP is a great simple tool to copy across, on linux I just just scp from the command line to copy files in to the pi.
mkdir /home/pi/music
scp -r route/to/files/on/localmachine pi@raspberrypi:/home/pi/music
At last (if you haven't already for a cheeky look) you can log in to subsonic and set it up from within the application. Look up on your router what the IP of the pi is (or if you know because you've set the router to always assign the same address and with firefox go to 192.168.1.xxx:4040 (where the xxxs are replaced with the actual address and you should be presented with the subsonic log in page. The default user and pass is admin admin and you should change the password before anything else. Thereafter it's all fairly straightfoward!