Play an audio file through the Web Audio API.

Synopsis

afplay [-v volume] [-r rate] <file>

Description

Plays an audio file from the virtual filesystem using the browser's Web Audio API. Used internally by chime, and useful standalone for playing sound effects or notifications.

Options

-v volume Volume level, 0 to 1 (default 1).

-r rate Playback rate, 0.25 to 4 (default 1).

Examples

$ afplay /shared/sounds/chime.mp3

Play a sound file at normal volume.

$ afplay -v 0.5 -r 1.5 notify.wav

Play at half volume and 1.5x speed.

Notes

Requires a file readable from the VFS. Playback happens in the browser tab; there is no system audio device to select. See chime for a ready-made notification sound.

See Also

chime, say