Modular Computers the manual GitHub

aplay

aplay: play WAV files on a sound card.

Synopsis

aplay [-D device] [file…]

Description

aplay plays each WAV file on a sound card, one after another. With no file, or where a file is -, it reads standard input.

A file’s header says its format, and aplay sets the card to it: PCM (unsigned 8-bit or signed 16-bit) or IMA ADPCM, mono or stereo, at 8000, 11025, 22050 or 44100 samples a second. It writes the file’s data as it reads it (a write waits while the card’s buffer is full), then waits for what it queued to play out before the next file.

A stereo sound comes from two speakers, the block’s left and right as seen facing its front; a mono one from the block. Any other music can be converted on another computer, for example with ffmpeg:

ffmpeg -i song.mp3 -ar 22050 -ac 2 -acodec adpcm_ima_wav song.wav

A file that cannot be opened, read or played is reported on standard error, and aplay goes on with the next one.

Options

-D device
The sound card’s file (/dev/dsp, the first card’s, unless given).

Exit status

0 if every file was played; 1 if any could not be, or the card could not be opened.

Examples

aplay song.wav
aplay -D /dev/dsp1 alarm.wav

Notes

ALSA’s aplay has many more options (raw formats, recording with arecord, devices by name); mcos’s takes WAV files only. A raw file plays as it is with cat file > /dev/dsp, at OSS’s defaults: 8000 samples a second, unsigned 8-bit, mono.

See also

cat(1)