Shairport: Pop, crackle and other noise

I’m using the C version of Shairport on 64bit Ubuntu Natty to receive streaming audio from iTunes and iDevices. It’s working well, but there was a problem with the sound quality: popping and crackling noise made my music sound like it’s coming from a vinyl record.

dmesg was reporting that the HPET timer had to be adjusted several times during the playback. Turning off HPET forced the kernel to pick a different timing source, which fixed the audio quality problems. In /etc/default/grub I added hpet=disable to the GRUB_CMDLINE_LINUX_DEFAULT option, then ran update-grub and rebooted the host.

Another problem was that Shairport refused to play with IPv6. Disabling IPv6 via /etc/sysctl.conf fixed that issue.