← 返回命令列表

Linux command

arecord 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Example

arecord -vv -f cd [path/to/file.wav]

Example

arecord -vv -f cd -d 10 [path/to/file.wav]

Example

arecord -vv -f cd -t raw | lame -r - [path/to/file.mp3]

List

arecord -l

Example

arecord -i

Test microphone

arecord -d 5 test-mic.wav && aplay test-mic.wav && rm test-mic.wav

说明

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.

参数

-d, --duration _seconds_
Stop recording after the specified number of seconds.
-f, --format _format_
Sample format (cd, S16_LE, S16_BE, 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.

FAQ

What is the arecord command used for?

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.

How do I run a basic arecord example?

Run `arecord -vv -f cd [path/to/file.wav]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -d, --duration _seconds_ do in arecord?

Stop recording after the specified number of seconds.