# std.audio

Blocking native synth helpers for generated audio.

```tea
use audio from "std.audio"
```

Examples may be fragments requiring the module import or additional setup.

## std.audio.envelope

```tea
pub def envelope(attack_ms: Int, decay_ms: Int, sustain_level: Float, release_ms: Int) -> Envelope
```

Create an ADSR envelope in milliseconds.

## std.audio.default_envelope

```tea
pub def default_envelope() -> Envelope
```

Return the default short musical envelope.

## std.audio.tone_with

```tea
pub def tone_with(frequency_hz: Float, duration_ms: Int, waveform: String, volume: Float, envelope_value: Envelope, vibrato_rate_hz: Float, vibrato_depth_hz: Float) -> Tone
```

Create a tone with explicit waveform, volume, envelope, and vibrato.

## std.audio.tone

```tea
pub def tone(frequency_hz: Float, duration_ms: Int) -> Tone
```

Create a sine tone with the default envelope.

## std.audio.rest

```tea
pub def rest(duration_ms: Int) -> Tone
```

Create a silent rest.

## std.audio.render_sequence

```tea
pub def render_sequence(tones: List[Tone], sample_rate: Int) -> AudioBuffer
```

Render a sequence of tones into signed 16-bit mono PCM samples.

## std.audio.play_buffer

```tea
pub def play_buffer(buffer: AudioBuffer) -> Void
```

Play a rendered audio buffer through the default native output device. Set NO_AUDIO=1 to skip native output while keeping rendering active.

## std.audio.play_sequence

```tea
pub def play_sequence(tones: List[Tone]) -> Void
```

Render and play a sequence using the default 44.1 kHz sample rate.
