Subsonic is a web-based music streaming application, it runs as a service on the computer holding your music and you can then play it on other devices connected to the server. Technically it’s a media streamer and although it does play video files, its main focus is as an audio streamer and that is what we will look at here. Through its web interface, Subsonic provides the usual features: playlists, cover art, lyrics and so on. The server can handle multiple connections, you can listen to different tracks in different rooms, or even while out of the house!
Subsonic is written in Java. If your package manager includes a recent version, install it in the usual way. Otherwise, use the standalone archive. We are using subsonic-4.9_beta2-standalone.tar.gz, although the full 4.9 release may well be available by the time you read this (which is why we are not using 4.8). Before installing from the archive, make sure you have a Java Runtime Engine (JRE) installed — either Sun Java or the open source IcedTea variant. The archive does not have all its files neatly in a directory, so you need to create one.
sudo mkdir /opt/subsonic
sudo tar -xf subsonic-4.9_beta2-standalone.tar.gz -C /opt/subsonic
There is no hard and fast rule as to where Subsonic should be installed, but /opt is the standard location for miscellaneous programs such as this. You could even install to your home directory if you only wanted to run it as one user. We need to create a user to run Subsonic and a home directory for them:
sudo useradd --home /var/subsonic --create-home --user-group subsonic
You also need to add some transcoders. Subsonic uses these to transcode audio formats on the fly and you will not get far without them. The embedded browser player doesn’t even play Ogg Vorbis files, so these need to be transcoded to MP3 before playing. Subsonic uses standard tools, such as ffmpeg, for this, but it doesn’t search the system for them — we need to link them into Subsonic’s transcode directory:
sudo mkdir -p /var/subsonic/transcode
sudo ln -s $(which ffmpeg)
sudo ln -s $(which flac)
sudo ln -s $(which lame)
It goes without saying that you should ensure these tools are installed, you’ll find that most distros will already have them in place.
If you installed from your package manager, it should have added an init script to start Subsonic when you boot. If you use the standalone archive, there’s a script at /opt/subsonic/subsonic.sh (assuming you installed to /opt/subsonic as above). Edit this script to set the paths for your default folders, then run it to start the Subsonic server. Then open your favourite browser and point it to http://localhost:4040, at which point you will be instructed to change the admin user’s password from the default of admin. Until you do this, anyone with access to your network can log in to Subsonic with administrator rights, so do this right after starting Subsonic for the first time. Note that if you are running Subsonic on slow hardware, it can take quite a while before the web server is available on the first run, more than a minute when we tried it on a Raspberry Pi.
Once you are logged in, you will see all the music from the default folder you set. To add more folders go to ‘Media Folders’ on the Settings page. Subsonic does not use ID3 tags to sort your music, although it does use them to display information; the listing of your music is based on the location of files in the filesystem. This works best if you have your music organised in an artist/album/track hierarchy.
The transcoders we just set up are not only used to convert between formats, they can also be used to alter the bit rate of streams. This is important when serving to remote clients, especially if the upstream bandwidth from your server is limited, or when the remote clients are using 3G data connections. This way, you can store your music in high-quality formats for the best local playback, but still listen to them on the go.
The default mode of operation is to access Subsonic via a web browser, which includes a flash-based player. From here, you can browse the available tracks, create and play playlists, download individual tracks or entire playlists and do most of the other things you would expect of a music player.
It is also possible to use an external player, either because you want extra features or don’t want to use flash. This works by creating a playlist in standard M3U format and sending that to the player. The external player then gets the files from the Subsonic server to play. This means it should work with any music player that supports M3U playlists. However, it doesn’t work with the Chromium browser, which tries to save the playlist rather than trying to open it. Firefox defaults to passing the playlist to your preferred media player.
Because you are able to set up multiple player profiles on the Settings page, you can have one to use the built-in player and another to use an external program. You can also use this page to set up players with bitrate limits, for use over slower network connections.
While you can use Subsonic from any computer on your network, it is also possible to access your music collection from elsewhere on the internet. To do this, you need to set up forwarding from your router to the computer running Subsonic. You can do this from the web interface if your router supports UPnP, otherwise you simply forward the relevant port — 4040 by default. If you have the Premium service (see ‘Added features for a buck’, left) you will have your own subsonic.org address that avoids the need for a static IP address or dynamic DNS service.
There are apps for most mobile OSs, or you can use a browser. The premium service is also needed if you want to use the Android app to play your collection, even when connected by Wi-Fi to your local network. You can, however, play from a browser or something like Bubble UPnP Player with the free service, provided your server is accessible from the internet and you have a contactable public address.
Subsonic also has a podcast fetcher: give it the URLs of the feeds of your favourite podcasts and it will grab new episodes as they become available. This is a Premium feature, though. Alternatively, you could use something such as FlexGet to download the podcasts and drop them into Subsonic’s podcasts folder.
Levels of users
The first user, the one who set up Subsonic, is able to create users, with quite fine-grained permissions. Click Settings from the top menu and go into users, where you can set the popup menu to New user. Then you can decide what that user is able to do. The default for a new user is to only allow them to play files. You can add permissions to download or upload files, comment and rate songs, share songs with others etc. You can also set the maximum bitrate for each user, which is important if you have a few users, particularly those likely to access the service remotely at the same time, as they could use a lot of your upstream bandwidth.
Subsonic usually operates as a classic client/server model, where the server sends the music and the client plays it. It also has a Jukebox mode, only available to users with suitable privileges, where the music is played on the server. If you have the server running on your living room PC, you can use a mobile client, or any other PC, to control it. Jukebox mode is controlled by the player settings on the web client or via touching the RC button on the Android client.
Added features for a buck
Subsonic offers a premium service that enables certain features: such as remote access through your own user.subsonic.org address; ability to use mobile clients to listen to music from outside of your network; podcast downloading and more. This costs US$1 per month, as it uses their servers, but is free for the first month. If you are feeling creative, you can implement many of these features with the free version by using facilities such as a dynamic DNS service and a VPN. On the other hand, a dollar a month saves you the trouble and contributes towards further development of Subsonic.