Using the Raspberry Pi as a DLNA receiver for a stereo system

Linux Computer

It is more difficult to re-route audio output from a Linux computer than from an Android device. However, you can simplify the process of setting up DLNA streaming on a computer by using PulseAudio and also Rygel, which is a DLNA-compatible media server solution [6]. Using a package management system, install Rygel along with the PulseAudio tools. Listing 1 shows the command for installing under Debian, Ubuntu, or Linux Mint. Fill in the configuration file ~/.config/rygel.conf with the content from Listing 2.

Listing 1

Installing Rygel in Debian

$ sudo apt-get install rygel rygel-gst-launch paprefs pavucontrol

Listing 2

rygel.conf

[GstLaunch]
enabled=true
launch-items=mypulseaudiosink
mypulseaudiosink-title=Audio on @HOSTNAME@
mypulseaudiosink-mime=audio/flac
mypulseaudiosink-launch=pulsesrc device=upnp.monitor ! flacenc

Next, open the PulseAudio settings via the start menu or via the paprefs command, and in the Network Server tab, activate the options Make local sound devices available as DLNA/UPnP Media Server; in the Multicast/RTP tab, choose Create separate audio device for Multicast/RTP. The virtual device DLNA/UPnP Streaming will appear in the PulseAudio volume control (pavucontrol) in the Output Devices tab (Figure  2). If the virtual device does not appear, try restarting the computer.

Figure 2: A new, virtual output device will appear in the PulseAudio volume control when DLNA/UPnP streaming is activated.

When you start Rygel for the first time, start it manually using the command rygel. Then switch over to the media center and follow the path Music | Files | Add Source | Browse | UPnP Devices. You will see the two new entries: <Your username>'s media and Gst Launch. Select Gst Launch (Figure 3) and confirm the input with OK; then, give the source a very descriptive name.

Figure 3: If the DLNA server Rygel is running on the network, XBMC will register a new DLNA source on a Raspberry Pi with the Gst Launch plugin.

To route sounds from Linux programs onto the Rasp Pi, you should let XBMC search for a DLNA source. Follow the menu path Music  | Files | <DLNA source> and select Unknown Audio on <computer>. Afterwards, play the desired program on the PC and open the PulseAudio volume control again.

The Playback tab of the application provides a current list of all programs that are running and also producing audio output on PulseAudio. You will find a selection box on the volume control for choosing the audio output. When you click on the box and choose DLNA/UPnP Streaming, the Raspberry Pi will produce the sound a few seconds later.

Conclusion

Once DLNA streaming is installed, it is easy and reliable to use. However, the technology is only suitable for applications that tolerate delays in audio output. Latency can often amount to a few seconds. If you want to play a film, for instance, the perceptible discrepancy between image and sound is not acceptable.

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content