frequent freezes on Ubuntu 16.04

I am on Ubuntu 16.04 and I am using Audacity 2.3.1. Audacity often freezes and I have to shut down the program and restart it. The information I came across https://wiki.audacityteam.org/wiki/Linux_Issues suggests that it might have something to do with the pulse audio, so I tried to change it as indicated by starting up with a terminal. However, when I did this, I got the following messages even though Audacity did start:

env PULSE_LATENCY_MSEC=30 audacity

ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for 4294967295, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for 4294967295, skipping unlock
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
09:19:11: Debug: Unrecognized accel key ‘backspace’, accel string ignored.
09:19:11: Debug: Unrecognized accel key ‘backspace’, accel string ignored.
09:19:11: Debug: Unrecognized accel key ‘numpad_enter’, accel string ignored.
09:19:11: Debug: Unrecognized accel key ‘numpad_enter’, accel string ignored.

** (audacity:5485): CRITICAL **: os_bar_hide: assertion ‘OS_IS_BAR (bar)’ failed

(audacity:5485): Gtk-CRITICAL **: IA__gtk_widget_hide: assertion ‘GTK_IS_WIDGET (widget)’ failed

** (audacity:5485): CRITICAL **: os_bar_set_parent: assertion ‘OS_IS_BAR (bar)’ failed

I’m not sure what this all means and perhaps it too has something to do with the freezes, so would welcome feedback. Also, I tried to modify audacity.desktop by including the Exec=env PULSE_LATENCY_MSEC=30 audacity %F, but audacity.desktop doesn’t seem to exist. There is simply audacity there in /usr/share/applications/, but all that does is open Audactiy. I do have hidden files visible.

Thank you.

Those messages are not related to the freezing problem.

The easiest, (and effective) workaround for the PulseAuio freeze bug, is to select the “hw” device that corresponds to the device that you are using (in the recording and playback options of the device toolbar)

Thanks, Steve, but not sure which device to pick. Attached is screen shot. Currently, I play through a speaker set plugged into the front desktop jack.
playbackoptions1.jpg

Most probably that is the (hw:0,0) option at the top of the list.

Note that the down side of using the “hw” settings is that with this setting, Audacity accesses the device directly through the ALSA drivers (bypassing PulseAudio). There are very few sound cards these days that directly support “multi-client” operation. That means that only one program can access the device at a time, so it is important that no other applications are using the device when you use “hw” in Audacity.