Fix Static on XBMC Sound Signal

Posted on 27 October 2010  •  Permalink  •  Category htpc

After having set up XBMC, I loaded in all my music and video (where music actually was the most important, because my iPod was blasted by lightning). I already listened to several of my albums for a couple of days using my new and shiny mbox, after I started noticing a bit of static, especially during silences in a song, or in between albums when no music is playing.

I tried some things, fiddling with the cables that connect mbox to my amp, but that didn’t help, I did however find out that turning up the volume on the amplifier while no music is playing made it worse. So it must be something in the system I guessed.

I was a bit afraid that the static might be caused by a component, maybe the fan, or whatever. But fortunately when I fired up alsamixer I found the problem. Simply all and every channel was turned up to its loudest value. Even the input channels! After muting those input channels, the static was gone. Although it returned when I rebooted the system.

Turns out that the xbmc-live package installs an init script that contains some code that’s apparently the problem: on boot in turns each and every channel’s volume to it’s max, including the input levels.

Luckily this can be fixed quite easily. Edit /etc/default/grub, and from the variable GRUB_CMDLINE_LINUX_DEFAULT remove the setvolume constant from [list] in the xbmc=[list] argument. This will prevent the XBMC init script to screw up the volume levels.

Still it’s nice to store a decent mixer configuration and have that load up on boot. We can do that with ALSA as follows: first use alsamixer to set up the levels the way you want them, then to store the levels as the default configuration for next bootup, run:

sudo alsactl store 0

And that’s that, another problem fixed.