# audio/play Play a WAV sound effect on the shared SDL audio device. Files are decoded once and cached by path; concurrent voices are mixed by SDL. ## Syntax
[audio/play $path ?volume ?loops]
[audio/play %{ :path "sfx.wav" :volume 1.0 :loops 0 }]
## Parameters - `$path` — WAV file path (string), or a map carrying `:path` - `$volume` — gain, clamped to 0.0–4.0 (optional, default 1.0) - `$loops` — `0` one-shot, `-1` forever, `n` = n extra replays after the current pass (optional, default 0) ## Examples
set v [audio/play "sfx/wing.wav" 0.8]                     # one-shot at 80%
set m [audio/play %{ :path "music/loop.wav" :loops -1 }]  # seamless loop
[audio/stop $m]
## Returns Voice id (number). `%Err{:message}` when no SDL host is compiled in, the path is missing/not a loadable WAV, the device cannot open, or the voice cannot start. Drained one-shot voices are reaped after ~120 ms (`audio/quit` clears the path cache). ## See Also `audio/tone`, `audio/beep`, `audio/stop`, `audio/volume`