rec
Record audio from sound input devices
TLDR
Record audio to a file from the default input
SYNOPSIS
rec [options] outfile [effects...]
DESCRIPTION
rec is the recording component of SoX (Sound eXchange), the Swiss Army knife of audio processing. It records audio from the default input device (microphone, line-in) to a file in various formats.
The output format is typically determined by the file extension. SoX supports dozens of formats including WAV, MP3, FLAC, OGG, AIFF, and raw audio. Format-specific encoding options can be specified for compressed formats.
SoX effects can be applied during recording, including silence detection to automatically stop recording, trimming to limit duration, and gain adjustments. Effects are specified after the output filename.
rec is equivalent to sox -d (using the default input device) with appropriate defaults for recording.
PARAMETERS
-r rate
Set sample rate in Hz (e.g., 44100, 48000)-c channels
Set number of channels (1=mono, 2=stereo)-b bits
Set sample size in bits (8, 16, 24, 32)-t type
Specify file type (wav, mp3, flac, ogg, etc.)-d device
Specify audio device-q
Quiet mode; suppress progress output-V
Verbose mode; show detailed progresstrim start duration
Record from start position for specified durationsilence
Stop recording based on silence detectionfade type in stop out
Apply fade effects
CAVEATS
MP3 encoding requires SoX to be compiled with MP3 support (libmp3lame). Some distributions package this separately due to licensing.
The default audio device depends on system configuration. Use -d to specify a particular device if the default is not the desired input.
Recording requires appropriate permissions for audio device access. Users may need to be in the audio group on some systems.
Use Ctrl+C to stop recording manually if no duration or silence detection is specified.
