arecord

Record audio from ALSA sound devices

TLDR

Record in CD quality (finish with Ctrl+C)
$ arecord -vv -f cd [path/to/file.wav]
Record with a fixed duration of 10 seconds
$ arecord -vv -f cd -d 10 [path/to/file.wav]
Record and save as MP3 (via lame)
$ arecord -vv -f cd -t raw | lame -r - [path/to/file.mp3]
List all sound cards and digital audio devices
$ arecord -l
Allow interactive interface
$ arecord -i
Test microphone with a 5 second sample
$ arecord -d 5 test-mic.wav && aplay test-mic.wav && rm test-mic.wav

SYNOPSIS

arecord [-d duration] [-f format] [-r rate] [-c channels] [file]

DESCRIPTION

arecord is a command-line sound recorder for ALSA soundcard drivers. It captures audio from sound cards and saves it in various formats including WAV, AU, VOC, and raw audio. The tool supports configurable sample rates, bit depths, and channel counts. The shorthand format cd sets 16-bit signed little-endian stereo at 44100 Hz. Raw output can be piped to encoders like lame for MP3 conversion. It is the recording counterpart to aplay.

PARAMETERS

-d, --duration seconds

Stop recording after the specified number of seconds.
-f, --format format
Sample format (cd, S16LE, S16BE, U8, S32_LE, etc.).
-r, --rate rate
Sampling rate in Hz (2000-192000).
-c, --channels count
Number of channels (1 for mono, 2 for stereo).
-t, --file-type type
File type (wav, raw, au, voc).
-l, --list-devices
List all soundcards and digital audio devices.
-L, --list-pcms
List all PCMs defined.
-D, --device name
Select PCM device by name.
-M, --mmap
Use memory-mapped I/O mode for the audio stream.
-N, --nonblock
Open the audio device in non-blocking mode.
-F, --period-time microseconds
Distance between interrupts in microseconds.
-B, --buffer-time microseconds
Buffer duration in microseconds.
-V, --vumeter type
VU meter type (stereo or mono).
-i, --interactive
Allow interactive control via stdin.
-v, --verbose
Verbose mode; use -vv for more detail including VU meter.
-q, --quiet
Quiet mode; suppress messages.
--disable-resample
Disable automatic rate resample.
--disable-channels
Disable automatic channel conversions.
--disable-format
Disable automatic format conversions.

INSTALL

sudo apt install alsa-utils
sudo dnf install alsa-utils
sudo pacman -S alsa-utils
sudo apk add alsa-utils
sudo zypper install alsa-utils
nix profile install nixpkgs#alsa-utils

CAVEATS

Requires ALSA drivers to be installed and configured. The cd format is shorthand for 16-bit signed little-endian, 44100 Hz, stereo.

HISTORY

Part of ALSA (Advanced Linux Sound Architecture) utilities package, which replaced OSS as the standard Linux sound system.

SEE ALSO

aplay(1), alsamixer(1), amixer(1)