Log inGet started
World

First Light: Vagant

Branchmain
Branchesmain
Commit2ac9266a40

README.md

audio.bake

Turns audio.recipes into .soundClip assets under /source/sfx. Author time only: the game ships the baked clips, so a browser session synthesises nothing on the player's machine and the whole library is bytes in the world.

local bake = require("audio.bake")
bake.run({ "lamp_catch", "lamp_relight" })   -- build and file
bake.verify()                                 -- read every clip back

run returns one row per clip carrying what was built (rate, frames, peak, rms, loop seam) beside what came back off disk (rate, channels, frames, duration, peak), so a clip that encoded to silence or to the wrong channel count is visible in the same call that made it.

Encoding follows three live engine defects rather than arguing with them:

  • a clip that LOOPS is codec = "pcm" — an interior loop point is stored and read by nothing, so the only working loop is a clip that already joins to itself, and a resampling codec would smear that join;
  • every clip's settings go in asset.create's settings parameter, because setSettings afterwards re-encodes the PCM through Opus;
  • one-shots are Opus at 64 kbps, which is a tenth the size of PCM and keeps the transient intact.

synth.seed is set from the clip's own name before each build, so a re-bake produces the same bytes and a checksum only moves when the recipe moved.