Audacity Stops Recording with Alsa messages

Help for Audacity 2.x.x on GNU/Linux.

ImageThis forum is for Audacity 2.x.x on GNU/Linux and Unix-like operating systems.
Please state which version of Linux you are using, the exact three-section version number of Audacity from Help > About Audacity... and whether you installed your distribution's release or daily version of Audacity or compiled Audacity from source code.

Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.

Audacity Stops Recording with Alsa messages

Permanent link to this post Posted by fhuddles » Mon Aug 07, 2017 3:49 am

I am running Debian Linux version "buster/sid", and Audacity 2.1.3, loaded from the Debian distribution. I am trying to record an LP using a NAD PP4 preamp, which has a USB output. In the Device Toolbar, I have selected:
ALSA, USB Audio CODEC: - (hw:1,0), 2 (stereo) Record, default
I can record fine until Audacity stops recording. The messages on the terminal from which I ran Audacity are this:
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
Expression 'alsa_snd_pcm_drop( stream->capture.pcm )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 3046
Expression 'AlsaStop( stream, 0 )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 3245
Expression 'AlsaRestart( self )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 3313
Expression 'PaAlsaStream_HandleXrun( self )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 3939
Expression 'PaAlsaStream_WaitForFrames( stream, &framesAvail, &xrun )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 4274
Expression 'alsa_snd_pcm_drop( stream->capture.pcm )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 3046

I get those underrun messages even before I start recording, when I turn on monitoring, so I don't know if they are a factor. The "Expression"
messages occur when Audacity stops recording. This can happen within a few seconds or it can record maybe 12 minutes or so before it happens.
The answer to another post with some similar messages said that the sound system had "crashed". This looks like it might be the case. But why,
and what do I do about it?
I have a dual-core CPU and I saw them at about 25-35% use while recording. I also saw pulseaudio running: about 6%. From some other posts I've seen recommendations to bypass pulseaudio, but how? It's started by the system and restarts if one kills the process. I suppose it's being used in the recording, or maybe just the monitoring. There is no other option than ALSA for that first column in the Device Toolbar.
I've got about 6G free disk space.
Thanks for any help.
fhuddles
 
Posts: 4
Joined: Sun Aug 06, 2017 6:39 pm
Operating System: Linux Debian

Re: Audacity Stops Recording with Alsa messages

Permanent link to this post Posted by steve » Mon Aug 07, 2017 8:32 am

To bypass PulseAudio; in the device toolbar, select the "hw:" option for the device that you want to use (both recording and playback).

For example, the built-in sound card on my laptop is listed as:
HDA Intel PCH: ALC269VC Analog (hw:0,0)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45388
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Audacity Stops Recording with Alsa messages

Permanent link to this post Posted by fhuddles » Tue Aug 08, 2017 1:42 am

Yes, it appears that's what I did: I selected "USB Audio CODEC: - (hw:1,0)". But I still saw pulseaudio activity, and in any case, what about those errors? Are they a result of some kind of interaction with pulseaudio?
fhuddles
 
Posts: 4
Joined: Sun Aug 06, 2017 6:39 pm
Operating System: Linux Debian

Re: Audacity Stops Recording with Alsa messages

Permanent link to this post Posted by steve » Tue Aug 08, 2017 7:48 am

The "Pa" in, for example, "PaAlsaStream_HandleXrun" refers to PortAudio, not PulseAudio.
PortAudio is the software library that handles audio input/output, and is used regardless of which audio system is used.

Note that debug messages are not always "errors". Audacity has several 'levels' of message reporting which include "information", "warnings" and "errors". Actual "errors" will usually say explicitly "Error: description of error...".

The messages in this case are indicating that ALSA has run out of data. This can happen if audio data is not being read from disk quickly enough to provide ALSA's real-time playback needs. In other words, there seems to be a data bottleneck somewhere that is preventing audio data from getting to the sound card fast enough.

Are you recording to, or playing back from an external drive? Is the USB preamp connected directly to the computer, or via a USB hub?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45388
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Audacity Stops Recording with Alsa messages

Permanent link to this post Posted by fhuddles » Tue Aug 08, 2017 5:40 pm

Thanks for the explanation. I didn't know for sure that those were fatal errors, but since they happened when Audacity stopped recording, I assumed they were.
I am plugging the turntable into the preamp with standard audio cables (left and right), and then USB directly from the preamp to my laptop.
I have sometimes plugged audio output from the preamp to a receiver/amplifier but I stopped doing that just in case there was some kind of additional load or interference as a result. I'm not sure it made any difference but in any case it didn't fix the problem.
I don't know if this helps but I have tried using "arecord" with some success: a few "overruns" on one try, and no errors or messages on another.
I don't know what would be a bottleneck for the signal. I will try using a different USB cable, if I have one.
fhuddles
 
Posts: 4
Joined: Sun Aug 06, 2017 6:39 pm
Operating System: Linux Debian

Re: Audacity Stops Recording with Alsa messages

Permanent link to this post Posted by steve » Wed Aug 09, 2017 8:38 am

fhuddles wrote:I will try using a different USB cable

That's a good idea. Also, if your computer is a desktop / tower machine, try the USB sockets on the back (they often work better than the ones on the front).
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45388
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Audacity Stops Recording with Alsa messages

Permanent link to this post Posted by fhuddles » Mon Sep 11, 2017 3:55 am

I wanted to post a follow-up since the original thread was rather inconclusive. I have had some success recording with no underruns or overruns. However, I did this by using another computer, one running Arch Linux where I had not installed pulseaudio. I can't get playback while I'm recording but I can live with that: most of the
time I don't really want it anyway.
On my original computer I tried a number of things, some suggested by the "Linux Issues" post in the Audacity Wiki:
http://wiki.audacityteam.org/wiki/Linux ... s_on_Linux

Here's a summary, in hopes this might provide some useful information to somebody:
Using Audacity on (Thinkpad x301 running Debian Linux):
1. Input: Alsa, USB Audio CODEC (hw:1,0)
Output (monitor): HDA Intel: CX20561 Analog (hw:0,0)
Result:
Very intermittent recording and playing, at the same time. No errors from terminal.
I stopped mopidy but no improvement.

2. Using same input, but output: HDA Intel: CX20561 Digital (hw:0,1):
Started recording, but no playback. Then stopped, then started: intermittent. No playback ever.
Did not see pulseaudio in conky, either in this or previous test.
No errors on terminal.
Seems lower (R or L, I'm not sure which is in the lower position) track sound very low.

3. Same input: output: sysdefault (pulseaudio)
Since I know this produces problems, I will use the latency string:
env PULSE_LATENCY_MSEC=30
Results:
It does play while recording, but I hear skips. Lower track is better: more sound.
No errors on terminal.
I didn't see pulseaudio on playback but forgot to look when recording. It skipped on playback, too.

4. Same as 3 but using 15 for latency:
Same: skips. Maybe even more.

-- Just to make sure I wasn't hearing skips from the record itself, I played the first song using vlc. It played fine: no drop-outs,
which is what I've been hearing w Audacity. Also, it sounded better, although that's hard to judge with the laptop speakers. It was
playing from "USB Codec Analog" which isn't an option in Audacity.

5. Same as 3 but using 60 for latency:
Drop-outs. No errors reported on terminal. I did not see pulseaudio running while recording in conky.

6. Using "default" as output. latency=30:
Recording did not start. Lots of errors in terminal: alsa underruns, etc. Also Expression 'xxx' failed in xxx:
example:
Expression 'PaAlsaStream_WaitForFrames( stream, &framesAvail, &xrun )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 4274
and maybe the real culprit:
ALSA lib pcm_pulse.c:752:(pulse_prepare) PulseAudio: Unable to create stream: Connection terminated
fhuddles
 
Posts: 4
Joined: Sun Aug 06, 2017 6:39 pm
Operating System: Linux Debian


Return to GNU/Linux and Unix-like



Who is online

Users browsing this forum: No registered users and 3 guests