THIS IS A WORK IN PROGRESS
Whats wrong with your audio?
Audio was reconfigured in Hardy Heron to use jackd. jackd is a kind of audio patch panel though which all audio should be routed.
However, audio is something that the brain really knows how to do, so when things don't quite work, it really notices. Thus pops, cracks and other drop outs are really annoying.
How come?
What this really means is that the jack server, which in linux terms is "just another program" is not getting cpu power at the right time to deliver audio data to the sound card - the other programs running are getting in the way.
This is because the normal linux kernel likes to give out the CPU fairly (well, a bit of a simplification), and doesn't support programs requesting to be run again "very soon". In addition, even if "jack" gets its slice of the cherry, the sound-card itself has specifie requirements too. It sends an "interrupt" to linux to tell it stuff ( like "I need some more audio data"), and linux must react super fast if the audio isn't going to sound dodgy.
How to fix it?
I couldn't find any info for ubuntu on what to do, so here's what I found out.
Install the Realtime Kernel
% sudo apt-get install linux-rt
% sudo reboot
OK, so what changed?
Lots of stuff. However one of the most visible changes is that now there are a bunch more "kernel processes". If you do
% ps -fu root
You will see that there are a lot of [IRQ-xx] processes. This is because interrupts (which control hardware), now run pretty much the same as normal programs.
Check you're in the audio group, and that it exists
grep audio /etc/group
- should display "audio:x:29:someuser,anotheruser,youruser"
Configure the "audio" group to have real-time access.
sudo vi /etc/security/limits.conf
add the lines:
This gives users in the audio group access to run stuff at priority 99. It also makes sure that when you "su" or "sudo" to less privileged users, the permissions are removed.
It also gives audio users the ability to "lock" memory regions - which jack likes to do.
Figure out how to give real-time access to the sound-card
To do this, we need to figure out which interrupt looks after your sound card.
% sudo cat /proc/interrupts
will return something like this
Now, my sound card is called "HDA Intel", so we can see it runs on interrupt 22, also known as IRQ-22
we can see that it has a kernel thread looking after it:
% ps -fu root | grep IRQ-22
Give Realtime access to the soundcard
% sudo chrt -p 99 `pidof "IRQ-22"`
Your IRQ may be different.
Start Jack at the right priority.
% qjackctl
Make sure the settings look like this:
References
http://tapas.affenbande.org/wordpress/?page_id=6
http://ubuntuforums.org/showthread.php?t=743470
http://www.gentoo.org/proj/en/desktop/sound/realtime.xml