I was seeing an underrun error when attempting to use the latest version of Audacity on my Ubuntu box. It would cause the sound to become fast and distorted during playback. Audacity was completely unusable.

The error

ALSA lib pcm.c:7963:(snd_pcm_recover) underrun occurred

If you see these errors, there is a fast way to fix it.

The fix

$ sudo vim /etc/pulse/daemon.conf
default-fragments = 5
default-fragment-size-msec = 25

Open the pulse daemon configuration file, stay in normal mode, and then type -


This causes VIM to search. You will find two lines that have been commented out using ;. Uncomment the two lines above and edit their values to be 5 and 25 respectively. Then write and quit. :wq

$ pulseaudio -k

You will then need to kill and restart pulseaudio. You may have to wait for a while for your USB microphones to reconnect. Once you do this, it should solve your issue.

The Explanation ( What did I do? )

The Arch Linux Wiki defines the default fragments like so -

Audio samples are split into multiple fragments of default-fragment-size-msec each. The larger the buffer is, the less likely audio will skip when the system is overloaded. On the downside this will increase the overall latency. Increase this value if you have issues.

When we edit the configuration and increase the size of the fragments, we are less likely to run into an underrun. At the size we have chosen, we are unlikely to suffer from a tremendous latency issue. Your hardware may require fine tuning of the numbers chosen.