Audacity v slow to start [SOLVED]

Audacity is dreadfully slow to start, over 2 minutes. Any ideas on how to fix or even debug this? Arch Linux version 242.0-1; Audacity 2.3.1

After starting, it works normally.

You could try launching Audacity from a Terminal window so that you can see what it is doing.
The command is just:

audacity

It’s normal to see a load of messages, including multiple messages saying:

ALSA lib pcm_dsnoop.c:606:(snd_pcm_dsnoop_open) unable to open slave

and ending with something like:

xpression 'ret' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1736
Expression 'AlsaOpen( &alsaApi->baseHostApiRep, params, streamDir, &self->pcm )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1904
Expression 'PaAlsaStreamComponent_Initialize( &self->capture, alsaApi, inParams, StreamDirection_In, NULL != callback )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2171
Expression 'PaAlsaStream_Initialize( stream, alsaHostApi, inputParameters, outputParameters, sampleRate, framesPerBuffer, callback, streamFlags, userData )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2840
Expression 'stream->playback.pcm' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 4611
Expression 'stream->playback.pcm' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 4611
09:06:20: Debug: Unknown accel modifier: 'left'
09:06:20: Debug: Unknown accel modifier: 'click/left'
09:06:20: Debug: Unrecognized accel key 'drag', accel string ignored.
09:06:20: Debug: Unknown accel modifier: 'left'
09:06:20: Debug: Unrecognized accel key 'click', accel string ignored.
09:06:20: Debug: Unknown accel modifier: 'right'
09:06:20: Debug: Unrecognized accel key 'click', accel string ignored.
09:06:20: Debug: Unknown accel modifier: 'left'
09:06:20: Debug: Unknown accel modifier: 'click/left'
09:06:20: Debug: Unrecognized accel key 'drag', accel string ignored.
09:06:20: Debug: Unknown accel modifier: 'left'
09:06:20: Debug: Unrecognized accel key 'click', accel string ignored.
09:06:20: Debug: Unknown accel modifier: 'right'
09:06:20: Debug: Unrecognized accel key 'click', accel string ignored

What we’re interested in, is to see at what point in the launch is Audacity getting hung up for a long time. You may need to launch, shut down, launch again … several times to work out where the hold up occurs.

OK. Followed your advice. Here’s the output.

I inserted the word ‘stop’ where the pgm paused. I mostly didn’t time them but they were more than 15 s each.
The one I did time was 60 s. You will see it noted in the code.

HTH

Andrew



 
bash pix 501 ~ $ audacity
lilv_world_add_plugin(): warning: Duplicate plugin <http://lv2plug.in/plugins/eg-midigate>
lilv_world_add_plugin(): warning: ... found in file:///usr/lib/lv2/eg-midigate.lv2/
lilv_world_add_plugin(): warning: ... and      file:///usr/lib64/lv2/eg-midigate.lv2/ (ignored)
lilv_world_add_plugin(): warning: Duplicate plugin <http://lv2plug.in/plugins/eg-sampler>
lilv_world_add_plugin(): warning: ... found in file:///usr/lib/lv2/eg-sampler.lv2/
lilv_world_add_plugin(): warning: ... and      file:///usr/lib64/lv2/eg-sampler.lv2/ (ignored)
lilv_world_add_plugin(): warning: Duplicate plugin <http://lv2plug.in/plugins/eg-amp>
lilv_world_add_plugin(): warning: ... found in file:///usr/lib/lv2/eg-amp.lv2/
lilv_world_add_plugin(): warning: ... and      file:///usr/lib64/lv2/eg-amp.lv2/ (ignored)
lilv_world_add_plugin(): warning: Duplicate plugin <http://lv2plug.in/plugins/eg-scope#Mono>
lilv_world_add_plugin(): warning: ... found in file:///usr/lib/lv2/eg-scope.lv2/
lilv_world_add_plugin(): warning: ... and      file:///usr/lib64/lv2/eg-scope.lv2/ (ignored)
lilv_world_add_plugin(): warning: Duplicate plugin <http://lv2plug.in/plugins/eg-scope#Stereo>
lilv_world_add_plugin(): warning: ... found in file:///usr/lib/lv2/eg-scope.lv2/
lilv_world_add_plugin(): warning: ... and      file:///usr/lib64/lv2/eg-scope.lv2/ (ignored)
lilv_world_add_plugin(): warning: Duplicate plugin <http://lv2plug.in/plugins/eg-fifths>
lilv_world_add_plugin(): warning: ... found in file:///usr/lib/lv2/eg-fifths.lv2/
lilv_world_add_plugin(): warning: ... and      file:///usr/lib64/lv2/eg-fifths.lv2/ (ignored)
lilv_world_add_plugin(): warning: Duplicate plugin <http://lv2plug.in/plugins/eg-params>
lilv_world_add_plugin(): warning: ... found in file:///usr/lib/lv2/eg-params.lv2/
lilv_world_add_plugin(): warning: ... and      file:///usr/lib64/lv2/eg-params.lv2/ (ignored)
lilv_world_add_plugin(): warning: Duplicate plugin <http://lv2plug.in/plugins/eg-metro>
lilv_world_add_plugin(): warning: ... found in file:///usr/lib/lv2/eg-metro.lv2/
lilv_world_add_plugin(): warning: ... and      file:///usr/lib64/lv2/eg-metro.lv2/ (ignored)
lilv_world_add_plugin(): warning: Reloading plugin <http://lv2plug.in/plugins/eg-midigate>
lilv_world_add_plugin(): warning: Reloading plugin <http://lv2plug.in/plugins/eg-sampler>
lilv_world_add_plugin(): warning: Reloading plugin <http://lv2plug.in/plugins/eg-amp>
lilv_world_add_plugin(): warning: Reloading plugin <http://lv2plug.in/plugins/eg-scope#Mono>
lilv_world_add_plugin(): warning: Reloading plugin <http://lv2plug.in/plugins/eg-scope#Stereo>
lilv_world_add_plugin(): warning: Reloading plugin <http://lv2plug.in/plugins/eg-fifths>
lilv_world_add_plugin(): warning: Reloading plugin <http://lv2plug.in/plugins/eg-params>
lilv_world_add_plugin(): warning: Reloading plugin <http://lv2plug.in/plugins/eg-metro>
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
stop
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Timeout

stop
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Timeout

ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
stop
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
60s from last stop to here
stop
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
Expression 'stream->playback.pcm' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 4611
Expression 'stream->playback.pcm' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 4611
Expression 'stream->playback.pcm' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 4611
Expression 'stream->playback.pcm' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 4611
Expression 'stream->playback.pcm' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 4611
Expression 'stream->playback.pcm' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 4611
Expression 'stream->playback.pcm' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 4611
Expression 'stream->playback.pcm' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 4611
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ScreenToClient cannot work when toplevel window is not shown
12:01:00: Debug: ClientToScreen cannot work when toplevel window is not shown
12:01:00: Debug: ClientToScreen cannot work when toplevel window is not shown
12:01:00: Debug: ClientToScreen cannot work when toplevel window is not shown
12:01:00: Debug: ClientToScreen cannot work when toplevel window is not shown
12:01:00: Debug: ClientToScreen cannot work when toplevel window is not shown
12:01:00: Debug: ClientToScreen cannot work when toplevel window is not shown
12:01:00: Debug: ClientToScreen cannot work when toplevel window is not shown
12:01:00: Debug: ClientToScreen cannot work when toplevel window is not shown
12:01:00: Debug: ClientToScreen cannot work when toplevel window is not shown
12:01:01: Debug: Unrecognized accel key 'backspace', accel string ignored.
12:01:01: Debug: Unrecognized accel key 'backspace', accel string ignored.
12:01:01: Debug: Unrecognized accel key 'numpad_enter', accel string ignored.
12:01:01: Debug: Unrecognized accel key 'numpad_enter', accel string ignored.
12:01:01: Debug: ClientToScreen cannot work when toplevel window is not shown
12:01:01: Debug: ClientToScreen cannot work when toplevel window is not shown
12:01:01: Debug: ClientToScreen cannot work when toplevel window is not shown
12:01:01: Debug: ClientToScreen cannot work when toplevel window is not shown
12:01:01: Debug: ClientToScreen cannot work when toplevel window is not shown
12:01:01: Debug: ClientToScreen cannot work when toplevel window is not shown
12:01:01: Debug: ClientToScreen cannot work when toplevel window is not shown
12:01:01: Debug: ClientToScreen cannot work when toplevel window is not shown
12:01:01: Debug: ClientToScreen cannot work when toplevel window is not shown
12:01:01: Debug: ClientToScreen cannot work when toplevel window is not shown
12:01:01: Debug: ClientToScreen cannot work when toplevel window is not shown
--here window opens

Is PulseAudio installed on your computer? If it is, is it running?

Yes, pulseaudio is running. At least it has an entry in ps. But when I say ‘pactl list’ it says ‘Connection refused’

From what I see around the net, pa uses an IP socket to communicate. Should I try to debug by looking for its socket? And if there is none, what then?

I’ll have a look at the net and see if I can come up with any ideas.

You’ve found the problem.

You can see the same thing in the terminal output when launching Audacity. It gets to the point where it tries to connect to PulseAudio, but does not succeed and times out.

ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Timeout

You need to debug PulseAudio to find out why it is refusing connections, and fix that.
I don’t know much about Arch, so these are just some vague suggestions off the top of my head and I’m not even certain that they apply to Arch, but may give you some clues.

Is the PulseAudio daemon actually running? This is what I see:

~$ pactl stat
Currently in use: 1 blocks containing 63.9 KiB bytes total.
Allocated during whole lifetime: 849 blocks containing 5.2 MiB bytes total.
Sample cache size: 0 B

It could be a permissions problem. Is your user account a member of the “audio” group? Can you connect as root?
Can other applications (such as “pavucontrol”) connect to Pulse?

Check the PulseAudio config files.
Do you have the module “suspend-on-idle”? Is it enabled in the default config? (it should be)
Is “autospawn” enabled? (it should be)
You could try deleting your per-user pulse config (could be at ~/.pulse or ~/.config/pulse or similar) and let PulseAudio recreate it on reboot.

Try killing pulseaudio, then see if the problem occurs after it respawns.

OK – SOLVED

Your first idea was right: See if PA is running.

When using a per-user PA, the convention is for the window manager to read the desktop files (/etc/xdg/autostart) and start the programs therein.

My win-mgr is non-standard, so I needed to arrange for it to run the start-up program (start-pulseaudio-x11) another way. Took a while, but found it at last.

Excellent, and thanks for posting the solution.
I’ll close this topic as “solved”.