Skip to main content

Module audio

Module audio 

Source
Expand description

The audio plane of a scene. Audio model: clips, tracks, and the leaf mixer.

Audio never enters the per-frame evaluation pipeline. Tracks are declared next to visual animations and share the same absolute scene seconds, but their content is baked once at seal time — RanimScene::seal walks the tree and mixes leaf by leaf into one interleaved stereo buffer — instead of per-frame pulls. Consumers (video muxing, preview playback) read the baked buffer; the visual evaluation stack is untouched.

Structs§

AudioClip
Decoded audio: interleaved f32 PCM samples.
AudioError
An error produced while decoding an AudioClip from a file.
AudioTrack
A sound’s content data: the clip plus how to play it.

Constants§

MASTER_CHANNELS
Master channel count; mixed buffers are interleaved stereo.
MASTER_SAMPLE_RATE
Master sample rate every mixed buffer lives on.

Functions§

decode 🔒 audio-decode
Decode interleaved f32 PCM from encoded audio bytes.
resample_to_master 🔒 audio-decode
Resample interleaved master-stereo PCM to MASTER_SAMPLE_RATE with rubato’s FFT (synchronous) resampler in one offline pass.
write_wav
Encode interleaved f32 PCM as a RIFF/WAVE file (IEEE float format).