Okay, here’s what I found out…
First, the env-variable setting did fix things initially. (I switched back and forth between using it and not, and the effect was consistent.) I dug up a mention that one can apply this to the menu-based start-up of Audacity by modifying the /usr/share/applications/audacity.desktop file and changing Exec=audacity %F to:
Exec=env PULSE_LATENCY_MSEC=1 audacity %F
at least on my Lubuntu 14.04.1 system (YMMV).
I also tried to figure out why the latency change, to see if I could fix the problem at its source. When I’d run (non-tweaked) Audacity from the command line, I got a stream of the following errors upon playing the file:
ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred
. . .
ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred
ArchLinux.org had a discussion ([SOLVED] ‘(snd_pcm_recover) underrun occurred’) that suggested changing shrinking the default-fragment-size-msec setting in /etc/pulse.conf, as (according to their PulseAudio/Configuration page), larger fragments of sound to process can increase latency.
I tried this out, changing default-fragment-size-msec=10 and default-fragments=8 to:
default-fragments=16
default-fragment-size-msec=5
(I doubled default-fragments to provide the same buffered amount and avoid underruns, I hope). After making sure the pulse daemon would start fresh with pulseaudio -k, this seemed to work. Audacity played things normally without the PULSE_LATENCY env setting.
But when I switched it back, Audacity still worked. Huh? I rebooted to make sure PulseAudio came up with its original settings, and Audacity stubbornly refused to break, even without any changes.
So, I’m back to thinking there’s something transient in my environment that can cause Audacity to suffer latency problems. But at least there are two possible fixes:
- Set PULSE_LATENCY to 1, either by command-line invocation or with an audacity.desktop setting.
- Change the fragment settings in PulseAudio’s daemon.conf.
A third way might be to simply increase the default-fragments, since the problem apparently generated an “underrun” error.
Hope this helps anyone else who might run into this problem. Thanks again to Elwro and Gale, and to the ArchLinux folks, for the tips. (I didn’t get to try Gale’s tests because the problem went away on its own, but I’ll keep them in mind if it returns.)