aplay is a command-line utility for playing audio files on a Linux system. It is part of the ALSA (Advanced Linux Sound Architecture) utility suite, which provides audio support for Linux systems. aplay can be used to play a variety of audio file formats, including WAV, AIFF, AU, and MP3.
To use aplay, you will need to specify the name of the audio file you want to play as an argument. For example:
# aplay mysong.wav
You can also specify options to control the way aplay plays the audio file. For example, you can use the -D option to specify the name of the audio device to use, or the -c option to specify the number of channels in the audio file.
Here is an example of how to use aplay with some options:
# aplay -D hw:0,0 -c 2 mysong.wav
This will play the audio file mysong.wav using the audio device hw:0,0 and with 2 channels. You can use the man command to view the manual page for aplay and see a full list of options that are available.
# man aplay
aplay Command Examples
1. Play a specific file (sampling rate, bit depth, etc. will be automatically determined for the file format):
# aplay {{path/to/file}}
2. Play the first 10 seconds of a specific file at 2500 Hz:
# aplay --duration={{10}} --rate={{2500}} {{path/to/file}}
3. Play the raw file as a 22050 Hz, mono, 8-bit, Mu-Law .au file:
# aplay --channels={{1}} --file-type {{raw}} --rate={{22050}} --format={{mu_law}} {{path/to/file}}