No more pop sounds in xbmc on the Raspberry PI (Xbian)

In order to get rid of the annoying pop sounds when XBMC switches songs multiple people suggested to use Pulseaudio to power up the sound-card and never power it down. For example in this bugreport or article .

I will explain how I set up Pulseaudio to get it working. These steps should be the same on any Raspbian/Debian based distro

First things first :

sudo apt-get install pulseaudio alsa-utils

Then change /etc/asound.conf to look like :

pcm.mmap0 {
    type mmap_emul;
    slave {
      pcm "hw:0,0";
    }
}

#pcm.!default {
#  type plug;
#  slave {
#    pcm mmap0;
#  }
#}

pcm.pulse { type pulse }
ctl.pulse { type pulse }
pcm.!default { type pulse }
ctl.!default { type pulse }

Next make sure that pulseaudio is NOT in system mode, this trick does not seem to work when it is in system mode. Check /etc/default/pulseaudio:

PULSEAUDIO_SYSTEM_START=0

then change the sample rate to 48000 as it seems that 44100 does not work. Do that in /etc/pulse/daemon.conf . Either find and enable, or paste these two lines at the end:

resample-method = trivial
default-sample-rate = 48000

Now to force the sound card to never shut down, comment out or remove the following line in /etc/pulse/default.pa

load-module module-suspend-on-idle

now you should be all set.

To test if Pulseaudio works get a .wav file e.g. from here and play it with

paplay <your .wav>

If there is no sound use the following to change alsa’s playback to the sound card.

 sudo amixer cset numid=3 1 

you can also check if the sound isn’t muted with

 alsamixer 

There are still a few problems:

  • skipping to the next song doesn’t crackle anymore, but there are a few seconds where they bleed into each other. However this does not happen during normal playback it seems.
  • Skipping around in movies still makes crackling noises.

Leave a Reply