Record audio from the default microphone or a specified input device to a file on Linux. Use this skill whenever the user wants to capture audio, record a voice memo, sample ambient sound, or record microphone input.
Capture audio from a microphone or any ALSA input device and save it to a file.
WAV, MP3, OGG, FLAC, M4A — any format supported by ffmpeg.
ffmpeg -f alsa -i default -t 10 output.wav
ffmpeg -f alsa -i default output.wav
ffmpeg -f alsa -i default -acodec libmp3lame -ab 192k output.mp3
ffmpeg -f alsa -i default output.flac
# Record for 10 seconds at CD quality (44100 Hz, stereo, 16-bit)
arecord -d 10 -f cd output.wav
# Record until Ctrl-C
arecord -f cd output.wav
# ALSA devices
arecord -l
# PulseAudio sources
pactl list short sources
# Replace hw:1,0 with the device shown by arecord -l
ffmpeg -f alsa -i hw:1,0 -t 10 output.wav
| Quality | Sample Rate | Channels | Flag |
|---|---|---|---|
| Voice | 16000 Hz | Mono | -ar 16000 -ac 1 |
| CD | 44100 Hz | Stereo | -ar 44100 -ac 2 |
| Studio | 48000 Hz | Stereo | -ar 48000 -ac 2 |
# Voice quality (small file, good for speech recognition)
ffmpeg -f alsa -i default -ar 16000 -ac 1 voice.wav
amixer sset Capture unmutearecord -l before recording.