Posts
I ran into a rather funny bug recently – when recording audio on an RPi with Raspbian Jessie via an external USB sound card, arecord
doesn’t stop recording after a period of time specified by --duration
flag, but keeps running and filling files *-01.wav
, *-02.wav
, etc. with garbage data. Googling doesn’t return a solution, except an obvious one to killall -KILL arecord
. USB microphones are also affected.
Since I have another RPi running Wheezy and showing no symptoms of the bug (and being free of systemd malware ;), the bug is likely in arecord
itself. Jessie from 2016-05-27-raspbian-jessie.img
includes alsa-utils of version 1.0.28
and arecord --version
returns the same. There is a report indicating that 1.0.27
from Arch is buggy as well. Wheezy includes alsa-utils of version 1.0.25
and is free of this bug, so it was introduced in either 1.0.26
or 1.0.27
.
A temporary solution is to downgrade alsa-utils to 1.0.25
or lower as follows:
echo "deb http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi" >> /etc/apt/sources.list
sudo apt-get update
sudo aptitude versions alsa-utils
(this should indicate that the older version of alsa-utils is now available)sudo apt-get install alsa-utils=1.0.25-4
arecord
now works fine, e.g.: arecord -D plughw:1,0 -r 44100 -f cd -d 5 -vv ~/test.wav
(recording should stop after 5 seconds)/etc/apt/sources.list
(comment out the newly added line) and update the sources again: sudo apt-get update