bake
How every clip in this world was made, and how to make it again.
bake
How every clip in this world was made, and how to make it again.
local Bake = require("game.sound.bake")
Bake.all()
Author-time only. Nothing in the running game calls this — Soundscape
resolves finished .soundClip assets and never synthesises a sample or
reaches a service, so a player's machine does no DSP and makes no network
call. Run it from an execute in edit mode.
The four passes
| Call | What it does |
|---|---|
Bake.synth(names?) | Renders every recipe's pure-Luau floor and writes it out. |
Bake.generate(names?) | Submits every recipe's prompt to audio_gen, waits for the batch, conditions each take and re-authors the clip over its synthesised one. |
Bake.speak(ids?) | Reads every narrator line through audio_gen.speech and caches it as a clip. Lines that already have a clip are skipped. |
Bake.report() | audio.info on every finished clip: codec, rate, channels, frames, duration, size. |
The order matters. synth first means every clip exists and has sound in
it before a single service call is made, so a generation that fails, times out
or returns nothing leaves the game with the computed take rather than with
silence. generate re-authors in place with overwrite = true, which keeps
each clip's guid — the identity Soundscape and every saved reference already
hold.
Two things it is careful about
Settings go in at creation. Bake.write passes the codec into
asset.create's settings. Creating a clip and patching it with
setSettings afterwards re-encodes the payload through the default codec on
the way, which quietly undoes an uncompressed choice — so the beds state
codec = "pcm" there and nowhere else.
A generated take is read as bytes, not resolved as an asset. The service
names its output after its own prompt, so that identity is computed, and a
computed asset.resolve records no dependency edge and is a diagnostic the
world refuses to publish over. Bake reads data.zaud off the path the
status row gives it, decodes that, and removes the container once its audio
has been baked into a clip of ours.
Proving it
Bake.report() reads each clip's ZAUD header without decoding it. A duration
of zero, a single frame, or the wrong channel count is a clip that would ship
silent, and that read is what catches it before anyone has to listen.
Consumed by
Nothing at runtime. An author, from an execute.
Scoped to this part · feeds back into the world's score.