audio
NAME
audio — text-to-speech, audio playback, and notifications in SLICC
DESCRIPTION
SLICC can speak text, play audio files, and trigger notification sounds — all via the Web Audio API and Web Speech API running in the browser. Three commands expose these capabilities: say for speech synthesis, afplay for audio file playback, and chime for notification sounds.
SAY
Synopsis
say [-v voice] [-r rate] [-l lang] [--list] <text>
Description
Speaks the given text aloud using the Web Speech API. A language tag is always required. Voice selection supports partial name matching against the browser's available voices.
Options
-
-vvoiceVoice name. Partial, case-insensitive matching is supported (e.g.
-v samanthamatches "Samantha"). Use--listto see available voices. -
-rrateSpeech rate, from 0.1 to 10. Default is 1.
-
-llangBCP 47 language tag (required). Examples:
en-US,de-DE,fr-FR,ja-JP. -
--listList all available voices and exit. Output format:
Name (lang) [default].
Examples
say -l en-US "Hello, world"
say -v samantha -l en-US -r 1.2 "Welcome to SLICC"
say --list
AFPLAY
Synopsis
afplay [-v volume] [-r rate] <file>
Description
Plays an audio file using the Web Audio API. The file is read from the virtual filesystem, decoded, and played through the browser's audio output. Only one file can be specified per invocation; the command returns when playback finishes.
Options
-
-vvolumeVolume level, from 0 (silent) to 1 (full). Default is 1.
-
-rratePlayback rate, from 0.25 to 4. Default is 1. Values below 1 slow playback down; values above 1 speed it up.
Supported Formats
Any format the browser's Web Audio API can decode: MP3, WAV, OGG, AAC, FLAC, and WebM audio. Exact support varies by browser.
Examples
afplay /shared/sounds/alert.mp3
afplay -v 0.5 /shared/sounds/intro.wav
afplay -r 2 /shared/sounds/chime.mp3
CHIME
Synopsis
chime
Description
Plays the built-in notification chime sound at full volume. This is a convenience alias for:
afplay /shared/sounds/chime.mp3
Takes no arguments. Useful for signaling task completion or drawing attention.
Examples
long-running-task && chime
NOTES
Audio playback in the browser is subject to the user gesture policy. The AudioContext starts in a suspended state and is only unlocked after the user's first interaction with the page (click, keypress, etc.). Once unlocked, all audio commands work freely for the lifetime of the tab.
The browser tab must be active and not discarded for audio to play. Background tabs may have audio throttled or suspended by the browser.
If the Web Speech API or Web Audio API is unavailable in the current environment, the commands will exit with an error message.
SEE ALSO
open, screencapture