/ music / double-pendulum
Sign in
music / double-pendulum
double-pendulum / src / lab / protocol.ts
30 lines · 1.1 KBBlameHistoryRaw
1// Shared between the lab page and the pendulum-voice worklet.
3export const SIGNALS = ["x2", "y2", "vx2", "vy2", "x1", "vx1", "θ1", "θ2", "θ2−θ1", "ω1", "ω2", "p1", "p2", "speed2"] as const;
4export type Signal = (typeof SIGNALS)[number];
6export interface LabSettings {
7 mode: "strike" | "sustain" | "swell";
8 pitch: number; // Hz of the lower small-swing mode
9 energy: number; // normalized (E / E_top)
10 ringTime: number; // s (audio): amplitude falls 60 dB, without the energy controller
11 restrike: number; // s between strikes / swells (0 = once)
12 swellTime: number; // s
13 massRatio: number;
14 lengthRatio: number;
15 left: Signal;
16 right: Signal;
17 gain: number; // linear
18 dcCut: number; // Hz
19 follow: number; // sustain/swell: energy controller time constant, in periods of the lower mode
22export type LabMsg = { type: "settings"; s: LabSettings } | { type: "strike" };
24export interface LabSnap {
25 type: "snap";
26 energy: number;
27 phase: string;
28 trail: Float32Array; // recent bob positions [x1, y1, x2, y2, …] (pendulum units)
29 k: number; // sim seconds per audio second
↑↓ move↵openescclose