Render a custom sound patch
render_patchRender a hand-edited sound patch to a WAV file, turning JSON layer and effect settings into audio.
Instructions
Render a hand-edited patch (for example one returned by generate_sfx with changed values) to a WAV file. A patch is JSON: { layers: Layer[1..6], reverb 0-1, echo 0-0.9, echoTime s, drive 0-1, crush 0|1-16 bits, gain 0-1 }. Layer fields (all optional, defaults in brackets): type: "tone"|"fm"|"string"|"pluck"|"bell"|"noise" ["tone"]; wave: "sine"|"triangle"|"square"|"sawtooth" (tone/fm/pluck) string: physically modelled plucked string (Karplus-Strong); bright 0-1 [0.5] = darker (guqin) to brighter (pipa); decay = ring time bell: partials = [[ratio, amplitude, decayMultiplier 0-1], ...] (max 16) for custom bells, gongs, wood blocks; default is a metal bar sample: a CC0 recording; sample = one of drum-center-loud, drum-center-soft, drum-edge-loud, drum-rim, lightning-1, lightning-2, gong-1, gong-2, erhu-d3, erhu-f5, sword-clash, footstep-stone, arrow, footstep-grass, land, shield-block, page-turn, typewriter, chest-open, monster-growl, campfire, stream; pitch / pitchEnd semitones (slide over slideTime); offset s into the recording; set hold ≈ recording length to let it ring naturally (lengths s: drum-center-loud 2.7, drum-center-soft 2.7, drum-edge-loud 3.5, drum-rim 1.8, lightning-1 6.5, lightning-2 7, gong-1 10, gong-2 12, erhu-d3 4.9, erhu-f5 6, sword-clash 7.2, footstep-stone 5.4, arrow 4, footstep-grass 3.2, land 2.1, shield-block 3.6, page-turn 8.75, typewriter 4.55, chest-open 11.1, monster-growl 12.8, campfire 10.4, stream 10.4) freq, freqEnd: Hz, pitch slides exponentially from freq to freqEnd; slideTime: s the slide takes (0 = whole sound) hold: s to stay at full volume before the decay starts (louder, more violent bodies) repAccel: gap multiplier per repeat (<1 speeds up, e.g. 0.86 for an accelerating drum build-up); repGain: loudness multiplier per repeat (>1 crescendo) freqPeak / cutoffPeak (Hz, 0 = off): go up to this value by the end of attack, then down to freqEnd / cutoffEnd (Doppler-like pass-by for swishes) start: s delay; attack: s; decay: s (exponential fade); vol: 0-1 filter: "none"|"lowpass"|"highpass"|"bandpass"; cutoff, cutoffEnd: Hz; sweepTime: s (0 = whole); q: resonance vib: vibrato depth in cents; vibRate: Hz rep: number of repeats; repGap: s between repeats; repStep: pitch step per repeat; scale: "penta"|"chromatic" (unit of repStep) jitter 0-1: random gaps (1 = Poisson-like) and loudness per repeat; pitchJitter: semitones of random pitch/cutoff per repeat (crackles, bubbles, debris) noise layers: color "white"|"pink"|"brown"; any layer: trem 0-1 + tremRate Hz = wavering loudness (flames, rumble) patch.seed: integer that fixes the random pattern of jitter unison: 1-5 stacked voices; detune: cents spread fmRatio, fmIndex, fmDecay: FM modulator ratio, depth and how fast the depth decays (type "fm" only) Tips: punchy impacts = short noise layer (decay ~0.01) + tone with fast slideTime (~0.04); metallic = fm or bell; keep total vol*gain under ~1.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Name used for the JS play function (default: file name) | |
| patch | Yes | Patch JSON object with a "layers" array | |
| js_path | No | Also write a .js file with a play function for this sound | |
| out_path | Yes | WAV file to write |