1// All the instrument's parameters, with defaults, in SI units unless the name says otherwise.
2// The same object drives the browser app, the render scripts and the SF2 builder, and is saved
3// and loaded as JSON (presets/*.json). The UI is generated from PARAM_INFO at the bottom.
5import { N_STRINGS } from "./types.ts";
7export interface StringParams {
8 /** tension at pitch, N */
9 tension: number;
10 /** outer diameter, mm (air damping) */
11 diameterMm: number;
12 /** core diameter, mm (bending stiffness and EA) */
13 coreMm: number;
14 /** bending stiffness relative to a solid steel core (rope/stranded cores are far more flexible) */
15 stiffFactor: number;
16}
18export interface Params {
19 version: number;
20 engine: {
21 /** string discretisation: modal (exact per-mode damping, fast) or finite-difference time-domain */
22 stringModel: "modal" | "fd";
23 /** body: the parametric modal body below, or the finite-element body computed from `fe` */
24 bodyModel: "parametric" | "fe";
25 /** output sample rate, Hz */
26 sampleRate: number;
27 /** internal oversampling factor (time step = 1 / (sampleRate * oversample)) */
28 oversample: number;
29 /** highest string mode kept, Hz */
30 stringFmax: number;
31 /** FD string: grid points per (shortest) wavelength at stringFmax; the FD grid is set by the stability limit otherwise */
32 fdCourant: number;
33 /** geometric (tension-modulation) nonlinearity on/off */
34 nonlinear: boolean;
35 /** let the open strings that are not played ring sympathetically */
36 sympathetic: boolean;
37 /** level of the unplayed open strings' damping by the player's hands, 0 = free, 1 = fully muted */
38 sympatheticMute: number;
39 /** render length, s */
40 duration: number;
41 /** the player tunes and intonates by ear, compensating the pitch shift from the bridge's give */
42 intonate: boolean;
43 /** thin the body modes where their overlap exceeds this (0 = keep all); see thinModes */
44 bodyOverlap: number;
45 };
46 strings: {
47 /** vibrating length of the open strings (nut to bridge), m */
48 scaleLength: number;
49 /** the four strings, E A D G */
50 s: StringParams[];
51 /** core Young's modulus, Pa */
52 coreE: number;
53 /** core density, kg/m^3 (only for EA consistency checks) */
54 coreRho: number;
55 /** viscoelastic loss angle of the string (Valette), dimensionless */
56 deltaVe: number;
57 /** frequency-independent (thermoelastic + friction in the windings) loss, 1/Q */
58 qTeInv: number;
59 /** air density and viscosity for the string's air damping */
60 airRho: number;
61 airEta: number;
62 };
63 pluck: {
64 /** plucking point, distance from the bridge, m */
65 position: number;
66 /** finger pad contact width along the string, m (smooths the excitation of high modes) */
67 padWidth: number;
68 /** pull direction, degrees from the plane of the top (0 = parallel to top, 90 = straight into the board) */
69 angleDeg: number;
70 /** pad stiffness, N/m, and damping, N s/m (stick phase) */
71 padK: number;
72 padR: number;
73 /** finger pull speed during the stick phase, m/s */
74 pullSpeed: number;
75 /** release force at velocity 1 and at velocity 127, N (interpolated by velCurve) */
76 forceMin: number;
77 forceMax: number;
78 /** exponent of the velocity -> force map */
79 velCurve: number;
80 /** time for the string to slide off the pad at 10 N release force, ms */
81 slipMs: number;
82 /** slip time scales as (10 N / F)^slipExp */
83 slipExp: number;
84 };
85 stop: {
86 /** left-hand finger damping of the stopped string (dashpot near the stopping point), N s/m */
87 damping: number;
88 /** distance of that dashpot from the stopping point, m */
89 offset: number;
90 /** highest semitone above the open string a note is fingered on before moving to the next string */
91 maxShift: number;
92 };
93 body: {
94 /** parametric body: the low "signature" modes (A0 air mode, the main corpus modes) */
95 lowModes: { label: string; f: number; q: number; mass: number; lateral: number; rad: number }[];
96 /** statistical higher modes: from fLow to fHigh, with plate-theory modal density */
97 statFLow: number;
98 statFHigh: number;
99 /** modal density scale (1 = spruce top 4.5 mm + maple back 4 mm of the area below) */
100 densityScale: number;
101 /** radiating plate area (top), m^2 */
102 plateArea: number;
103 /** effective plate mass seen by the bridge at high frequency (top), kg */
104 plateMass: number;
105 /** loss factor of the statistical modes at 1 kHz, and its frequency exponent */
106 lossFactor: number;
107 lossExp: number;
108 /** ratio of lateral to vertical bridge coupling for the statistical modes (rocking) */
109 lateralRatio: number;
110 /** bridge: first in-plane (rocking) resonance, Hz, and its Q; above it the bridge filters the body */
111 bridgeF: number;
112 bridgeQ: number;
113 /** radiation efficiency corner: modes above this radiate fully, below fall as (f/fc)^2 */
114 radCorner: number;
115 /** overall radiation scale of the statistical modes relative to the plate's monopole estimate */
116 radScale: number;
117 /** random seed for the statistical modes */
118 seed: number;
119 };
120 fe: {
121 /** body outline (top view), m. Length of the body (top plate, end to neck block) */
122 bodyLength: number;
123 upperBout: number;
124 middleBout: number;
125 lowerBout: number;
126 /** positions of the widest/narrowest points as fractions of the length from the lower end */
127 lowerBoutPos: number;
128 middleBoutPos: number;
129 upperBoutPos: number;
130 /** rib depth (top to back at the rim), m */
131 ribDepth: number;
132 /** top plate: thickness m, arching height m */
133 topThickness: number;
134 topArch: number;
135 /** back plate: thickness m (flat back with cross bars) */
136 backThickness: number;
137 /** back cross bars (spruce, across the grain): count, height m, width m */
138 backBarCount: number;
139 backBarHeight: number;
140 backBarWidth: number;
141 /** top wood (spruce), orthotropic: E along grain, E across, shear, Poisson, density, loss factor */
142 topEL: number;
143 topER: number;
144 topG: number;
145 topNu: number;
146 topRho: number;
147 topLoss: number;
148 /** back wood (maple) */
149 backEL: number;
150 backER: number;
151 backG: number;
152 backNu: number;
153 backRho: number;
154 backLoss: number;
155 /** bass bar: length, height, width, m (spruce, along the grain, under the bass foot) */
156 barLength: number;
157 barHeight: number;
158 barWidth: number;
159 /** bridge position along the body, fraction from the lower end (between the f-hole notches) */
160 bridgePos: number;
161 /** bridge: foot spacing m, height m (top plate to strings), string spacing at the top m */
162 footSpan: number;
163 bridgeHeight: number;
164 stringSpacing: number;
165 /** bridge: mass kg and in-plane (rocking) stiffness at the string notches N/m */
166 bridgeMass: number;
167 bridgeK: number;
168 /** soundpost: offset behind the treble foot, m; stiffness N/m */
169 postOffset: number;
170 postK: number;
171 /** f-holes: length m, mean width m, lateral distance of their centres from the centre line m */
172 fholeLength: number;
173 fholeWidth: number;
174 fholeSpread: number;
175 /** rim: rotational stiffness per unit length where plates meet the ribs, N m/(rad m) */
176 rimRotK: number;
177 /** air */
178 airRho: number;
179 airC: number;
180 /** air cavity wall loss: Q of the cavity modes */
181 cavityQ: number;
182 /** grid spacing, m, and highest mode kept, Hz */
183 gridH: number;
184 fmax: number;
185 /** listener distance in front of the top, m */
186 micDistance: number;
187 /** statistical modes above fmax (as in the parametric body) to keep the top end alive */
188 statAbove: boolean;
189 };
190 output: {
191 /** listener distance (parametric body), m */
192 micDistance: number;
193 /** mix of the far-field microphone (body radiation) */
194 micMix: number;
195 /** mix of a bridge pickup (piezo: the strings' force on the bridge) */
196 pickupMix: number;
197 /** pickup sensitivity to lateral force relative to vertical */
198 pickupLateral: number;
199 /** pickup level: Pa-equivalent per N of bridge force, and a trim in dB */
200 pickupPaPerN: number;
201 pickupGainDb: number;
202 /** output gain applied before writing (dB) */
203 gainDb: number;
204 };
205 sf2: {
206 /** sampled notes: first MIDI note and step in semitones, number of notes */
207 firstNote: number;
208 step: number;
209 count: number;
210 /** velocities rendered for the three layers */
211 velocities: number[];
212 /** layer boundaries (upper velocity of the soft and medium layers) */
213 layerTop: number[];
214 /** sample length for the lowest and the highest note, s (interpolated in log pitch) */
215 lengthLow: number;
216 lengthHigh: number;
217 /** fade at the end of each sample, s */
218 fade: number;
219 /** volume envelope release (finger damping after key up), s */
220 release: number;
221 /** velocity attenuation at velocity 0 within a layer, cB */
222 velAtten: number;
223 /** loudness equalisation between the sampled notes (0 = physical, 1 = equal hard-layer RMS) */
224 levelEqualize: number;
225 /** internal oversampling used for the SF2 renders */
226 oversample: number;
227 /** reverb send, 0.1 % */
228 reverbSend: number;
229 /** preset name, bank and program */
230 presetName: string;
231 bank: number;
232 program: number;
233 };
234}
236export function defaultParams(): Params {
237 return {
238 version: 1,
239 engine: {
240 stringModel: "modal",
241 bodyModel: "fe",
242 sampleRate: 44100,
243 oversample: 1,
244 stringFmax: 16000,
245 fdCourant: 0.98,
246 nonlinear: true,
247 sympathetic: true,
248 sympatheticMute: 0.6,
249 duration: 4,
250 bodyOverlap: 3,
251 intonate: true,
252 },
253 strings: {
254 scaleLength: 1.06,
255 // steel strings, orchestral tension (roughly Spirocore-like): tension N, outer/core diameter mm
256 s: [
257 { tension: 300, diameterMm: 2.9, coreMm: 1.25, stiffFactor: 0.45 },
258 { tension: 310, diameterMm: 2.45, coreMm: 1.05, stiffFactor: 0.45 },
259 { tension: 300, diameterMm: 2.05, coreMm: 0.92, stiffFactor: 0.45 },
260 { tension: 280, diameterMm: 1.65, coreMm: 0.8, stiffFactor: 0.45 },
261 ],
262 coreE: 2.0e11,
263 coreRho: 7850,
264 deltaVe: 2.5e-3,
265 qTeInv: 3e-3,
266 airRho: 1.2,
267 airEta: 1.8e-5,
268 },
269 pluck: {
270 position: 0.3,
271 padWidth: 0.014,
272 angleDeg: 15,
273 padK: 3e4,
274 padR: 4,
275 pullSpeed: 0.25,
276 forceMin: 0.6,
277 forceMax: 7,
278 velCurve: 1.3,
279 slipMs: 1.5,
280 slipExp: 0.5,
281 },
282 stop: {
283 damping: 1.5,
284 offset: 0.012,
285 maxShift: 4,
286 },
287 body: {
288 // Signature modes, guided by published double-bass measurements (Askenfelt 1982; Brown 2004):
289 // the Helmholtz air mode A0 near 60 Hz, a strong top/body mode T1 near 100-110 Hz, and a
290 // cluster of corpus modes up to ~400 Hz. mass = effective mass at the bridge for vertical
291 // force (kg); lateral = lateral/vertical coupling at the notches; rad = volume displaced per
292 // unit vertical bridge displacement (m^2), i.e. the mode's monopole strength.
293 lowModes: [
294 { label: "A0", f: 61, q: 22, mass: 2.6, lateral: 0.15, rad: 0.5 },
295 { label: "T1", f: 104, q: 18, mass: 0.75, lateral: 0.35, rad: 0.2 },
296 { label: "C2", f: 128, q: 20, mass: 1.6, lateral: 0.6, rad: 0.05 },
297 { label: "C3", f: 162, q: 22, mass: 1.2, lateral: 0.5, rad: 0.1 },
298 { label: "B1-", f: 198, q: 25, mass: 0.9, lateral: 0.7, rad: -0.08 },
299 { label: "B1+", f: 236, q: 25, mass: 0.8, lateral: 0.5, rad: 0.12 },
300 { label: "C4", f: 287, q: 28, mass: 1.0, lateral: 0.8, rad: -0.06 },
301 { label: "C5", f: 345, q: 30, mass: 0.9, lateral: 0.6, rad: 0.07 },
302 ],
303 statFLow: 380,
304 statFHigh: 9000,
305 densityScale: 1,
306 plateArea: 0.45,
307 plateMass: 0.9,
308 lossFactor: 0.025,
309 lossExp: 0.15,
310 lateralRatio: 0.6,
311 bridgeF: 1150,
312 bridgeQ: 5,
313 radCorner: 900,
314 radScale: 0.5,
315 seed: 7,
316 },
317 fe: {
318 bodyLength: 1.12,
319 upperBout: 0.53,
320 middleBout: 0.40,
321 lowerBout: 0.68,
322 lowerBoutPos: 0.24,
323 middleBoutPos: 0.53,
324 upperBoutPos: 0.80,
325 ribDepth: 0.2,
326 topThickness: 0.0045,
327 topArch: 0.025,
328 backThickness: 0.004,
329 backBarCount: 4,
330 backBarHeight: 0.022,
331 backBarWidth: 0.016,
332 topEL: 11e9,
333 topER: 0.75e9,
334 topG: 0.7e9,
335 topNu: 0.37,
336 topRho: 430,
337 topLoss: 0.012,
338 backEL: 10e9,
339 backER: 1.4e9,
340 backG: 1.0e9,
341 backNu: 0.35,
342 backRho: 620,
343 backLoss: 0.015,
344 barLength: 0.62,
345 barHeight: 0.022,
346 barWidth: 0.012,
347 bridgePos: 0.42,
348 footSpan: 0.12,
349 bridgeHeight: 0.16,
350 stringSpacing: 0.031,
351 bridgeMass: 0.07,
352 bridgeK: 1.2e6,
353 postOffset: 0.02,
354 postK: 1.5e7,
355 fholeLength: 0.21,
356 fholeWidth: 0.018,
357 fholeSpread: 0.13,
358 rimRotK: 30,
359 airRho: 1.2,
360 airC: 343,
361 cavityQ: 40,
362 gridH: 0.018,
363 fmax: 2500,
364 micDistance: 1.0,
365 statAbove: true,
366 },
367 output: {
368 micDistance: 1.0,
369 micMix: 0.7,
370 pickupMix: 0.6,
371 pickupLateral: 0.5,
372 pickupPaPerN: 0.15,
373 pickupGainDb: 0,
374 gainDb: 0,
375 },
376 sf2: {
377 firstNote: 28,
378 step: 3,
379 count: 11,
380 velocities: [40, 80, 118],
381 layerTop: [52, 92],
382 lengthLow: 5,
383 lengthHigh: 3,
384 fade: 0.3,
385 release: 0.25,
386 velAtten: 250,
387 levelEqualize: 0.7,
388 oversample: 2,
389 reverbSend: 150,
390 presetName: "Acoustic Bass (sim)",
391 bank: 0,
392 program: 32,
393 },
394 };
395}
397/** Fill missing fields of a loaded (possibly older) params object from the defaults. */
398export function mergeParams(loaded: unknown): Params {
399 const d = defaultParams() as unknown as Record<string, unknown>;
400 const merge = (a: Record<string, unknown>, b: unknown): Record<string, unknown> => {
401 if (!b || typeof b !== "object" || Array.isArray(b)) return a;
402 const out: Record<string, unknown> = { ...a };
403 for (const [k, v] of Object.entries(b as Record<string, unknown>)) {
404 const av = a[k];
405 if (av && typeof av === "object" && !Array.isArray(av)) out[k] = merge(av as Record<string, unknown>, v);
406 else if (v !== undefined) out[k] = v;
407 }
408 return out;
409 };
410 const p = merge(d, loaded) as unknown as Params;
411 if (!Array.isArray(p.strings.s) || p.strings.s.length !== N_STRINGS) p.strings.s = defaultParams().strings.s;
412 return p;
413}
415/** The inputs the FE body depends on (to tell whether a computed FE body is up to date). */
416export function feInputsKey(p: Params): string {
417 const b = p.body;
418 return JSON.stringify([p.fe, b.bridgeQ, b.lateralRatio, b.radCorner, b.radScale, b.seed, b.statFHigh]);
419}
421export function cloneParams(p: Params): Params {
422 return JSON.parse(JSON.stringify(p)) as Params;
423}
425// ---------------------------------------------------------------- UI descriptors
427export interface ParamInfo {
428 /** dotted path into Params, e.g. "pluck.position" or "strings.s.0.tension" */
429 path: string;
430 label: string;
431 group: string;
432 unit?: string;
433 min?: number;
434 max?: number;
435 step?: number;
436 log?: boolean;
437 /** display = value * scale (e.g. 1000 to show m as mm) */
438 scale?: number;
439 options?: string[];
440 kind?: "number" | "bool" | "select" | "text";
441 help?: string;
442}
444const strInfo: ParamInfo[] = [];
445["E", "A", "D", "G"].forEach((n, i) => {
446 strInfo.push(
447 { 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." },
448 { path: `strings.s.${i}.diameterMm`, label: `${n} outer Ø`, group: "Strings", unit: "mm", min: 1, max: 4, step: 0.01 },
449 { 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)." },
450 { 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." },
451 );
452});
454export const PARAM_INFO: ParamInfo[] = [
455 { 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." },
456 { 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)." },
457 { path: "engine.oversample", label: "Oversample", group: "Engine", min: 1, max: 4, step: 1 },
458 { path: "engine.stringFmax", label: "String f max", group: "Engine", unit: "Hz", min: 4000, max: 20000, step: 100 },
459 { path: "engine.nonlinear", label: "Tension modulation", group: "Engine", kind: "bool", help: "Geometric nonlinearity: pitch glide on hard plucks, coupling of polarizations." },
460 { path: "engine.sympathetic", label: "Sympathetic strings", group: "Engine", kind: "bool", help: "The other open strings are coupled through the bridge and ring along." },
461 { 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." },
462 { 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)." },
463 { 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." },
464 { path: "engine.duration", label: "Duration", group: "Engine", unit: "s", min: 0.5, max: 10, step: 0.1 },
466 { path: "strings.scaleLength", label: "Scale length", group: "Strings", unit: "m", min: 0.9, max: 1.15, step: 0.005 },
467 ...strInfo,
468 { 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)." },
469 { path: "strings.qTeInv", label: "1/Q floor", group: "Strings", min: 1e-5, max: 3e-3, log: true, help: "Frequency-independent loss (thermoelastic, winding friction)." },
471 { 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)." },
472 { path: "pluck.padWidth", label: "Pad width", group: "Right hand", unit: "mm", scale: 1000, min: 0.002, max: 0.03, step: 0.001 },
473 { 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." },
474 { path: "pluck.padK", label: "Pad stiffness", group: "Right hand", unit: "N/m", min: 2e3, max: 3e5, log: true },
475 { path: "pluck.padR", label: "Pad damping", group: "Right hand", unit: "N·s/m", min: 0, max: 30, step: 0.1 },
476 { path: "pluck.pullSpeed", label: "Pull speed", group: "Right hand", unit: "m/s", min: 0.02, max: 2, log: true },
477 { path: "pluck.forceMin", label: "Force @ vel 1", group: "Right hand", unit: "N", min: 0.05, max: 10, log: true },
478 { path: "pluck.forceMax", label: "Force @ vel 127", group: "Right hand", unit: "N", min: 1, max: 30, log: true },
479 { path: "pluck.velCurve", label: "Velocity curve", group: "Right hand", min: 0.3, max: 3, step: 0.05 },
480 { 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." },
481 { path: "pluck.slipExp", label: "Slip exponent", group: "Right hand", min: 0, max: 1.5, step: 0.05 },
483 { 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." },
484 { path: "stop.offset", label: "Damper offset", group: "Left hand", unit: "mm", scale: 1000, min: 0.002, max: 0.04, step: 0.001 },
485 { 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." },
487 { path: "body.statFLow", label: "Stat. modes from", group: "Body (parametric)", unit: "Hz", min: 200, max: 1000, step: 5 },
488 { path: "body.statFHigh", label: "Stat. modes to", group: "Body (parametric)", unit: "Hz", min: 2000, max: 16000, step: 100 },
489 { path: "body.densityScale", label: "Modal density", group: "Body (parametric)", min: 0.3, max: 3, step: 0.05 },
490 { path: "body.plateMass", label: "Plate mass", group: "Body (parametric)", unit: "kg", min: 0.2, max: 3, step: 0.01 },
491 { path: "body.plateArea", label: "Plate area", group: "Body (parametric)", unit: "m²", min: 0.2, max: 0.7, step: 0.01 },
492 { path: "body.lossFactor", label: "Loss @1 kHz", group: "Body (parametric)", min: 0.003, max: 0.08, log: true },
493 { path: "body.lossExp", label: "Loss exponent", group: "Body (parametric)", min: -0.5, max: 1, step: 0.05 },
494 { path: "body.lateralRatio", label: "Lateral coupling", group: "Body (parametric)", min: 0, max: 1.5, step: 0.05 },
495 { path: "body.bridgeF", label: "Bridge resonance", group: "Body (parametric)", unit: "Hz", min: 400, max: 4000, log: true },
496 { path: "body.bridgeQ", label: "Bridge Q", group: "Body (parametric)", min: 1, max: 20, step: 0.1 },
497 { path: "body.radCorner", label: "Rad. corner", group: "Body (parametric)", unit: "Hz", min: 200, max: 3000, log: true },
498 { path: "body.radScale", label: "Rad. scale", group: "Body (parametric)", min: 0.05, max: 3, log: true },
499 { path: "body.seed", label: "Seed", group: "Body (parametric)", min: 1, max: 999, step: 1 },
501 { path: "fe.bodyLength", label: "Body length", group: "Body (FE)", unit: "m", min: 0.9, max: 1.3, step: 0.005 },
502 { path: "fe.lowerBout", label: "Lower bout", group: "Body (FE)", unit: "m", min: 0.5, max: 0.8, step: 0.005 },
503 { path: "fe.middleBout", label: "Middle bout", group: "Body (FE)", unit: "m", min: 0.3, max: 0.5, step: 0.005 },
504 { path: "fe.upperBout", label: "Upper bout", group: "Body (FE)", unit: "m", min: 0.4, max: 0.65, step: 0.005 },
505 { path: "fe.ribDepth", label: "Rib depth", group: "Body (FE)", unit: "m", min: 0.12, max: 0.25, step: 0.005 },
506 { path: "fe.topThickness", label: "Top thickness", group: "Body (FE)", unit: "mm", scale: 1000, min: 0.0025, max: 0.008, step: 0.0001 },
507 { path: "fe.topArch", label: "Top arching", group: "Body (FE)", unit: "mm", scale: 1000, min: 0, max: 0.05, step: 0.001 },
508 { path: "fe.backThickness", label: "Back thickness", group: "Body (FE)", unit: "mm", scale: 1000, min: 0.0025, max: 0.008, step: 0.0001 },
509 { 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." },
510 { path: "fe.backBarHeight", label: "Back bar height", group: "Body (FE)", unit: "mm", scale: 1000, min: 0.005, max: 0.04, step: 0.001 },
511 { path: "fe.topEL", label: "Top E (grain)", group: "Body (FE)", unit: "GPa", scale: 1e-9, min: 6e9, max: 16e9, step: 1e8 },
512 { path: "fe.topER", label: "Top E (cross)", group: "Body (FE)", unit: "GPa", scale: 1e-9, min: 0.3e9, max: 1.5e9, step: 1e7 },
513 { path: "fe.topRho", label: "Top density", group: "Body (FE)", unit: "kg/m³", min: 300, max: 550, step: 5 },
514 { path: "fe.topLoss", label: "Top loss", group: "Body (FE)", min: 0.003, max: 0.05, log: true },
515 { path: "fe.backEL", label: "Back E (grain)", group: "Body (FE)", unit: "GPa", scale: 1e-9, min: 6e9, max: 16e9, step: 1e8 },
516 { path: "fe.backRho", label: "Back density", group: "Body (FE)", unit: "kg/m³", min: 450, max: 800, step: 5 },
517 { path: "fe.backLoss", label: "Back loss", group: "Body (FE)", min: 0.003, max: 0.05, log: true },
518 { path: "fe.barHeight", label: "Bass bar height", group: "Body (FE)", unit: "mm", scale: 1000, min: 0, max: 0.04, step: 0.001 },
519 { path: "fe.bridgePos", label: "Bridge position", group: "Body (FE)", min: 0.3, max: 0.55, step: 0.005 },
520 { path: "fe.bridgeHeight", label: "Bridge height", group: "Body (FE)", unit: "cm", scale: 100, min: 0.1, max: 0.2, step: 0.005 },
521 { path: "fe.bridgeK", label: "Bridge stiffness", group: "Body (FE)", unit: "N/m", min: 1e5, max: 1e7, log: true },
522 { path: "fe.postK", label: "Soundpost stiffness", group: "Body (FE)", unit: "N/m", min: 1e5, max: 1e8, log: true },
523 { path: "fe.fholeLength", label: "f-hole length", group: "Body (FE)", unit: "cm", scale: 100, min: 0.12, max: 0.3, step: 0.005 },
524 { path: "fe.fholeWidth", label: "f-hole width", group: "Body (FE)", unit: "mm", scale: 1000, min: 0.008, max: 0.03, step: 0.001 },
525 { path: "fe.rimRotK", label: "Rim rot. stiffness", group: "Body (FE)", unit: "N·m/rad/m", min: 0, max: 1000, step: 1 },
526 { path: "fe.cavityQ", label: "Cavity Q", group: "Body (FE)", min: 5, max: 200, log: true },
527 { path: "fe.gridH", label: "Grid spacing", group: "Body (FE)", unit: "mm", scale: 1000, min: 0.008, max: 0.04, step: 0.001 },
528 { path: "fe.fmax", label: "FE f max", group: "Body (FE)", unit: "Hz", min: 500, max: 5000, step: 50 },
530 { path: "output.micDistance", label: "Mic distance", group: "Output", unit: "m", min: 0.3, max: 5, step: 0.05 },
531 { 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." },
532 { 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." },
533 { path: "output.pickupLateral", label: "Pickup lateral", group: "Output", min: 0, max: 1, step: 0.01 },
534 { path: "output.pickupGainDb", label: "Pickup trim", group: "Output", unit: "dB", min: -30, max: 30, step: 0.5 },
535 { path: "output.gainDb", label: "Gain", group: "Output", unit: "dB", min: -40, max: 40, step: 0.5 },
537 { path: "sf2.step", label: "Sample step", group: "SF2", unit: "st", min: 1, max: 6, step: 1 },
538 { path: "sf2.count", label: "Sample count", group: "SF2", min: 2, max: 40, step: 1 },
539 { path: "sf2.lengthLow", label: "Length (low)", group: "SF2", unit: "s", min: 1, max: 10, step: 0.1 },
540 { path: "sf2.lengthHigh", label: "Length (high)", group: "SF2", unit: "s", min: 0.5, max: 8, step: 0.1 },
541 { 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." },
542 { path: "sf2.release", label: "Release", group: "SF2", unit: "s", min: 0.02, max: 2, log: true },
543 { path: "sf2.reverbSend", label: "Reverb send", group: "SF2", unit: "‰", min: 0, max: 1000, step: 10 },
544];
546export function getPath(obj: unknown, path: string): unknown {
547 let o = obj as Record<string, unknown>;
548 for (const k of path.split(".")) o = o[k] as Record<string, unknown>;
549 return o;
550}
552export function setPath(obj: unknown, path: string, value: unknown): void {
553 const ks = path.split(".");
554 let o = obj as Record<string, unknown>;
555 for (const k of ks.slice(0, -1)) o = o[k] as Record<string, unknown>;
556 o[ks[ks.length - 1]] = value;
557}