# audio/tone
Synthesize and play a tone (stereo S16 at 44.1 kHz) through the shared playback device.
## Syntax
[audio/tone ?$freq ?$dur ?$opts]
## Parameters
- `freq` — frequency in Hz (optional, default 880; values ≤0.1 fall back to 440)
- `dur` — duration in seconds, must be in (0, 60] (optional, default 0.1)
- `:wave` — `:sine` (default), `:square`, `:triangle`, `:saw`, `:noise` (unknown names fall back to `:sine`)
- `:volume` — gain, clamped to 0.0–4.0 (optional, default 1.0)
- `:attack` / `:release` — envelope seconds, clamped to `dur` (optional, defaults 0.005 / 0.02)
## Examples
set v [audio/tone 880 0.1 %{ :wave :square :volume 0.4 }] [audio/tone 220 1.5 %{ :wave :saw :attack 0.1 :release 0.5 }]
## Returns
Voice id (number). `%Err{:message}` when no SDL host is compiled in, `dur` is outside (0, 60], the device is unavailable, or synthesis/voice start fails.
## See Also
`audio/beep`, `audio/play`, `audio/stop`