In the comments of my Install Subsonic media streaming server on a Raspberry Pi post, Ross very kindly posted some instructions on how to get the Jukebox mode of Subsonic working on the Raspberry Pi.
DevilWah also mentioned that a developer preview release of Java 8 is available which Ross tried and gave the thumbs up to.
This post has instructions of how to get Java 8 installed on your Raspberry Pi, how to get Subsonic working and then how to configure Jukebox mode so that you can play music from the headphone jack or HDMI port of the Raspberry Pi itself.
This post borrows heavily from instructions which are already available on the internet and from Ross’ instructions. I have conglomerated them here as it’s useful to have them all in one place.
I’ve only just completed this build but it does already seem quicker. I’m running the Java 8 Jukebox build on a second Raspberry Pi so will run it side by side with my original build for a while to do some direct comparisons.
Edit: the java 8 version uses a lot less CPU than the open jre used in the original instructions. I’ve just followed these same instructions and directly upgraded my original raspberry pi subsonic server to run on java 8. I have yet to test if the jukebox mode is working on that though.
I should mention that both Pis are the original versions with only 256MB RAM each. I’m running them headless so my only access is through SSH. I have seen a few of the CPU and memory spikes occur on the new Java 8 build in a similar way to the original build but they have not been as severe and have not lasted anywhere near as long. I can also confirm that the Jukebox mode is working as I’ve used it a lot!
So, without Further ado, on with the instructions.
Java 8 is the first version of the Oracle Java JRE which can run on the faster ‘Hard Float’ version of Debian Wheezy which is available on the Raspberry Pi download pages.
You first job is going to be to set up an SD Card with a fresh image of Debian. This is explained best on the Raspberry Pi wiki.
Once you’ve booted into your Raspberry Pi via ssh for the first time you should run the config program
The instructions at java.net say that the memory split should be 128MB, so that’s what I did.
The other instruction I followed from java.net which I don’t normally do was to uncomment the two lines in /boot/config.txt.
sudo nano /boot/config.txt
Next up is to download and install Java 8. Follow this link and highlight the radio button to say you accept the License Agreement (it’s standard ‘I promise you my first born’ stuff). Then right click the ‘Oracle JDK 8…’link and select ‘Copy link location’.
Back on your Pi enter
wget and then right click on the ssh window and paste. Hit enter and you will start downloading Java 8.
Once it’s finished you need to make a new directory for the install
mkdir -p /opt and then unpack the file you just downloaded into that directory
sudo tar zxvf [file you just downloaded] -C /opt
You now need to tell the system that a new Java version is installed and that you want to use it as default with these commands
sudo update-alternatives --install "/usr/bin/java" "java" "/opt/jdk1.8.0/bin/java" 1
sudo update-alternatives --set java /opt/jdk1.8.0/bin/java
The system now knows where Java is installed but we will need to let subsonic know where to find it. To do this we update the JAVA_HOME environment variable which can be set in your environment file.
sudo nano /etc/environment and add the line
You also need to point your bash console to the new environment variable.
nano ~/.bashrc add the lines
Give your Pi a quick reboot and you’re all set to install subsonic.
Now we can set up the Jukebox mode so that you can plug your pi into your hi-fi and play music directly on the hardware.
You need to download the Debian .deb package of Subsonic from the Subsonic website
(right click the ‘direct link’ and select ‘copy link as’)
On your pi enter the following command
wget -O subsonic.deb [right click to enter the download url] to download the install package and then
sudo dpkg -i subsonic.deb to install it
We need to create a user for the subsonic process and add that user to the audio group so that jukebox will work
sudo adduser subsonic
sudo adduser subsonic audio
Update subsonic to use this user
sudo nano /etc/default/subsonic and change the last line to
So that subsonic can transcode correctly we install the correct versions of ffmpeg and lame
sudo apt-get install ffmpeg lame
We then add symbolic links to the subsonic transcode folder so that it uses these applications instead of the ones it comes bundled with (good suggestion Ross)
sudo ln -fs /usr/bin/ffmpeg /var/subsonic/transcode
sudo ln -fs /usr/bin/lame /var/subsonic/transcode
We now need to add a line to the coding of subsonic so that it knows that there is a soundcard on the pi and to use that as default
sudo nano /usr/bin/subsonic. find the line that says
-verbose:gc \ and add the following line above it
The last step is to tell the pi which sound output to use. There is a variable in this next command. The last character is ?. You can change this to be one of three values depending on where you want the sound to come from. the available values are:
1 = 3.5mm jack
2 = HDMI port
3 = Default
sudo amixer -c 0 cset numid=3 ?
That’s it! give your pi a reboot and you should now be able to play music directly on your pi.