Can only record one track

Hi,

First of all, thanks for making this software.

Im using Kubuntu 20.04. I had no issues with the packaged version and everything worked fine when I built version 2.4.2 from source. Then one day when I tried to record a second track, it instantly stopped recording it and printed these errors on the console:

ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
Expression 'err' failed in '/home/lior/dev/audacity-minsrc-2.4.2/lib-src/portaudio-v19/src/hostapi/alsa/pa_linux_alsa.c', line: 3355
Expression 'ContinuePoll( self, StreamDirection_In, &pollTimeout, &pollCapture )' failed in '/home/lior/dev/audacity-minsrc-2.4.2/lib-src/portaudio-v19/src/hostapi/alsa/pa_linux_alsa.c', line: 3896
Expression 'PaAlsaStream_WaitForFrames( stream, &framesAvail, &xrun )' failed in '/home/lior/dev/audacity-minsrc-2.4.2/lib-src/portaudio-v19/src/hostapi/alsa/pa_linux_alsa.c', line: 4274

If I press the record button many times it will usually work once but will fail again on the next time.
I tried downgrading back to verison 2.2 packaged in Ubuntu but it didnt help.
It also doesn’t matter which input device Im trying to record (the built-in mic, a USB mic or a Zoom g5n)
Today I built version 3.0.0 from source but the issue persists, though there aren’t any messages in the console.
Rebooting doesnt help either.
If I delete the first track I can always record it back but if there is an existing track it will fail.
I suspect that an upgrade to pulseaudio is the cause but Im not sure.
Also, on some rare occasions everything works fine.

Any help is appreciated.

Check what other apps are running. There may be another app fighting for control of the sound card (voip apps are infamous for doing this, but even web browsers can cause this type of problem sometimes).

I closed my browser & spotify and made sure no other app is running but it didn’t help.

Setting these values in pulseaudio daemon.conf seems to make things better, it still fails but less times:

default-fragments = 2
default-fragment-size-msec = 1

The problem with these settings is that is still not 100% working and also trying to play something on Youtube or Spotify sounds aweful.

Fwiw, this is my pulseaudio daemon.conf

; daemonize = no
; fail = yes
; allow-module-loading = yes
; allow-exit = yes
; use-pid-file = yes
; system-instance = no
; local-server-type = user
; enable-shm = yes
; enable-memfd = yes
; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB
; lock-memory = no
; cpu-limit = no

; high-priority = yes
; nice-level = -11

; realtime-scheduling = yes
; realtime-priority = 5

; exit-idle-time = 20
; scache-idle-time = 20

; dl-search-path = (depends on architecture)

; load-default-script-file = yes
; default-script-file = /etc/pulse/default.pa

; log-target = auto
; log-level = notice
; log-meta = no
; log-time = no
; log-backtrace = 0

; resample-method = speex-float-1
; avoid-resampling = false
; enable-remixing = yes
; remixing-use-all-sink-channels = yes
; remixing-produce-lfe = no
; remixing-consume-lfe = no
; lfe-crossover-freq = 0

; flat-volumes = no

; rescue-streams = yes

; rlimit-fsize = -1
; rlimit-data = -1
; rlimit-stack = -1
; rlimit-core = -1
; rlimit-as = -1
; rlimit-rss = -1
; rlimit-nproc = -1
; rlimit-nofile = 256
; rlimit-memlock = -1
; rlimit-locks = -1
; rlimit-sigpending = -1
; rlimit-msgqueue = -1
; rlimit-nice = 31
; rlimit-rtprio = 9
; rlimit-rttime = 200000

; default-sample-format = s16le
; default-sample-rate = 44100
; alternate-sample-rate = 48000
; default-sample-channels = 2
; default-channel-map = front-left,front-right

; default-fragments = 4
; default-fragment-size-msec = 25

; enable-deferred-volume = yes
deferred-volume-safety-margin-usec = 1
; deferred-volume-extra-delay-usec = 0

(everything at default except:
deferred-volume-safety-margin-usec = 1)

What are you recording from?
Unless you are recording sounds playing on the computer, you can bypass Pulse by selecting the “hw” option in the Device Toolbar that corresponds with your recording device.

Im recording from a Yeti USB microphone and a Zoom G5n (guitar multi-effects) connected via USB as well.
The Zoom only has a hw option and that doesnt work well for me.

Why, what’s the problem?

There should be a “hw” option for the Yeti, but only if the Yeti is connected before launching Audacity, or after “Rescan Audio Devices” (in the “Transport” menu).

The problem is that only one track is being recorded.
When trying to record another one, audacity just create an empty new track and stops recording.
Tweaking the pulseaudio settings does help but doesnt fix it 100%.

I see the same error since I installed the low latency kernel on Ubuntu 20.
The first recording track works fine the second fails as you described.
This is with an SSL2 attached.
If I use the internal sound card it works fine.

The workaround that I found was to start jack, launch Audacity and use Jack as Audio Host, Recording and Playback device.

Using Jack also fixes my issue, thanks!