Audacity can't record a second track with "default" playback

Hi folks,

Running Debian 8, Audacity 2.0.6. (Current version that ships with Debian)

I have a Presonus Audiobox USB. I can record one track via Audacity without issue.

Trying to record a second track, it randomly records between 0 and 0.1 second of time and prints to the terminal:

ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred
Expression 'err' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 3355
Expression 'ContinuePoll( self, StreamDirection_In, &pollTimeout, &pollCapture )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 3881
Expression 'PaAlsaStream_WaitForFrames( stream, &framesAvail, &xrun )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 4253

This is only if the “default” device is selected for playback. I can select the audiobox as the output device and that lets me record a second track while the first one is playing, no problem. But the issue for me is that I want to play back audio through the default device while recording a second track.

Another thing to note: I can play back sound on the “default” device no problem, the issue only occurs if default is selected for playback and I try to record a second track while listening to the first.

Thank you so much!

On Debian 8 Jessie, the default “device” is PulseAudio, which in this context you can think of as a “virtual device” in that it isn’t actually a hardware device but a middle-man between the application (Audacity) and the hardware devices. Unfortunately, using “Pulse” (PulseAudio) with Audacity can be unreliable on some machines due to the way that Audacity opens audio streams (“ports”) “on demand” rather than opening in/out ports once and keeping them open.

The workaround for this problem (and this looks to be the problem on your machine) is to select actual hardware devices (via their ALSA drivers) for play/record.
In addition to your Presonus Audiobox USB, I assume that you also have an on-board sound card, and I assume that is the device that you want to use for playback.
The hardware devices can be recognised by “hw” in the device name. For example, on my machine I have:

HDA Intel: ALC268 Analog (hw:0,0)
this is the on-board sound card.

Device name: USB Audio CODEC: - (hw:1,0)
this is a USB sound card.

To use the on-board sound card for playback, select the “hw” device that corresponds with your on-board sound card.

Limitations:
Most modern sound cards do not have hardware mixing capability.
What this means is that if you use the device directly via its ALSA driver, only one application at a time can use the device. If any other application is accessing the device, then the device will be unavailable to Audacity. To use the “hw” options, ensure that no other audio applications are running (this includes Flash player).