APLAY(1)
okay bestie, this is the General Commands Manual page for APLAY(1) ๐ two sound tools, one vibe, let's go ๐
โจ NAME โจ
arecord, aplay: command-line sound recorder and player for the ALSA soundcard driver ๐ง
โจ SYNOPSIS โจ
arecord [flags] [filename]
aplay [flags] [filename [filename]] ...
โจ DESCRIPTION โจ
okay so arecord is a command-line soundfile recorder for the ALSA soundcard driver ๐๏ธ it's giving versatility bc it supports several file formats AND multiple soundcards with multiple devices ๐ also if you're recording with interleaved mode samples, the file gets automatically split before the 2GB filesize so you don't lose your bag ๐ซถ
aplay is basically the same energy, just on the playing side instead of recording ๐ for supported soundfile formats, the sampling rate, bit depth, and so forth can be automatically figured out from the soundfile header, so it does the homework for you ๐ง
if you don't specify a filename, the standard output or input gets used instead ๐ธ and aplay accepts multiple filenames, so you can queue up the whole playlist ๐
โจ OPTIONS โจ
-h,--helpโ need a refresher? shows the syntax ๐--versionโ prints the current version ๐ข-l,--list-devicesโ lists all soundcards and digital audio devices ๐๏ธ-L,--list-pcmsโ lists all the PCMs that are defined ๐งพ-D,--device=NAMEโ selects a PCM by name ๐ฏ-q,--quietโ quiet mode! it suppresses messages (not sound :)) ๐คซ-t,--file-type TYPEโ picks the file type: voc, wav, raw or au ๐ if you leave this out, WAVE format is used ๐-c,--channels=#โ the number of channels ๐๏ธ default is one channel, and the valid values are 1 through 32 ๐-f,--format=FORMATโ the sample format ๐ถ these are the recognized ones:
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
heads up: some of these might not be available on your hardware, so don't be shocked if one ghosts you ๐
the format shortcuts are also a whole mood โจ
-f cd (16 bit little endian, 44100, stereo) [-f S16_LE -c2 -r44100]
-f cdr (16 bit big endian, 44100, stereo) [-f S16_BE -c2 -r44100]
-f dat (16 bit little endian, 48000, stereo) [-f S16_LE -c2 -r48000]
and if you don't give a format at all, U8 is used ๐ซ
-r,--rate=#<Hz>โ the sampling rate in Hertz ๐ผ default is 8000 Hertz. if the value you pass is less than 300, it gets read as kilohertz instead. valid values are 2000 through 192000 Hertz ๐-d,--duration=#โ interrupts after # seconds โฑ๏ธ a value of zero means infinity. the default is zero, so if you skip this option, the record/playback keeps going until it gets killed ๐ also'-d'and'-s'are exclusive, so you can only pick one bestie ๐-s,--samples=#โ interrupts after # PCM frames are transmitted ๐๏ธ zero means infinity, and the default is zero too, so without this option it runs until it's killed ๐ and again,'-d'and'-s'can't be used together ๐-M,--mmapโ uses memory-mapped (mmap) I/O mode for the audio stream ๐ง if this isn't set, read/write I/O mode is used instead ๐-N,--nonblockโ opens the audio device in non-blocking mode ๐ช if the device is busy, the program exits immediately ๐ค if you don't set this, the program blocks until the audio device is free again ๐ฐ๏ธ-F,--period-time=#โ the distance between interrupts is # microseconds ๐ต if you give no period time and no period size, a quarter of the buffer time gets set ๐ฐ-B,--buffer-time=#โ buffer duration is # microseconds ๐ซง if you give no buffer time and no buffer size, the maximal allowed buffer time gets set, but never more than 500ms ๐ง--period-size=#โ the distance between interrupts is # frames ๐๏ธ if you give no period size and no period time, a quarter of the buffer size gets set ๐ฐ--buffer-size=#โ buffer duration is # frames ๐ซง if you give no buffer time and no buffer size, the maximal allowed buffer time gets set, but not more than 500ms ๐ง-A,--avail-min=#โ the min available space for wakeup is # microseconds ๐-R,--start-delay=#โ the delay for automatic PCM start is # microseconds โถ๏ธ this is relative to buffer size if the value is <= 0 ๐-T,--stop-delay=#โ the delay for automatic PCM stop is # microseconds from xrun โน๏ธ-v,--verboseโ shows the PCM structure and setup ๐ this one is accumulative, and the VU meter shows up when you give it twice or three times ๐-V,--vumeter=TYPEโ picks the VU-meter type, either stereo or mono ๐๏ธ the stereo VU-meter is only available for 2-channel stereo samples with interleaved format ๐ฏ-I,--separate-channelsโ one file for each channel ๐๏ธ this option disables max-file-time and use-strftime, and it ignores SIGUSR1 ๐ the stereo VU meter isn't available with separate channels either ๐-Pโ playback! this is the default if you invoke the program by typingaplayโถ๏ธ-Cโ record! this is the default if you invoke the program by typingarecordโบ๏ธ-i,--interactiveโ allows interactive operation via stdin ๐ฎ right now, only pause/resume via the space or enter key is implemented โฏ๏ธ-m,--chmap=ch1,ch2,...โ gives the channel map to override or follow ๐บ๏ธ pass channel position strings likeFL,FR, etc.- if a device supports overriding the channel map,
aplaytries to pass the channel map you gave it ๐ฏ - if it doesn't support the override but still provides channel map info,
aplaytries to rearrange the channel order in the buffer so it matches the channel map the device returned ๐
- if a device supports overriding the channel map,
--disable-resampleโ disables automatic rate resample ๐ซ--disable-channelsโ disables automatic channel conversions ๐ซ--disable-formatโ disables automatic format conversions ๐ซ--disable-softvolโ disables software volume control (softvol) ๐--test-positionโ tests the ring buffer position ๐งช--test-coef=<coef>โ the test coefficient for ring buffer position ๐งฎ default is 8. the expression for validation is:coef * (buffer_size / 2), and the minimum value is 1 ๐--test-nowaitโ doesn't wait for the ring buffer, which means it eats the whole CPU ๐ฅ use with caution, bestie ๐--max-file-timeโ while recording, once the output file has been collecting sound for this long, it closes and a new output file opens ๐ the default is the max size the file format supports, which is 2 GiB for WAV files ๐พ this option has no effect if--separate-channelsis specified ๐--process-id-file <file name>โaplaywrites its process ID here so other programs can send it signals ๐จ--use-strftimeโ when recording, the %-codes in the file name parameter get interpreted with the strftime facility every time the output file is opened ๐๏ธ the important ones are:%Yis the year,%mis the month,%dis the day of the month,%His the hour,%Mis the minute and%Sis the second โฐ also%vis the file number, starting at 1 ๐ข when this option is on, intermediate directories for the output file get created automatically ๐ and it has no effect if--separate-channelsis specified ๐--dump-hw-paramsโ dumps the hw_params of the device's preconfigured status to stderr ๐จ๏ธ the dump lists the device's capabilities, like supported formats, sampling rates, numbers of channels, and period and buffer bytes/sizes/times ๐ for the raw devicehw:X, this option basically lists the hardware capabilities of the soundcard ๐ฌ--fatal-errorsโ disables recovery attempts when errors (e.g. xrun) happen ๐ฅ instead, theaplayprocess aborts immediately ๐
โจ SIGNALS โจ
when recording, SIGINT, SIGTERM and SIGABRT will close the output file and exit ๐ SIGUSR1 closes the output file, opens a new one, and keeps recording ๐ but heads up: SIGUSR1 does not work with --separate-channels ๐
โจ EXAMPLES โจ
aplay -c 1 -t raw -r 22050 -f mu_law foobar
this will play the raw file "foobar" as a 22050-Hz, mono, 8-bit, Mu-Law .au file ๐ถ
arecord -d 10 -f cd -t wav -D copy foobar.wav
this will record foobar.wav as a 10-second, CD-quality wave file, using the PCM "copy" (which might be defined in the user's .asoundrc file as:
pcm.copy {
type plug
slave {
pcm hw
}
route_policy copy
}
arecord -t wav --max-file-time 30 mon.wav
this records from the default audio source in monaural, 8,000 samples per second, 8 bits per sample ๐๏ธ a new file starts every 30 seconds ๐ง the file names are mon-nn.wav, where nn increases from 01, so the file after mon-99.wav is mon-100.wav ๐ข
arecord -f cd -t wav --max-file-time 3600 --use-strftime %Y/%m/%d/listen-%H-%M-%v.wav
this records in stereo from the default audio source ๐ง it creates a new file every hour ๐ the files are placed in directories based on their start dates, and they have names that include their start times and file numbers ๐๏ธโจ
โจ SEE ALSO โจ
alsamixer(1), amixer(1) ๐๏ธ
โจ BUGS โจ
bug alert ๐จ .aiff files are not currently supported ๐ญ
โจ AUTHOR โจ
arecord and aplay are by Jaroslav Kysela <perex@perex.cz> ๐ this document is by Paul Winkler <zarmzarm@erols.com>. Updated for Alsa 0.9 by James Tappin <james@xena.uklinux.net> ๐ซถ
that's the whole tea, bestie ๐ APLAY(1) from the General Commands Manual, dated 1 January 2010. stay iconic ๐๐ฆ
๐ฆ where this page comes from
- alpine 3.22: alsa-utils-doc 1.2.14-r0 ยท GPL-2.0-or-later
- alpine 3.23: alsa-utils-doc 1.2.14-r4 ยท GPL-2.0-or-later
- alpine 3.24: alsa-utils-doc 1.2.15.2-r1 ยท GPL-2.0-or-later
- arch rolling: alsa-utils 1.2.16-1 ยท GPL-2.0-or-later
- centos-stream 10: alsa-utils 1.2.16-1.el10 ยท GPL-2.0-or-later
- centos-stream 9: alsa-utils 1.2.16-1.el9 ยท GPLv2+
- debian trixie: alsa-utils 1.2.14-1 ยท GPL-2.0-only
- fedora 43: alsa-utils 1.2.14-2.fc43 ยท GPL-2.0-or-later
- fedora 43: alsa-utils 1.2.16-1.fc43 ยท GPL-2.0-or-later
- fedora 44: alsa-utils 1.2.15.2-3.fc44 ยท GPL-2.0-or-later
- fedora 44: alsa-utils 1.2.16-1.fc44 ยท GPL-2.0-or-later
- nixos 26.05: alsa-utils 1.2.14
- nixpkgs unstable: alsa-utils 1.2.16
- opensuse-leap 16.0: alsa-utils 1.2.14-160000.2.2 ยท GPL-2.0-or-later
- opensuse-leap 16.0: alsa-utils 1.2.14-160000.2.2 ยท GPL-2.0-or-later
- opensuse-leap 16.0: alsa-utils 1.2.14-160000.2.2 ยท GPL-2.0-or-later
- opensuse-leap 16.0: alsa-utils 1.2.14-160000.2.2 ยท GPL-2.0-or-later
- ubuntu questing: alsa-utils 1.2.14-1ubuntu1
- ubuntu resolute: alsa-utils 1.2.15.2-1ubuntu1 ยท GPL-2.0-only
- ubuntu stonking: alsa-utils 1.2.15.2-1ubuntu2 ยท GPL-2.0-only
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms