arecord is a command-line sound recorder for ALSA(Advanced Linux Sound Architecture) sound card drivers. It supports several file formats and multiple soundcards with multiple devices. It is basically used to record audio using the command-line interface.
arecord [flags] [filename]
If the filename is not specified then it uses Standard input.
- -h, –help : It is used to show the help messages and exit.
- –version : Print current version.
- -l, –list-devices : List all soundcards and digital audio devices.
- -L, –list-pcms : List all PCMs(Pulse Code Modulation) defined.
- -D, –device=NAME : Select PCM by name.
- -q –quiet : Quiet mode. Suppress messages (not sound :).
- -t, –file-type TYPE File type (voc, wav, raw or au). If this parameter is omitted the WAVE format is used.
- -c, –channels=# : The number of channels. The default is one channel. Valid values are 1 through 32.
- -f –format=FORMAT : If no format is given U8 is used.
- -r, –rate=# : Sampling rate in Hertz. The default rate is 8000 Hertz.
- -d, –duration=# : Interrupt after # seconds.
- -s, –sleep-min=# : Min ticks to sleep. The default is not to sleep.
- -M, –mmap : Use memory-mapped (mmap) I/O mode for the audio stream. If this option is not set, the read/write I/O mode will be used.
- -N, –nonblock : Open the audio device in non-blocking mode. If the device is busy the program will exit immediately.
Note: It contains various other options that we normally don’t need. If you want to know more about you can simply run following command on the terminal.
Recognized Sample Formats are: S8 U8 S16_LE S16_BE U16_LE U16_BE S24_LE S24_BE U24_LE U24_BE S32_LE S32_BE U32_LE U32_BE FLOAT_LE FLOAT_BE FLOAT64_LE FLOAT64_BE IEC958_SUBFRAME_LE IEC958_SUBFRAME_BE MU_LAW A_LAW IMA_ADPCM MPEG GSM SPECIAL S24_3LE S24_3BE U24_3LE U24_3BE S20_3LE S20_3BE U20_3LE U20_3BE S18_3LE S18_3BE U18_3LE U18_3BE G723_24 G723_24_1B G723_40 G723_40_1B DSD_U8 DSD_U16_LE DSD_U32_LE DSD_U16_BE DSD_U32_BE
Note: Some of these may not be available on selected hardware.
- Recording audio through arecord (It will record an audio of 5 secs of U8 formet and mp3 type named sample.mp3):
- Now we will demonstrate how it really sounds like to record.
- Now we will play that recorded audio using aplay command.(microphone input is off.)
- ps command in Linux with Examples
- which command in Linux with examples
- more command in Linux with Examples
- yes command in Linux with Examples
- gs command in Linux with Examples
- ZIP command in Linux with examples
- rcp Command in Linux with examples
- env command in Linux with Examples
- apt-get command in Linux with Examples
- until command in Linux with Examples
- cc command in Linux with Examples
- less command in Linux with Examples
- bg command in Linux with Examples
- fc Command in Linux with Examples
- cmp Command in Linux with examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.