bake
Turns `game.audio.recipes` into the `.soundClip` assets under `game/audio/clips`, and re-files a generated spoken line beside them. Authoring-time only: the game ships the baked clips, so a browser session synthesises nothing on the player's machine and a hot reload does not reco…
bake
Turns game.audio.recipes into the .soundClip assets under
game/audio/clips, and re-files a generated spoken line beside them.
Authoring-time only: the game ships the baked clips, so a browser session
synthesises nothing on the player's machine and a hot reload does not
recompute twenty seconds of drone.
local bake = require("game.audio.bake")
bake.run({ "stone_seat", "bed_night" }) -- one batch
bake.run() -- every recipe
bake.verify() -- read every clip's header back
run reports each clip's frames, peak, rms, build time and — for a loop — its
seam error, the size of the step across the join measured against the steps
the signal already takes. verify reads data.zaud's header off disk with
audio.info: a duration of zero, one frame, or the wrong channel count is a
clip that would otherwise ship silently broken.
Codecs
A loop goes out as codec = "pcm", uncompressed. It is seamless end to end,
and a compressed clip loses a few milliseconds off its head on decode, which is
a click at every join. A one-shot does not care and goes out as Opus, which is
what keeps eleven effects and eight spoken lines under a third of a megabyte
between them.
The compression choice is passed at create time. Setting it afterwards re-encodes what is already there and undoes the choice.
Speech
harvestVoice takes the .soundClip container a generation produced and
re-files it as voice_<line> under this slice's own folder, so the eight lines
are committed with the rest of the sound and a reload never re-buys them.
Each line is generated once; game.audio.lines holds the words and the
measured length of each.
Owned by the sound & voice slice.
Scoped to this part · feeds back into the world's score.