import type { ParamSpec } from "../../core/params.ts"; import { DRONE_INSTRUMENTS, NOTE_INSTRUMENTS } from "../../instruments/index.ts"; import { schema as c01 } from "../c01-poincare/schema.ts"; const pick = (key: string, o: Partial = {}): ParamSpec => { const s = c01.find((x) => x.key === key); if (!s) throw new Error(`no setting ${key} in composition 1`); return { ...s, ...o } as ParamSpec; }; export const schema: ParamSpec[] = [ // ── form ── { group: "form", key: "fallAfter", label: "tips after", kind: "number", default: 5, min: 1, max: 30, step: 0.5, unit: "s", hint: "the nudge from straight up is calibrated so the pendulum visibly tips at about this time" }, { group: "form", key: "freeTime", label: "swinging", kind: "number", default: 60, min: 5, max: 600, step: 1, unit: "s", hint: "time before the stronger damping begins" }, { group: "form", key: "dampTime", label: "damping", kind: "number", default: 20, min: 2, max: 300, step: 0.5, unit: "s", hint: "time over which the damping grows to its final strength" }, { group: "form", key: "dampBase", label: "slight damping", kind: "number", default: 0.004, min: 0, max: 0.1, step: 0.0005, unit: "/sim s", hint: "friction throughout (energy loses roughly this fraction per simulated second)" }, { group: "form", key: "dampEnd", label: "final damping", kind: "number", default: 0.2, min: 0.01, max: 2, log: true, unit: "/sim s", hint: "friction reached by the end of the damping" }, pick("restEnergy", { hint: "after the damping, the pendulum counts as at rest below this energy: the last crash rings out" }), pick("finalHold"), pick("finalFade"), // ── pendulum ── { group: "pendulum", key: "speed", label: "speed", kind: "number", default: 1.5, min: 0.25, max: 20, log: true, unit: "×", hint: "simulated seconds per real second" }, { group: "pendulum", key: "tipThreshold", label: "“visibly”", kind: "number", default: 0.02, min: 0.001, max: 0.5, log: true, hint: "sideways bob movement (fraction of the length) that counts as tipping" }, pick("massRatio", { group: "pendulum" }), pick("lengthRatio", { group: "pendulum" }), pick("seed", { group: "pendulum", hint: "0 = a different nudge (side and shape) every play" }), // ── crashes: outer bob crossing the vertical below the pivot ── { group: "crash", key: "crashInstrument", label: "instrument", kind: "select", default: "modal: Chaos gong", options: Object.keys(NOTE_INSTRUMENTS) }, pick("modalCustom", { group: "crash" }), { group: "crash", key: "crashLow", label: "pitch at bottom", kind: "number", default: 31, min: 12, max: 96, step: 0.5, unit: "midi", hint: "crossing with the bob straight down (continuous pitch)" }, { group: "crash", key: "minDepth", label: "minimum depth", kind: "number", default: 0.25, min: 0, max: 0.95, step: 0.01, hint: "crossings count only this far below the pivot (fraction of the length), so a folded pendulum sweeping its bob past the pivot is silent" }, { group: "crash", key: "crashHigh", label: "pitch at min depth", kind: "number", default: 55, min: 12, max: 108, step: 0.5, unit: "midi", hint: "crossing at the minimum depth (the shallowest that counts)" }, { group: "crash", key: "crashCurve", label: "pitch curve", kind: "number", default: 1, min: 0.2, max: 5, log: true }, { group: "crash", key: "firstVel", label: "first crash", kind: "number", default: 1, min: 0.05, max: 1, step: 0.01, hint: "strength of the first crash (accent)" }, { group: "crash", key: "maxVel", label: "strongest crash", kind: "number", default: 0.6, min: 0.05, max: 1, step: 0.01, hint: "strength of later crashes at full speed" }, { group: "crash", key: "loudRef", label: "speed for full", kind: "number", default: 0.8, min: 0.05, max: 1, step: 0.01, hint: "bob speed (fraction of the fastest possible) that gives the strongest crash" }, pick("loudCurve", { group: "crash" }), pick("loudFloor", { group: "crash", default: 0.15 }), pick("notesLevel", { group: "crash", default: -2 }), { group: "crash", key: "maxCrashes", label: "overlapping crashes", kind: "number", default: 4, min: 1, max: 16, step: 1, hint: "most crashes ringing at once (a new one replaces the oldest)" }, { group: "crash", key: "deviceLimit", label: "limit to device", kind: "bool", default: true, hint: "measure (once per device) how many ringing crashes it can render, and allow no more" }, { group: "crash", key: "streamAudio", label: "render ahead", kind: "bool", default: true, hint: "render the crashes in a background thread, ~1 s ahead (applies on the next play)" }, // ── click: the outer bob sweeping past the pivot (within the minimum depth) ── { group: "click", key: "click", label: "click", kind: "bool", default: true, hint: "a click when the outer bob passes the pivot (closer than the minimum depth)" }, { group: "click", key: "clickInstrument", label: "instrument", kind: "select", default: "modal: Viola", options: Object.keys(NOTE_INSTRUMENTS) }, { group: "click", key: "clickPitch", label: "pitch", kind: "number", default: 72, min: 24, max: 120, step: 0.5, unit: "midi" }, { group: "click", key: "clickLength", label: "length", kind: "number", default: 0.5, min: 0.01, max: 2, log: true, unit: "s" }, { group: "click", key: "clickMaxVel", label: "strongest", kind: "number", default: 0.7, min: 0.05, max: 1, step: 0.01, hint: "strength at full bob speed (follows the speed like the crashes)" }, { group: "click", key: "clickLevel", label: "level", kind: "number", default: -4, min: -48, max: 6, step: 0.5, unit: "dB" }, // ── voice: a sustained tone whose pitch glides with the outer bob's height ── { group: "voice", key: "voice", label: "height voice", kind: "bool", default: true }, { group: "voice", key: "voiceInstrument", label: "instrument", kind: "select", default: "modal: Clarinet-ish", options: ["soft sine", ...Object.keys(DRONE_INSTRUMENTS).filter((k) => k.startsWith("modal: "))], hint: "modal: … = one held modal-synth note, glided with pitch bend (applies on the next play)" }, { group: "voice", key: "voiceCustom", label: "modal custom", kind: "text", default: "", hint: "for “modal: custom”: paste JSON from modal-synth’s Copy button" }, { group: "voice", key: "voiceTone", label: "tone", kind: "number", default: 0.1, min: 0, max: 1, step: 0.01, hint: "modal voice: 0 = mellow and pure, 1 = bright and reedy (pickup and tilt, as the hum's timbre)" }, { group: "voice", key: "voiceLow", label: "pitch at bottom", kind: "number", default: 67, min: 36, max: 108, step: 0.5, unit: "midi", hint: "bob straight down" }, { group: "voice", key: "voiceHigh", label: "pitch at top", kind: "number", default: 91, min: 36, max: 120, step: 0.5, unit: "midi", hint: "bob straight up (modal voices glide at most 24 semitones from the middle)" }, { group: "voice", key: "voiceLevel", label: "level", kind: "number", default: -10, min: -60, max: 6, step: 0.5, unit: "dB", hint: "modal voice: held at this loudness (normalized), so it stays comparable to the crashes" }, { group: "voice", key: "voiceRamp", label: "ramp in", kind: "number", default: 6, min: 0, max: 60, step: 0.5, unit: "s", hint: "the voice grows to full level over the opening" }, { group: "voice", key: "voiceRampFrom", label: "ramp from", kind: "number", default: 0.2, min: 0, max: 1, step: 0.01, hint: "starting level, as a fraction of full" }, { group: "voice", key: "voiceFollow", label: "fades with energy", kind: "number", default: 0.5, min: 0, max: 2, step: 0.05, hint: "level × (energy / start energy)^this, so it quiets as the pendulum is damped" }, { group: "voice", key: "voiceBright", label: "sine brightness", kind: "number", default: 0.25, min: 0, max: 1, step: 0.01, hint: "soft sine only" }, { group: "voice", key: "voiceVibrato", label: "sine vibrato", kind: "number", default: 6, min: 0, max: 40, step: 0.5, unit: "cents", hint: "soft sine only" }, // ── visual ── { group: "visual", key: "trails", label: "trail", kind: "bool", default: true }, { group: "visual", key: "trailLength", label: "trail length", kind: "number", default: 2.5, min: 0.2, max: 20, log: true, unit: "s" }, { group: "visual", key: "crashRings", label: "crash rings", kind: "bool", default: true, hint: "a brief ring where each crash happens" }, pick("motionBlur"), ];