Files
linux.softwareshinobi.com/landing/docs/.recycle/.recycle2/125-the-aplay-command.md
Software Shinobi 7d9171c854
All checks were successful
learn org at code.softwareshinobi.com/linux.softwareshinobi.com/pipeline/head This commit looks good
reworking content
2025-06-19 10:03:08 -04:00

56 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# The `aplay` command
`aplay` is a command-line audio player 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 play audio on command-line interface. aplay is much the same as arecord only it plays instead of recording. For supported soundfile formats, the sampling rate, bit depth, and so forth can be automatically determined from the soundfile header.
## Syntax:
```
$ aplay [flags] [filename [filename]] ...
```
## Options:
```
-h, help : Show the help information.
-d, duration=# : Interrupt after # seconds.
-r, rate=# : Sampling rate in Hertz. The default rate is 8000 Hertz.
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.
```
Note: This command contain various other options that we normally dont need. If you want to know more about you can simply run following command on your terminal.
```
aplay --help
```
## Examples :
1. To play audio for only 10 secs at 2500hz frequency.
```
$ aplay -d 10 -r 2500hz sample.mp3
```
> Plays sample.mp3 file for only 10 secs at 2500hz frequency.
2. To play full audio clip at 2500hz frezuency.
```
$ aplay -r 2500hz sample.mp3
```
> Plays sample.mp3 file at 2500hz frezuency.
3. To Display version information.
```
$ aplay --version
```
> Displays version information. For me it shows aplay: vesrion 1.1.0
---