makeRng(seed: number) → void
Park–Miller MINSTD. Every intermediate stays below 2^53, so the sequence is
exact in doubles and the same seed always bakes an identical clip.
| arg | type | description |
|---|
| seed | number | |
smoothstep(x: number) → number
| arg | type | description |
|---|
| x | number | |
lpCoef(fc: number, sr: number) → number
One-pole lowpass blend coefficient for cutoff `fc` at rate `sr`.
| arg | type | description |
|---|
| fc | number | |
| sr | number | |
gauss(fq: number, center: number, width: number) → number
| arg | type | description |
|---|
| fq | number | |
| center | number | |
| width | number | |
peakOf(x: Samples) → number
| arg | type | description |
|---|
| x | Samples | |
removeDC(x: Samples) → void
| arg | type | description |
|---|
| x | Samples | |
normalize(x: Samples, target: number) → void
| arg | type | description |
|---|
| x | Samples | |
| target | number | |
softClip(x: Samples, drive: number) → void
| arg | type | description |
|---|
| x | Samples | |
| drive | number | |
fadeEdges(x: Samples, sr: number, inMs: number, outMs: number) → void
Raised-cosine fade over the first `inMs` / last `outMs` of a one-shot.
| arg | type | description |
|---|
| x | Samples | |
| sr | number | |
| inMs | number | |
| outMs | number | |
crossfadeLoop(x: Samples, n: number, f: number) → Samples
Equal-power loop crossfade. `x` holds `n + f` samples; the first `f` output
samples blend the head with the `f` samples that continue past the loop
end, so the wrap y[n] → y[1] steps exactly like two adjacent samples of the
original stream — no click.
| arg | type | description |
|---|
| x | Samples | |
| n | number | |
| f | number | |
validateSamples(name: string, x: Samples, sr: number, loop: boolean) → ClipStats
| arg | type | description |
|---|
| name | string | |
| x | Samples | |
| sr | number | |
| loop | boolean | |
packF32(x: Samples) → string
Pack samples as the little-endian f32 binary string `audio.encodePcm`
consumes (its memory-efficient input form).
| arg | type | description |
|---|
| x | Samples | |
buildWingbeat( ) → Samples
Heavy leathery flap: a low whoomph of moving air. Noise through a two-pole
lowpass whose cutoff rides a fast-attack / slow-decay envelope, plus a
pitch-dropping sub thump. One-shot; the game pitch-shifts it per flap.
buildWind( ) → Samples
Steady rushing air, seamless 4 s loop. Two-pole lowpassed noise plus a
0.9–2.4 kHz airy band, with gain/cutoff LFOs at integer cycles per loop so
the modulation phase matches across the wrap. Neutral by design — the game
scales volume and pitch with airspeed.
buildBuffet( ) → Samples
Stall buffet: low rumble amplitude-modulated at 22 Hz (88 exact cycles per
4 s loop), with a 44 Hz body tone and a 1.25 Hz slow surge — all integer
cycles per loop, noise decorrelation handled by the crossfade.
buildThermal( ) → Samples
Soft rising tone, seamless 4 s loop: a Shepard–Risset glissando. Each of 5
octave-spaced partials climbs exactly one octave per loop; the base rate is
picked so every partial's phase closes on an integer number of cycles
(f0 · T / ln2 = integer), so partial k hands off to slot k+1 with matching
frequency, phase, and amplitude — a mathematically seamless infinite rise.
A quiet crossfade-looped airy band sits on top.
buildHiss( ) → Samples
Pressurized gas leak with a wet gurgle, 3 s loop. A 1.5–5.8 kHz noise band
for the hiss, a slow-wobbled low bed for the gurgle, and short descending
bubble pings written with modulo wrap so one crossing the loop end
continues seamlessly at the start.
buildClick( ) → Samples
One sharp igniter click, 120 ms at 44.1 kHz: a 1.2 ms high-passed spark
transient plus three short metallic rings (3.9 kHz / 6.3 kHz / 320 Hz).
buildWhoomph( ) → Samples
Gas ignition: a deep combustion blast. 8 ms attack; a noise flare whose
lowpass sweeps shut as the ~0.38 s decay runs; a 64 → 30 Hz sub thump; and
a low rumble tail. Soft-clipped for cohesion, ~1.5 s audible decay.
buildHeartbeat( ) → Samples
Slow lub-dub, 1.6 s loop: two low pitch-dropping thumps (60 Hz then 52 Hz)
with a soft valve tick each, silence to the loop point. The game raises
heart rate via playback pitch.
thump(tc: number, fb: number, tau: number, amp: number) → void
| arg | type | description |
|---|
| tc | number | |
| fb | number | |
| tau | number | |
| amp | number | |
buildRoar( ) → Samples
Deep reptilian bellow, ~2.2 s: 16 harmonics of a rising-then-sagging ~86 Hz
fundamental, weighted by a three-peak formant curve (470 / 1150 / 2450 Hz),
with late vibrato, a 26 Hz growl AM, and a gated breath-noise band.
buildBellow( ) → Samples
Aurochs lowing call, ~1.6 s: a rounder 14-harmonic stack on a rise-and-fall
96 → 132 → 70 Hz "moo" contour with low formants (390 / 950 Hz), light
growl, and gentle vibrato.
tryResolve(name: string) → any
| arg | type | description |
|---|
| name | string | |
exists(name: string) → boolean
| arg | type | description |
|---|
| name | string | |
clip(name: string) → any
Resolve a cue's `.soundClip` handle (nil until `Audio.ensure()` has run).
| arg | type | description |
|---|
| name | string | |
ensure( ) → EnsureResult
Synthesize and bake every cue that doesn't already exist. Idempotent: cues
whose `.soundClip` resolves (or whose source container is already on disk)
are skipped, so calling this twice creates no duplicates. Each clip is
numerically validated before it is written.