arecord
Record audio from a soundcard
TLDR
Record a snippet in "CD" quality (finish with
Record a snippet in "CD" quality, with a fixed duration of 10 seconds
Record a snippet and save it as an MP3 (finish with
List all sound cards and digital audio devices
Allow interactive interface (e.g. use
Test your microphone by recording a 5 second sample and playing it back
SYNOPSIS
arecord [-hV] [--help] [-D | --device=NAME] [-q | --quiet] [-v] [--verbose] [-i | --interactive] [-d # | --duration=#] [-c # | --channels=#] [-r # | --rate=#] [-f FORMAT | --format=FORMAT] [-t TYPE | --file-type=TYPE] [-L | --list-pcms] [-l] [FILE]
PARAMETERS
-D, --device=NAME
Specify recording device (e.g., hw:0)
-d #, --duration=#
Record for specified seconds
-c #, --channels=#
Channels (e.g., 1 for mono, 2 for stereo)
-r #, --rate=#
Sample rate in Hz (e.g., 48000)
-f FORMAT, --format=FORMAT
Sample format (e.g., cd, S16_LE)
-t TYPE, --file-type=TYPE
File type (raw, wav, voc, aiff, au)
-i, --interactive
Show VU meter during recording
-v, --verbose
Verbose output with stats
-q, --quiet
Quiet mode, no messages
-L, --list-pcms
List available PCM devices
-l
List card and device numbers
-V
Print version
-h, --help
Show help
DESCRIPTION
arecord is a command-line utility from the ALSA (Advanced Linux Sound Architecture) toolkit used to capture audio from sound cards and other ALSA-supported devices. It writes raw or encoded audio data to standard output or a specified file, supporting various formats, sample rates, and channel configurations. Ideal for scripting, testing audio hardware, or simple recordings, it interacts directly with ALSA PCM (Pulse Code Modulation) devices.
Users specify input devices via hardware identifiers like hw:0,0 for the first card's first subdevice. Options allow fine-tuning parameters such as duration, format (e.g., S16_LE for 16-bit signed little-endian), rate (e.g., 44100 Hz), and channels (mono or stereo). Interactive mode displays a VU meter for monitoring levels, while verbose output provides detailed recording stats.
Common use cases include recording microphone input, line-in signals, or system audio loops. Output files can be WAV, raw PCM, or voc formats, making it compatible with tools like sox or audacity for post-processing. It does not handle playback; pair with aplay for that. Note that modern desktops may route audio through PulseAudio or PipeWire, requiring ALSA compatibility layers.
CAVEATS
Requires audio group membership or root for /dev/snd/* access.
May conflict with PulseAudio/PipeWire; use pulse or pipewire plugins.
Raw output lacks headers; specify WAV for compatibility.
High rates/channels may exceed hardware limits.
EXAMPLES
arecord -D hw:0,0 -f cd -r 44100 -c 2 test.wav — Record stereo CD-quality to WAV.
arecord -d 10 -f dat output.raw — 10-second raw DAT format recording.
arecord -L — List PCMs; arecord -l — List cards/devices.
FORMATS
Common: cd (S16_LE,48kHz,2ch), dat (S16_LE,48kHz,2ch), cdr (S16_LE,44.1kHz,2ch). See man arecord for full list.
HISTORY
Developed as part of alsa-utils in early 2000s alongside ALSA kernel drivers (circa 1998-2004). Maintained by ALSA project; current versions in Linux distros support modern hardware via alsa-lib.


