arecord creates hundreds of files

Update (Sep. 7th, 2017):
If you are using Raspbian Stretch, the pre-installed version is now v1.1.3 and this issue doesn’t occur any more!

Update (Dec. 9th, 2018):
If you are looking for steps to update ALSA on Raspbian Strech, please see this post.

 

If you find hundreds of files like below after the recording is done by arecord command, you may need to update your alsa-utils. According to here, this problem is introduced in alsa-utils 1.0.28, which is preinstalled in Raspbian Jessie, and can be fixed by either downgrading or upgrading alsa-utils version.

pi@raspberrypi:~/tmp $ ls -l
total 360
-rw-r--r-- 1 pi pi 319798 Jun 11 02:12 test-01.wav
-rw-r--r-- 1 pi pi     44 Jun 11 02:12 test-02.wav
-rw-r--r-- 1 pi pi     44 Jun 11 02:12 test-03.wav
-rw-r--r-- 1 pi pi     44 Jun 11 02:12 test-04.wav
-rw-r--r-- 1 pi pi     44 Jun 11 02:12 test-05.wav
...

 

Steps
Here are the steps to get the latest alsa-utils (1.1.4 as of 6/10/2017) from source.

1. Download and extract the source code.

wget ftp://ftp.alsa-project.org/pub/utils/alsa-utils-1.1.4.tar.bz2
tar xvjf alsa-utils-1.1.4.tar.bz2
cd alsa-utils-1.1.4/

2. Install the dependencies.

sudo apt-get install libasound2-dev libncursesw5-dev -y

3. Configure, make and install.

./configure --disable-alsaconf --disable-bat --disable-xmlto --with-curses=ncursesw
make && sudo make install

4. Check the version:

arecord --version

If everything is fine, the result should be this:

pi@raspberrypi:~/installation/alsa-utils-1.1.4 $ arecord --version
arecord: version 1.1.4 by Jaroslav Kysela <perex@perex.cz>

5. Check if the problem is fixed.

$ arecord -D hw:1,0 -d 10 -f S16_LE -r 16000 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono
$ ls -l
total 316
-rw-r--r-- 1 pi pi 320044 Jun 11 04:23 test.wav

 

Reference
– Multiple files created by arecord
http://stackoverflow.com/questions/24629915/multiple-files-created-by-arecord

 

Sponsor Link

2 Comments

  1. How do you update to 1.1.7? I am having trouble getting the “sudo apt-get install libasound2-dev libncursesw5-dev -y” command to work for some reason.

Comments are closed.