Audacity 2.0.5 on Ubuntu 14.04 w/KDE crashing

I’m running Ubuntu 14.04 with the KDE Plasma desktop. Other applications are playing sound without a problem. I’m not running a version I compiled myself. ALSA

When I play a sound file, the sound stutters so rapidly it almost sounds static-y. This happens whether it’s a .wav file I’ve opened, or it’s 30 seconds of pink noise I generated. When I hit the STOP button, Audacity’s GUI stops reacting to clicks. Then it will usually ask if it should terminate.

Any ideas?

Log out of your computer, then back in again, then, without opening any other programs (not even your web browser), launch Audacity.
In the device toolbar, set the recording input and playback output devices to the “hw 0,0” option. Then try playing something. What happens?

I followed your instructions, and wow! You nailed it on the first try! :smiley: Thank you thank you!!

For the record,in between the time I posted this and the time you responded, I found detailed instructions on how to compile my own copy of Audacity with local ffmpeg support, which I did. It didn’t fix it. But anyone else reading this thread should know that your solution worked, but I did make a change to my initial config that I posted above BEFORE I tried your solution.

Thanks again

I guess I’d better give you the bad news :frowning:
(not that bad really :smiley:)

The default options that are set in Audacity are to use the system default sound settings, which these days generally means PulseAudio. That’s great, if it works. PulseAudio allows multiple programs to share an audio device. It provides resampling when necessary so that programs don’t need to be configured to match the same sample rate, and provides the ability to route the audio in various ways, even between different computers on the same network. The problem is that as Audacity is a lot more demanding than most other audio applications because it is designed to be able to work with multiple tracks, multiple sample rates, play and record at the same time, and so on, so getting Audacity and PulseAudio to play together nicely can sometimes be tricky.

By selecting the “hw:0” options. you are telling Audacity to bypass PulseAudio and access the audio device directly via ALSA.
The plus side is that it provides a more direct and more efficient route between Audacity and the sound card.
The down side is that you lose the flexibility that PulseAudio provides - specifically that other programs must not be accessing the sound card while Audacity is running.

Okay, I appreciate that. But now I’m in a position where maybe I can troubleshoot my way back out to where it works properly with PulseAudio. I had to get to a “known-good” state first. If I have any great breakthroughs I’ll try to post them here on this thread for others.

I’ve had the same problem, all sounds loaded into Audacity from wavs or ogg look correct but play as white noise. It would appear that Audacity is playing the 16 bit sound as 8 bit. I have experienced a similar problem with Kaffeine during the upgrade to 14.04, where it won’t play HD audio. The sound curruption is exactly similar.

However, thanks for a temporary “fix”, I can’t reboot my PC as it is doing other stuff.

I have been searching for this for weeks, since the day 14.04 came out.

The fact is that pulseaudio setting worked perfectly up to 14.04 and therefore it must be an added bug that made Audacity go wrong. It is only a temporary fix, I would like to play other sounds at the same time in other aplications again, like I used to do on 13.10, 13.04, 12.10, 12.04 etc etc. It is not related to any strain on the system, it doesn’t work even if nothing else is running, or if the system is stressed.

I’m useing an m-audio sound card. I have started useing the daily Audacity builds, these do not fix the problem. I (did) use Audacity very regularly, and am willing to help test any potential fix, or other configuration that might solve the problem.

If you think it might be a bug with pulse audio that has caused these problems? I am also willing to report it there.

A solution that is said to work apart from using the (hw) devices is to open a terminal and launch Audacity by typing:

env PULSE_LATENCY_MSEC=30 audacity

then hit ENTER on your keyboard. Try the same with Kaffeine.

The bug is already reported on Ubuntu (in 13.10 too): https://bugs.launchpad.net/ubuntu/+source/audacity/+bug/1246092 .


Gale

Cheers for that Gale,

I thought I tried that solution before and it didn’t work. It may have been the starting from a terminal that put me off trying it.

I’ve added - env PULSE_LATENCY_MSEC=30 audacity - to the KDE launcher and it now works to play audio again.

Couple of arising questionsthat might help other users, Could setting the pulse latency effect recording? or have any other knock on effects? Is the variable set, once it is run once, so it could be set in a start-up script?

Perhaps. Do you see underrun messages in Terminal if you set that environment variable? Note that you can use values other than 30, and you can also change Audio to Buffer in the Audacity Recording Preferences (which affects playback and recording in Audacity).

What I don’t understand is why no-one suggests setting PULSE_LATENCY_MSEC globally for pulse. Can it be done, or are only specific apps like Skype, Audacity and Kaffeine affected?

I believe it is set for the Audacity session only.


Gale

I didn’t see any underun messages, just playing the wav files from my m-audio recorder.

It’s not really a stress test.

Do you know what is an optimum value, zero? ie the lowest latency possible I assume.

If this is due to an incorrect default in the 14.04 pulse audio settings. Do we know what the default is, or where that is stored?

Also, I could reduce the latency untill I get an error? If that would help show someone where the error is occuring and fix it.

The “optimum” could very likely vary from audio application to audio application (depending also on any buffering or resampling settings in the application). I think you will have to experiment.

I did glance at the latest v5 pulseaudio source code (3 March 2014) and the only references I see are in module-rtp-recv.c:

#define DEFAULT_LATENCY_MSEC 500

and in module-loopback.c

#define DEFAULT_LATENCY_MSEC 200

In version 4 of the code a year before, #define DEFAULT_LATENCY_MSEC was only in module-loopback.c and also set to 200. I don’t know the exact significance of these changes or if this setting is different to PULSE_LATENCY_MSEC which does not seem to have a specified value.

I don’t know where you would specify a global default PULSE_LATENCY_MSEC other than in the pulseaudio source code, but to ask if there is a way to do so in a global configuration file you could ask on the PulseAudio mailing list . Please let us know if you ask and get any answer.

As I indicated, I think optimum latencies will vary from application to application (and sound device to sound device). Audacity could probably set the PULSE_LATENCY_MSEC in its desktop file but it would not help command-line users and we’d need to know more about the reasons for the problem seemingly becoming worse.


Gale

Zero is a problem on my machine, sometimes causing Audacity to crash.

“1” works OK here for playing projects that contain only one track, but for multi-track projects Audacity may freeze on starting playback.
“30” works well here (no freeze or crash) for single track or multi-track projects when using playback only.
I need to set it higher when recording in multi-track projects.