rec
Record audio from the command line
SYNOPSIS
rec [ options ] filename [ options ] ... [effect [ effect-options ]]...
PARAMETERS
filename
The name of the output audio file. Supported formats depend on SoX and system support.
-h | --help
Display help text and exit.
-V[
Set verbosity level (0-9). Higher levels produce more output.
-d | --default-device
Use the system's default audio input device.
-t | --type
Specify the file type of the output audio file (e.g., wav, mp3, flac).
-r | --rate
Set the sample rate of the audio (e.g., 44100, 48000).
-c | --channels
Number of audio channels (e.g., 1 for mono, 2 for stereo).
-b | --bits
Number of bits per sample (e.g., 8, 16, 24, 32).
-e | --encoding
Specify the audio encoding (e.g., signed-integer, unsigned-integer, float, alaw, mulaw).
effect [ effect-options ]
Applies audio effects during recording such as 'reverse' or 'fade'.
DESCRIPTION
The `rec` command is a powerful command-line audio recorder. Part of the SoX (Sound eXchange) suite, `rec` allows users to capture audio from various sources, including microphones, audio files, and streams. It supports a wide range of audio formats and encoding options, providing flexibility for diverse recording needs.
`rec` can perform basic audio processing during recording, such as applying effects or adjusting volume levels. It is commonly used for creating audio recordings, capturing spoken words, creating digital samples from analog audio, converting audio to different formats or sampling rates, and testing audio settings. The command offers detailed control over the recording process, including sample rate, channels, and audio format, and advanced option to apply filters, and compression.
Because `rec` is a command line tool it is well suited to be scripted, enabling automation of audio recording and processing tasks. The `rec` command is an essential tool for audio professionals, developers, and anyone needing precise control over audio recording and manipulation.
CAVEATS
Requires the SoX package to be installed. The specific audio formats and devices supported depend on your system's configuration and installed libraries. Improper configuration of sample rate, channels, or encoding can lead to unusable or corrupted audio files.
SIGNAL CLIPPING
Pay attention to input levels to avoid signal clipping. Clipping occurs when the audio signal exceeds the maximum level that can be represented, resulting in distortion. Monitor the input level and adjust the gain accordingly.
DEVICE SELECTION
If you have multiple audio input devices, you may need to specify the correct device using the `-d` option or environment variables. Use `sox -h | grep DEVICE` to see a list of audio devices that can be used with the `rec` command.
STOPPING THE RECORDING
To stop the recording, press Ctrl+C. This sends an interrupt signal to the `rec` process, causing it to terminate gracefully and save the audio file.
HISTORY
The `rec` command is part of the SoX (Sound eXchange) suite, which has been developed since the early 1990s. SoX was originally created by Chris Bagwell and has been maintained and expanded by a community of developers. The main goal of SoX and thus of `rec` is to provide a versatile and portable tool for audio conversion and manipulation on various operating systems. `rec` has evolved over time to support a wider range of audio formats, devices, and effects, making it an essential tool for audio engineers and developers.