// All the instrument's parameters, with defaults, in SI units unless the name says otherwise. // The same object drives the browser app, the render scripts and the SF2 builder, and is saved // and loaded as JSON (presets/*.json). The UI is generated from PARAM_INFO at the bottom. import { N_STRINGS } from "./types.ts"; export interface StringParams { /** tension at pitch, N */ tension: number; /** outer diameter, mm (air damping) */ diameterMm: number; /** core diameter, mm (bending stiffness and EA) */ coreMm: number; /** bending stiffness relative to a solid steel core (rope/stranded cores are far more flexible) */ stiffFactor: number; } export interface Params { version: number; engine: { /** string discretisation: modal (exact per-mode damping, fast) or finite-difference time-domain */ stringModel: "modal" | "fd"; /** body: the parametric modal body below, or the finite-element body computed from `fe` */ bodyModel: "parametric" | "fe"; /** output sample rate, Hz */ sampleRate: number; /** internal oversampling factor (time step = 1 / (sampleRate * oversample)) */ oversample: number; /** highest string mode kept, Hz */ stringFmax: number; /** FD string: grid points per (shortest) wavelength at stringFmax; the FD grid is set by the stability limit otherwise */ fdCourant: number; /** geometric (tension-modulation) nonlinearity on/off */ nonlinear: boolean; /** let the open strings that are not played ring sympathetically */ sympathetic: boolean; /** level of the unplayed open strings' damping by the player's hands, 0 = free, 1 = fully muted */ sympatheticMute: number; /** render length, s */ duration: number; /** the player tunes and intonates by ear, compensating the pitch shift from the bridge's give */ intonate: boolean; /** thin the body modes where their overlap exceeds this (0 = keep all); see thinModes */ bodyOverlap: number; }; strings: { /** vibrating length of the open strings (nut to bridge), m */ scaleLength: number; /** the four strings, E A D G */ s: StringParams[]; /** core Young's modulus, Pa */ coreE: number; /** core density, kg/m^3 (only for EA consistency checks) */ coreRho: number; /** viscoelastic loss angle of the string (Valette), dimensionless */ deltaVe: number; /** frequency-independent (thermoelastic + friction in the windings) loss, 1/Q */ qTeInv: number; /** air density and viscosity for the string's air damping */ airRho: number; airEta: number; }; pluck: { /** plucking point, distance from the bridge, m */ position: number; /** finger pad contact width along the string, m (smooths the excitation of high modes) */ padWidth: number; /** pull direction, degrees from the plane of the top (0 = parallel to top, 90 = straight into the board) */ angleDeg: number; /** pad stiffness, N/m, and damping, N s/m (stick phase) */ padK: number; padR: number; /** finger pull speed during the stick phase, m/s */ pullSpeed: number; /** release force at velocity 1 and at velocity 127, N (interpolated by velCurve) */ forceMin: number; forceMax: number; /** exponent of the velocity -> force map */ velCurve: number; /** time for the string to slide off the pad at 10 N release force, ms */ slipMs: number; /** slip time scales as (10 N / F)^slipExp */ slipExp: number; }; stop: { /** left-hand finger damping of the stopped string (dashpot near the stopping point), N s/m */ damping: number; /** distance of that dashpot from the stopping point, m */ offset: number; /** highest semitone above the open string a note is fingered on before moving to the next string */ maxShift: number; }; body: { /** parametric body: the low "signature" modes (A0 air mode, the main corpus modes) */ lowModes: { label: string; f: number; q: number; mass: number; lateral: number; rad: number }[]; /** statistical higher modes: from fLow to fHigh, with plate-theory modal density */ statFLow: number; statFHigh: number; /** modal density scale (1 = spruce top 4.5 mm + maple back 4 mm of the area below) */ densityScale: number; /** radiating plate area (top), m^2 */ plateArea: number; /** effective plate mass seen by the bridge at high frequency (top), kg */ plateMass: number; /** loss factor of the statistical modes at 1 kHz, and its frequency exponent */ lossFactor: number; lossExp: number; /** ratio of lateral to vertical bridge coupling for the statistical modes (rocking) */ lateralRatio: number; /** bridge: first in-plane (rocking) resonance, Hz, and its Q; above it the bridge filters the body */ bridgeF: number; bridgeQ: number; /** radiation efficiency corner: modes above this radiate fully, below fall as (f/fc)^2 */ radCorner: number; /** overall radiation scale of the statistical modes relative to the plate's monopole estimate */ radScale: number; /** random seed for the statistical modes */ seed: number; }; fe: { /** body outline (top view), m. Length of the body (top plate, end to neck block) */ bodyLength: number; upperBout: number; middleBout: number; lowerBout: number; /** positions of the widest/narrowest points as fractions of the length from the lower end */ lowerBoutPos: number; middleBoutPos: number; upperBoutPos: number; /** rib depth (top to back at the rim), m */ ribDepth: number; /** top plate: thickness m, arching height m */ topThickness: number; topArch: number; /** back plate: thickness m (flat back with cross bars) */ backThickness: number; /** back cross bars (spruce, across the grain): count, height m, width m */ backBarCount: number; backBarHeight: number; backBarWidth: number; /** top wood (spruce), orthotropic: E along grain, E across, shear, Poisson, density, loss factor */ topEL: number; topER: number; topG: number; topNu: number; topRho: number; topLoss: number; /** back wood (maple) */ backEL: number; backER: number; backG: number; backNu: number; backRho: number; backLoss: number; /** bass bar: length, height, width, m (spruce, along the grain, under the bass foot) */ barLength: number; barHeight: number; barWidth: number; /** bridge position along the body, fraction from the lower end (between the f-hole notches) */ bridgePos: number; /** bridge: foot spacing m, height m (top plate to strings), string spacing at the top m */ footSpan: number; bridgeHeight: number; stringSpacing: number; /** bridge: mass kg and in-plane (rocking) stiffness at the string notches N/m */ bridgeMass: number; bridgeK: number; /** soundpost: offset behind the treble foot, m; stiffness N/m */ postOffset: number; postK: number; /** f-holes: length m, mean width m, lateral distance of their centres from the centre line m */ fholeLength: number; fholeWidth: number; fholeSpread: number; /** rim: rotational stiffness per unit length where plates meet the ribs, N m/(rad m) */ rimRotK: number; /** air */ airRho: number; airC: number; /** air cavity wall loss: Q of the cavity modes */ cavityQ: number; /** grid spacing, m, and highest mode kept, Hz */ gridH: number; fmax: number; /** listener distance in front of the top, m */ micDistance: number; /** statistical modes above fmax (as in the parametric body) to keep the top end alive */ statAbove: boolean; }; output: { /** listener distance (parametric body), m */ micDistance: number; /** mix of the far-field microphone (body radiation) */ micMix: number; /** mix of a bridge pickup (piezo: the strings' force on the bridge) */ pickupMix: number; /** pickup sensitivity to lateral force relative to vertical */ pickupLateral: number; /** pickup level: Pa-equivalent per N of bridge force, and a trim in dB */ pickupPaPerN: number; pickupGainDb: number; /** output gain applied before writing (dB) */ gainDb: number; }; sf2: { /** sampled notes: first MIDI note and step in semitones, number of notes */ firstNote: number; step: number; count: number; /** velocities rendered for the three layers */ velocities: number[]; /** layer boundaries (upper velocity of the soft and medium layers) */ layerTop: number[]; /** sample length for the lowest and the highest note, s (interpolated in log pitch) */ lengthLow: number; lengthHigh: number; /** fade at the end of each sample, s */ fade: number; /** volume envelope release (finger damping after key up), s */ release: number; /** velocity attenuation at velocity 0 within a layer, cB */ velAtten: number; /** loudness equalisation between the sampled notes (0 = physical, 1 = equal hard-layer RMS) */ levelEqualize: number; /** internal oversampling used for the SF2 renders */ oversample: number; /** reverb send, 0.1 % */ reverbSend: number; /** preset name, bank and program */ presetName: string; bank: number; program: number; }; } export function defaultParams(): Params { return { version: 1, engine: { stringModel: "modal", bodyModel: "fe", sampleRate: 44100, oversample: 1, stringFmax: 16000, fdCourant: 0.98, nonlinear: true, sympathetic: true, sympatheticMute: 0.6, duration: 4, bodyOverlap: 3, intonate: true, }, strings: { scaleLength: 1.06, // steel strings, orchestral tension (roughly Spirocore-like): tension N, outer/core diameter mm s: [ { tension: 300, diameterMm: 2.9, coreMm: 1.25, stiffFactor: 0.45 }, { tension: 310, diameterMm: 2.45, coreMm: 1.05, stiffFactor: 0.45 }, { tension: 300, diameterMm: 2.05, coreMm: 0.92, stiffFactor: 0.45 }, { tension: 280, diameterMm: 1.65, coreMm: 0.8, stiffFactor: 0.45 }, ], coreE: 2.0e11, coreRho: 7850, deltaVe: 2.5e-3, qTeInv: 3e-3, airRho: 1.2, airEta: 1.8e-5, }, pluck: { position: 0.3, padWidth: 0.014, angleDeg: 15, padK: 3e4, padR: 4, pullSpeed: 0.25, forceMin: 0.6, forceMax: 7, velCurve: 1.3, slipMs: 1.5, slipExp: 0.5, }, stop: { damping: 1.5, offset: 0.012, maxShift: 4, }, body: { // Signature modes, guided by published double-bass measurements (Askenfelt 1982; Brown 2004): // the Helmholtz air mode A0 near 60 Hz, a strong top/body mode T1 near 100-110 Hz, and a // cluster of corpus modes up to ~400 Hz. mass = effective mass at the bridge for vertical // force (kg); lateral = lateral/vertical coupling at the notches; rad = volume displaced per // unit vertical bridge displacement (m^2), i.e. the mode's monopole strength. lowModes: [ { label: "A0", f: 61, q: 22, mass: 2.6, lateral: 0.15, rad: 0.5 }, { label: "T1", f: 104, q: 18, mass: 0.75, lateral: 0.35, rad: 0.2 }, { label: "C2", f: 128, q: 20, mass: 1.6, lateral: 0.6, rad: 0.05 }, { label: "C3", f: 162, q: 22, mass: 1.2, lateral: 0.5, rad: 0.1 }, { label: "B1-", f: 198, q: 25, mass: 0.9, lateral: 0.7, rad: -0.08 }, { label: "B1+", f: 236, q: 25, mass: 0.8, lateral: 0.5, rad: 0.12 }, { label: "C4", f: 287, q: 28, mass: 1.0, lateral: 0.8, rad: -0.06 }, { label: "C5", f: 345, q: 30, mass: 0.9, lateral: 0.6, rad: 0.07 }, ], statFLow: 380, statFHigh: 9000, densityScale: 1, plateArea: 0.45, plateMass: 0.9, lossFactor: 0.025, lossExp: 0.15, lateralRatio: 0.6, bridgeF: 1150, bridgeQ: 5, radCorner: 900, radScale: 0.5, seed: 7, }, fe: { bodyLength: 1.12, upperBout: 0.53, middleBout: 0.40, lowerBout: 0.68, lowerBoutPos: 0.24, middleBoutPos: 0.53, upperBoutPos: 0.80, ribDepth: 0.2, topThickness: 0.0045, topArch: 0.025, backThickness: 0.004, backBarCount: 4, backBarHeight: 0.022, backBarWidth: 0.016, topEL: 11e9, topER: 0.75e9, topG: 0.7e9, topNu: 0.37, topRho: 430, topLoss: 0.012, backEL: 10e9, backER: 1.4e9, backG: 1.0e9, backNu: 0.35, backRho: 620, backLoss: 0.015, barLength: 0.62, barHeight: 0.022, barWidth: 0.012, bridgePos: 0.42, footSpan: 0.12, bridgeHeight: 0.16, stringSpacing: 0.031, bridgeMass: 0.07, bridgeK: 1.2e6, postOffset: 0.02, postK: 1.5e7, fholeLength: 0.21, fholeWidth: 0.018, fholeSpread: 0.13, rimRotK: 30, airRho: 1.2, airC: 343, cavityQ: 40, gridH: 0.018, fmax: 2500, micDistance: 1.0, statAbove: true, }, output: { micDistance: 1.0, micMix: 0.7, pickupMix: 0.6, pickupLateral: 0.5, pickupPaPerN: 0.15, pickupGainDb: 0, gainDb: 0, }, sf2: { firstNote: 28, step: 3, count: 11, velocities: [40, 80, 118], layerTop: [52, 92], lengthLow: 5, lengthHigh: 3, fade: 0.3, release: 0.25, velAtten: 250, levelEqualize: 0.7, oversample: 2, reverbSend: 150, presetName: "Acoustic Bass (sim)", bank: 0, program: 32, }, }; } /** Fill missing fields of a loaded (possibly older) params object from the defaults. */ export function mergeParams(loaded: unknown): Params { const d = defaultParams() as unknown as Record; const merge = (a: Record, b: unknown): Record => { if (!b || typeof b !== "object" || Array.isArray(b)) return a; const out: Record = { ...a }; for (const [k, v] of Object.entries(b as Record)) { const av = a[k]; if (av && typeof av === "object" && !Array.isArray(av)) out[k] = merge(av as Record, v); else if (v !== undefined) out[k] = v; } return out; }; const p = merge(d, loaded) as unknown as Params; if (!Array.isArray(p.strings.s) || p.strings.s.length !== N_STRINGS) p.strings.s = defaultParams().strings.s; return p; } /** The inputs the FE body depends on (to tell whether a computed FE body is up to date). */ export function feInputsKey(p: Params): string { const b = p.body; return JSON.stringify([p.fe, b.bridgeQ, b.lateralRatio, b.radCorner, b.radScale, b.seed, b.statFHigh]); } export function cloneParams(p: Params): Params { return JSON.parse(JSON.stringify(p)) as Params; } // ---------------------------------------------------------------- UI descriptors export interface ParamInfo { /** dotted path into Params, e.g. "pluck.position" or "strings.s.0.tension" */ path: string; label: string; group: string; unit?: string; min?: number; max?: number; step?: number; log?: boolean; /** display = value * scale (e.g. 1000 to show m as mm) */ scale?: number; options?: string[]; kind?: "number" | "bool" | "select" | "text"; help?: string; } const strInfo: ParamInfo[] = []; ["E", "A", "D", "G"].forEach((n, i) => { strInfo.push( { path: `strings.s.${i}.tension`, label: `${n} tension`, group: "Strings", unit: "N", min: 150, max: 500, step: 1, help: "Tension at pitch; the linear density follows from it and the open pitch." }, { path: `strings.s.${i}.diameterMm`, label: `${n} outer Ø`, group: "Strings", unit: "mm", min: 1, max: 4, step: 0.01 }, { path: `strings.s.${i}.coreMm`, label: `${n} core Ø`, group: "Strings", unit: "mm", min: 0.4, max: 2, step: 0.01, help: "Core sets bending stiffness (inharmonicity) and EA (pitch glide)." }, { path: `strings.s.${i}.stiffFactor`, label: `${n} core flex`, group: "Strings", min: 0.05, max: 1, step: 0.01, help: "Bending stiffness relative to a solid steel core. Rope cores are well below 1." }, ); }); export const PARAM_INFO: ParamInfo[] = [ { path: "engine.stringModel", label: "String model", group: "Engine", kind: "select", options: ["modal", "fd"], help: "modal: exact per-mode losses (fast). fd: finite-difference time-domain string." }, { path: "engine.bodyModel", label: "Body model", group: "Engine", kind: "select", options: ["parametric", "fe"], help: "parametric: signature + statistical modes. fe: computed from the geometry and wood (Compute FE body)." }, { path: "engine.oversample", label: "Oversample", group: "Engine", min: 1, max: 4, step: 1 }, { path: "engine.stringFmax", label: "String f max", group: "Engine", unit: "Hz", min: 4000, max: 20000, step: 100 }, { path: "engine.nonlinear", label: "Tension modulation", group: "Engine", kind: "bool", help: "Geometric nonlinearity: pitch glide on hard plucks, coupling of polarizations." }, { path: "engine.sympathetic", label: "Sympathetic strings", group: "Engine", kind: "bool", help: "The other open strings are coupled through the bridge and ring along." }, { path: "engine.sympatheticMute", label: "Hand muting", group: "Engine", min: 0, max: 1, step: 0.01, help: "How much the player's hands damp the unplayed strings." }, { path: "engine.intonate", label: "Tune by ear", group: "Engine", kind: "bool", help: "Correct open-string tension and stopped length for the pitch shift the bridge's give causes (as a player tuning and intonating by ear)." }, { path: "engine.bodyOverlap", label: "Mode thinning", group: "Engine", min: 0, max: 8, step: 0.5, help: "Where the body's modes overlap by more than this, use every k-th mode with sqrt(k) coupling (keeps mean admittance and radiated power). 0 = all modes, slower." }, { path: "engine.duration", label: "Duration", group: "Engine", unit: "s", min: 0.5, max: 10, step: 0.1 }, { path: "strings.scaleLength", label: "Scale length", group: "Strings", unit: "m", min: 0.9, max: 1.15, step: 0.005 }, ...strInfo, { path: "strings.deltaVe", label: "Viscoelastic δ", group: "Strings", min: 1e-4, max: 2e-2, log: true, help: "Valette viscoelastic loss angle: damping growing as f² (high partials)." }, { path: "strings.qTeInv", label: "1/Q floor", group: "Strings", min: 1e-5, max: 3e-3, log: true, help: "Frequency-independent loss (thermoelastic, winding friction)." }, { path: "pluck.position", label: "Pluck point", group: "Right hand", unit: "cm", scale: 100, min: 0.08, max: 0.6, step: 0.005, help: "Distance from the bridge. Jazz pizz is near the end of the fingerboard (~30 cm)." }, { path: "pluck.padWidth", label: "Pad width", group: "Right hand", unit: "mm", scale: 1000, min: 0.002, max: 0.03, step: 0.001 }, { path: "pluck.angleDeg", label: "Pull angle", group: "Right hand", unit: "°", min: 0, max: 80, step: 1, help: "0 = parallel to the top (sideways), larger = more into the fingerboard." }, { path: "pluck.padK", label: "Pad stiffness", group: "Right hand", unit: "N/m", min: 2e3, max: 3e5, log: true }, { path: "pluck.padR", label: "Pad damping", group: "Right hand", unit: "N·s/m", min: 0, max: 30, step: 0.1 }, { path: "pluck.pullSpeed", label: "Pull speed", group: "Right hand", unit: "m/s", min: 0.02, max: 2, log: true }, { path: "pluck.forceMin", label: "Force @ vel 1", group: "Right hand", unit: "N", min: 0.05, max: 10, log: true }, { path: "pluck.forceMax", label: "Force @ vel 127", group: "Right hand", unit: "N", min: 1, max: 30, log: true }, { path: "pluck.velCurve", label: "Velocity curve", group: "Right hand", min: 0.3, max: 3, step: 0.05 }, { path: "pluck.slipMs", label: "Slip time @10 N", group: "Right hand", unit: "ms", min: 0.2, max: 15, log: true, help: "How long the string takes to roll off the finger pad: longer = darker attack." }, { path: "pluck.slipExp", label: "Slip exponent", group: "Right hand", min: 0, max: 1.5, step: 0.05 }, { path: "stop.damping", label: "Finger damping", group: "Left hand", unit: "N·s/m", min: 0, max: 60, step: 0.5, help: "Flesh of the stopping finger. Open strings have none and ring longer." }, { path: "stop.offset", label: "Damper offset", group: "Left hand", unit: "mm", scale: 1000, min: 0.002, max: 0.04, step: 0.001 }, { path: "stop.maxShift", label: "Max position", group: "Left hand", unit: "st", min: 2, max: 12, step: 1, help: "Highest semitone fingered on a string before moving to the next one up." }, { path: "body.statFLow", label: "Stat. modes from", group: "Body (parametric)", unit: "Hz", min: 200, max: 1000, step: 5 }, { path: "body.statFHigh", label: "Stat. modes to", group: "Body (parametric)", unit: "Hz", min: 2000, max: 16000, step: 100 }, { path: "body.densityScale", label: "Modal density", group: "Body (parametric)", min: 0.3, max: 3, step: 0.05 }, { path: "body.plateMass", label: "Plate mass", group: "Body (parametric)", unit: "kg", min: 0.2, max: 3, step: 0.01 }, { path: "body.plateArea", label: "Plate area", group: "Body (parametric)", unit: "m²", min: 0.2, max: 0.7, step: 0.01 }, { path: "body.lossFactor", label: "Loss @1 kHz", group: "Body (parametric)", min: 0.003, max: 0.08, log: true }, { path: "body.lossExp", label: "Loss exponent", group: "Body (parametric)", min: -0.5, max: 1, step: 0.05 }, { path: "body.lateralRatio", label: "Lateral coupling", group: "Body (parametric)", min: 0, max: 1.5, step: 0.05 }, { path: "body.bridgeF", label: "Bridge resonance", group: "Body (parametric)", unit: "Hz", min: 400, max: 4000, log: true }, { path: "body.bridgeQ", label: "Bridge Q", group: "Body (parametric)", min: 1, max: 20, step: 0.1 }, { path: "body.radCorner", label: "Rad. corner", group: "Body (parametric)", unit: "Hz", min: 200, max: 3000, log: true }, { path: "body.radScale", label: "Rad. scale", group: "Body (parametric)", min: 0.05, max: 3, log: true }, { path: "body.seed", label: "Seed", group: "Body (parametric)", min: 1, max: 999, step: 1 }, { path: "fe.bodyLength", label: "Body length", group: "Body (FE)", unit: "m", min: 0.9, max: 1.3, step: 0.005 }, { path: "fe.lowerBout", label: "Lower bout", group: "Body (FE)", unit: "m", min: 0.5, max: 0.8, step: 0.005 }, { path: "fe.middleBout", label: "Middle bout", group: "Body (FE)", unit: "m", min: 0.3, max: 0.5, step: 0.005 }, { path: "fe.upperBout", label: "Upper bout", group: "Body (FE)", unit: "m", min: 0.4, max: 0.65, step: 0.005 }, { path: "fe.ribDepth", label: "Rib depth", group: "Body (FE)", unit: "m", min: 0.12, max: 0.25, step: 0.005 }, { path: "fe.topThickness", label: "Top thickness", group: "Body (FE)", unit: "mm", scale: 1000, min: 0.0025, max: 0.008, step: 0.0001 }, { path: "fe.topArch", label: "Top arching", group: "Body (FE)", unit: "mm", scale: 1000, min: 0, max: 0.05, step: 0.001 }, { path: "fe.backThickness", label: "Back thickness", group: "Body (FE)", unit: "mm", scale: 1000, min: 0.0025, max: 0.008, step: 0.0001 }, { path: "fe.backBarCount", label: "Back bars", group: "Body (FE)", min: 0, max: 6, step: 1, help: "Cross bars on the flat back. Without them the 4 mm back's first mode is near 12 Hz." }, { path: "fe.backBarHeight", label: "Back bar height", group: "Body (FE)", unit: "mm", scale: 1000, min: 0.005, max: 0.04, step: 0.001 }, { path: "fe.topEL", label: "Top E (grain)", group: "Body (FE)", unit: "GPa", scale: 1e-9, min: 6e9, max: 16e9, step: 1e8 }, { path: "fe.topER", label: "Top E (cross)", group: "Body (FE)", unit: "GPa", scale: 1e-9, min: 0.3e9, max: 1.5e9, step: 1e7 }, { path: "fe.topRho", label: "Top density", group: "Body (FE)", unit: "kg/m³", min: 300, max: 550, step: 5 }, { path: "fe.topLoss", label: "Top loss", group: "Body (FE)", min: 0.003, max: 0.05, log: true }, { path: "fe.backEL", label: "Back E (grain)", group: "Body (FE)", unit: "GPa", scale: 1e-9, min: 6e9, max: 16e9, step: 1e8 }, { path: "fe.backRho", label: "Back density", group: "Body (FE)", unit: "kg/m³", min: 450, max: 800, step: 5 }, { path: "fe.backLoss", label: "Back loss", group: "Body (FE)", min: 0.003, max: 0.05, log: true }, { path: "fe.barHeight", label: "Bass bar height", group: "Body (FE)", unit: "mm", scale: 1000, min: 0, max: 0.04, step: 0.001 }, { path: "fe.bridgePos", label: "Bridge position", group: "Body (FE)", min: 0.3, max: 0.55, step: 0.005 }, { path: "fe.bridgeHeight", label: "Bridge height", group: "Body (FE)", unit: "cm", scale: 100, min: 0.1, max: 0.2, step: 0.005 }, { path: "fe.bridgeK", label: "Bridge stiffness", group: "Body (FE)", unit: "N/m", min: 1e5, max: 1e7, log: true }, { path: "fe.postK", label: "Soundpost stiffness", group: "Body (FE)", unit: "N/m", min: 1e5, max: 1e8, log: true }, { path: "fe.fholeLength", label: "f-hole length", group: "Body (FE)", unit: "cm", scale: 100, min: 0.12, max: 0.3, step: 0.005 }, { path: "fe.fholeWidth", label: "f-hole width", group: "Body (FE)", unit: "mm", scale: 1000, min: 0.008, max: 0.03, step: 0.001 }, { path: "fe.rimRotK", label: "Rim rot. stiffness", group: "Body (FE)", unit: "N·m/rad/m", min: 0, max: 1000, step: 1 }, { path: "fe.cavityQ", label: "Cavity Q", group: "Body (FE)", min: 5, max: 200, log: true }, { path: "fe.gridH", label: "Grid spacing", group: "Body (FE)", unit: "mm", scale: 1000, min: 0.008, max: 0.04, step: 0.001 }, { path: "fe.fmax", label: "FE f max", group: "Body (FE)", unit: "Hz", min: 500, max: 5000, step: 50 }, { path: "output.micDistance", label: "Mic distance", group: "Output", unit: "m", min: 0.3, max: 5, step: 0.05 }, { path: "output.micMix", label: "Mic mix", group: "Output", min: 0, max: 1, step: 0.01, help: "Far-field pressure radiated by the body, as a microphone in front of the bass hears it." }, { path: "output.pickupMix", label: "Pickup mix", group: "Output", min: 0, max: 1, step: 0.01, help: "A bridge piezo: the strings' force on the bridge. Full fundamental, as in pickup recordings." }, { path: "output.pickupLateral", label: "Pickup lateral", group: "Output", min: 0, max: 1, step: 0.01 }, { path: "output.pickupGainDb", label: "Pickup trim", group: "Output", unit: "dB", min: -30, max: 30, step: 0.5 }, { path: "output.gainDb", label: "Gain", group: "Output", unit: "dB", min: -40, max: 40, step: 0.5 }, { path: "sf2.step", label: "Sample step", group: "SF2", unit: "st", min: 1, max: 6, step: 1 }, { path: "sf2.count", label: "Sample count", group: "SF2", min: 2, max: 40, step: 1 }, { path: "sf2.lengthLow", label: "Length (low)", group: "SF2", unit: "s", min: 1, max: 10, step: 0.1 }, { path: "sf2.lengthHigh", label: "Length (high)", group: "SF2", unit: "s", min: 0.5, max: 8, step: 0.1 }, { path: "sf2.levelEqualize", label: "Level equalize", group: "SF2", min: 0, max: 1, step: 0.05, help: "0 keeps the physical loudness differences between notes (strings, body resonances), 1 evens them out." }, { path: "sf2.release", label: "Release", group: "SF2", unit: "s", min: 0.02, max: 2, log: true }, { path: "sf2.reverbSend", label: "Reverb send", group: "SF2", unit: "‰", min: 0, max: 1000, step: 10 }, ]; export function getPath(obj: unknown, path: string): unknown { let o = obj as Record; for (const k of path.split(".")) o = o[k] as Record; return o; } export function setPath(obj: unknown, path: string, value: unknown): void { const ks = path.split("."); let o = obj as Record; for (const k of ks.slice(0, -1)) o = o[k] as Record; o[ks[ks.length - 1]] = value; }