I am running Audacity 2.1.2 installed via apt on a new Ubuntu 16.04 box. The project sample rate is 44.1kHz. Software playthrough is disabled. Audacity is having 2 problems with recording:
- The recorded sound is 11X to fast (i.e., it is sampling at around 4kHz) and thus very short. Eventually there are underruns too.
- Immediately after I launch Audacity (recording or not) it causes other programs to have a similar problem. For example, the browser will record with the pitch 11X too high – though it will insert skips while Audacity does not. The problem is not resolved until I reboot the computer.
The forums suggest checking the sound driver and reinstalling Audacity. I am using built-in motherboard sound. My motherboard is an ASRock X299 OC Formula and the realtek driver is installed. After reboot, before I run Audacity, sound is working. I can record and playback in a web browser and in ardour4. I can also record a sound with:
arecord -r44100 -fS16_LE /tmp/file.wav
aplay /tmp/file.wav
Repeated recording and playback work just fine (in the browser, with arecord, or ardour4) so long as I don’t start Audacity. So it appears that the driver is working for most programs. In all cases I am using the “default” device which is Line In on the motherboard.
As suggested on the forums, I tried removing the audacity config file from ~/.audacity-data and reinstalling using
apt-get remove audacity
apt-get install audacity
but alas the recording problem remains.
I do notice the following messages when I start Audacity. I don’t know if they’re relevant.
ALSA lib pcm_dsnoop.c:606:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave
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_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave
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
Also when I’m recording I can see Audacity showing up in pavucontrol (pulse audio) as
ALSA plug-in [audacity]
and actually it fails in a few seconds as Audacity prints:
1: »0⋅1/1⋅1/1⋅1/1
1: »0⋅1/1⋅1/1⋅1/1
ALSA lib pcm.c:7963:(snd_pcm_recover) underrun occurred
Occasionally there’s a more interesting one:
Expression 'err' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 3355
Expression 'ContinuePoll( self, StreamDirection_In, &pollTimeout, &pollCapture )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 3881
Expression 'PaAlsaStream_WaitForFrames( stream, &framesAvail, &xrun )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 4253
I also tried to compile the latest Audacity code (2.2.2) but this appears it will take some more effort, as I get “Audacity requires expat to be enabled.” despite expat being installed actually. In any case, it seems unlikely that Audacity 2.1.2 wouldn’t work on such a stable OS/mobo combination.
I also tried uncommenting this line in /etc/pulse/daemon.conf:
; default-sample-rate = 44100
and restarted pulseaudio as suggested on other forums, but it did not restore recording function (until reboot).
I would really like to use Audacity for recording on Linux. But I have tried many suggestions (check sound driver, reinstall audacity, remove config, change pulse config) and nothing seems to fix this problem of losing 91% of the samples.
Are there any other suggestions?