Archive for May, 2012

Network Audio Players and Linux

Wednesday, May 30th, 2012

This is a short guide to using network audio players (sometimes called media streamers) with Linux. It mainly pertains to the Denon DNP-720AE, as this is the network audio player I use. However, the techniques and issues are likely to be similar for most network audio players.

There are two things you probably want to be able to do; browse music stored on your Linux box from the audio player and control what music is played from your Linux box.

Browsing Music

In order to browse music stored on a PC from the player, what you need to do is set-up UPnP (often called DLNA, but as far as I can tell this is the organisation behind UPnP, not the protocol itself). There are a few different software options for this, you should be able to find most of them in your distro’s repository:

XBMCXBMC logo

Perhaps the biggest and most developed software is XBMC, which provides a complete media environment. This is probably an excellent option if you want to set up a dedicated box for handling your media, but leave it alone otherwise – it doesn’t work very well as a desktop app and seemed to be fairly resource intensive. Also I didn’t quite get it working with the Denon; I never managed to get past a “Not Authorised” problem.

GMediaServer

If you’re happy with (or looking for) a simple console app that runs in the background, try GMediaServer. It needs almost no configuration – just point it at your media directory and go (e.g. gmediaserver /media/audio/mp3/). The major drawback of GMediaServer is that the only index it provides is directory based – you are stuck with whatever ordering your directory structure gives you (so you won’t be able to browse by artist or genre for instance). Also GMediaServer has no direct support for flac files, but you may be able to work around this by telling it to serve “unknown” file types. The website mentions that because all tag info is stored in memory, there may be issue with large collections, but in reality it’s a very light application – System Monitor tells me it is only using 11.5 MiB despite handling a collection with thousands of mp3s.

MediaTomb

MediaTomb logo If you want something that provides multiple indexes, or want to serve video files as well as audio, try MediaTomb. It’s not quite as simple to get started with as GMediaServer; Ubuntu users may want to follow this installation guide. Another advantage of MediaTomb is that it supports on-the-fly transcoding, so you could serve your ogg files as mp3s for example. Be aware that if you install MediaTomb on Ubuntu it immediately sets itself to launch on boot, which might not be what you want.

Streaming Music

UPDATE: See my newer post which describes how to use MPD to stream music. This is my recommended solution.

In order to directly control what the Denon plays, there are a few options. Apple airplay is supposedly supported, but I couldn’t get any of the Linux apps to work with it. In the end I had to set up a stream (effectively a local internet radio station). The main option for doing this seems to be:

IceCast 2

Be warned – the documentation for IceCast seems to be pretty sparse, and it’s a slightly convoluted process to get going.

Once you’ve installed the software (again it should be your distro’s repository), edit the config file (/etc/icecast2/icecast.xml on Ubuntu) to set the passwords and then set in ENABLE=true in /etc/default/icecast2. You should now be able to launch IceCast via /etc/init.d/icecast2 start, and get to the web interface at http://localhost:8000/ (assuming you didn’t modify the port in icecast.xml).

Now that IceCast is working, you need to add a stream, either corresponding to a playlist or just echoing a soundcard. The easiest solution I found was to use EzStream. To get playlist streaming working, copy the example config file /usr/share/doc/ezstream/examples/ezstream_mp3.xml somewhere and edit the following elements:

  • url – this needs to be the same as your IceCast server plus whatever stream name you want.
  • sourcepassword – same as IceCast config
  • filename – where your playlist lives

Once this is done, launch it with ezstream -c ezstream_mp3.xml. You should now be able to open the URL you provided in a music player such as banshee, or try pointing your web browser at it.

At this point you might think we are home clear, but that’s not quite the case – we still need to point the audio player at the stream. In the case of the Denon, there is no way to type in a given URL, so you have to set-up a RadioDenon account (hopefully other players give you a means to manually enter URLs). At RadioDenon you can enter the URLs of any stations you like and they will be picked up by the player. You will need to create a stream pointing to the local network address of the PC hosting the stream e.g. http://192.168.0.1/mystream (you can find your IP address via the ifconfig utility). Be aware that you might want to configure your router to always assign your PC the same address if you’re using DHCP.

Finally, you should now be able to access the RadioDenon option on the player and select your local stream.