import type { ParamSpec } from "../../core/params.ts"; import { 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: "crashHigh", label: "pitch at pivot level", kind: "number", default: 55, min: 12, max: 108, step: 0.5, unit: "midi", hint: "crossing with the bob up at the pivot's height" }, { 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)" }, // ── voice: a soft high tone whose pitch is the outer bob's height ── { group: "voice", key: "voice", label: "height voice", kind: "bool", default: true }, { 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" }, { group: "voice", key: "voiceLevel", label: "level", kind: "number", default: -32, min: -60, max: 0, step: 0.5, unit: "dB" }, { group: "voice", key: "voiceBright", label: "brightness", kind: "number", default: 0.25, min: 0, max: 1, step: 0.01 }, { group: "voice", key: "voiceVibrato", label: "vibrato", kind: "number", default: 6, min: 0, max: 40, step: 0.5, unit: "cents" }, { 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" }, // ── 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"), ];