Getting gstreamer to work on a Raspberry Pi

Having now got gmrender to compile and run on the Raspberry Pi and use gstreamer as a backend I need to fix the audio quality issues. A bit more googling revealed a post from someone doing much the same as me. One of Chris Baume’s commenters also had problems with the audio qut.ality and suggested that directing the audio via PulseAudio fixed it.

It’s been a long time since I got into the detail of linux audio systems and it all seems to have changed. There’s a great article on how linux audio works which helps explain things a lot.

The following annotated shell transcript shows how I installed PulseAudio and configured gstreamer to use it. I may post have now posted a complete cleaned up installation guide later but personally I find seeing how other people have made mistakes and worked out how to do things instructive as well.

$ sudo apt-get install gstreamer0.10-pulseaudio

# Need to configure gstreamer to use pulseaudio
# Looking here: https://wiki.archlinux.org/index.php/PulseAudio

$ gconftool-2 -t string --set /system/gstreamer/0.10/default/audiosink pulsesink
$ gconftool-2 -t string --set /system/gstreamer/0.10/default/audiosrc pulsesrc

# and another just in case:

$ gconftool-2 -t string --set /system/gstreamer/0.10/default/musicaudiosink pulsesink

# check the keys are there:

$ gconftool-2 -a /system/gstreamer/0.10/default
 musicaudiosink_description = Default
 audiosrc = pulsesrc
 audiosrc_description = Default
 chataudiosink_description = Default
 musicaudiosink = pulsesink
 audiosink_description = Default
 visualization = goom
 videosrc = v4l2src
 audiosink = pulsesink
 chataudiosink = autoaudiosink
 videosink = autovideosink

# Still not working
# Then I realise I don't have pulseaudio itself installed...

$ sudo apt-get install pulseaudio

After doing all of that the sound was just the same. I later realised that I probably didn’t actually have PulseAudio running and would need to start it with the command “pulseaudio –start” but next time I turned the Pi on to try it, PulseAudio was running and the sound from gmedia-resurrected, via gstreamer, to PulseAudio, ALSA and finally to the hardware sounded just great! How strange that adding another layer to the sound stack makes it better, not worse…

One problem I’ve just noticed is that when you skip forwards a track in an album for instance then there are a few pops and clicks.

Next task is to get the gmediarender process to start on boot.