library
Every synthesised sound in SLAG SAINT, as builders keyed by the name it ships under. Each builder returns a flat sample array; nothing here touches the engine, so the whole library rebuilds headless and deterministically.
audio.library
Every synthesised sound in SLAG SAINT, as builders keyed by the name it ships under. Each builder returns a flat sample array; nothing here touches the engine, so the whole library rebuilds headless and deterministically.
local Library = require("audio.library")
local pcm = Library.sfx.parry_ring()
local bed = Library.beds.amb_basin_cold()
Library.sfx— the twenty-five keys inRules.SFX_KEYS.Library.beds—amb_threshold,amb_basin_cold,amb_basin_fire, each a seamless loop.Library.MIX— the per-clip gain trim baked in at encode time, so the mix is already right before a single volume field is touched.
How the sounds are built
The material palette is the game's: bronze partials, cooled slag, water, steam and stone. Three engines do nearly all of it — an inharmonic partial stack for struck metal, filtered noise with a travelling cutoff for anything made of air, and a sub sine with a downward glide for weight.
The pairs that have to be distinguishable with the eyes shut are built as deliberate opposites:
parry_ringagainstguard_block— the parry is a struck bell with a bright second bell twelve milliseconds behind it and a long reverberant tail; the block is a damped thud with everything above 900 Hz taken off. One rings the saint, the other stops the blow, and they read that way.- the four impacts —
hit_bronzerings,hit_stonecracks dry and drops,hit_fleshthuds under a 2.6 kHz lowpass with no ring at all,hit_shieldclanks bright and stops short.
Rebuilding
-- one clip, straight to a .soundClip
local Synth = require("audio.synth")
local buf = Library.sfx.saint_bell()
Synth.gain(buf, Library.MIX.saint_bell)
asset.create("soundClip", "saint_bell", {
pcm = buf, sampleRate = Synth.SR, channels = 1,
folder = "audio/clips", overwrite = true,
settings = { codec = "opus", bitrateKbps = 80 },
})
Beds are baked with codec = "pcm" instead: an Opus clip loses its first few
milliseconds on decode, which puts a click at the seam of anything that loops.
Scoped to this part · feeds back into the world's score.