@hyperframes/core 0.7.106 → 0.7.108

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/audio/audioFxAutomation.d.ts +63 -0
  2. package/dist/audio/audioFxAutomation.d.ts.map +1 -0
  3. package/dist/audio/audioFxAutomation.js +219 -0
  4. package/dist/audio/audioFxAutomation.js.map +1 -0
  5. package/dist/audio/audioFxGraph.d.ts +73 -0
  6. package/dist/audio/audioFxGraph.d.ts.map +1 -0
  7. package/dist/audio/audioFxGraph.js +649 -0
  8. package/dist/audio/audioFxGraph.js.map +1 -0
  9. package/dist/audio/audioFxTail.d.ts +28 -0
  10. package/dist/audio/audioFxTail.d.ts.map +1 -0
  11. package/dist/audio/audioFxTail.js +95 -0
  12. package/dist/audio/audioFxTail.js.map +1 -0
  13. package/dist/audio/audioFxWorklets.d.ts +8 -0
  14. package/dist/audio/audioFxWorklets.d.ts.map +1 -0
  15. package/dist/audio/audioFxWorklets.js +263 -0
  16. package/dist/audio/audioFxWorklets.js.map +1 -0
  17. package/dist/audioAutomation.d.ts +191 -0
  18. package/dist/audioAutomation.d.ts.map +1 -0
  19. package/dist/audioAutomation.js +488 -0
  20. package/dist/audioAutomation.js.map +1 -0
  21. package/dist/audioCarve.d.ts +216 -0
  22. package/dist/audioCarve.d.ts.map +1 -0
  23. package/dist/audioCarve.js +608 -0
  24. package/dist/audioCarve.js.map +1 -0
  25. package/dist/audioFx.d.ts +182 -0
  26. package/dist/audioFx.d.ts.map +1 -0
  27. package/dist/audioFx.js +813 -0
  28. package/dist/audioFx.js.map +1 -0
  29. package/dist/audioFxCopy.d.ts +89 -0
  30. package/dist/audioFxCopy.d.ts.map +1 -0
  31. package/dist/audioFxCopy.js +340 -0
  32. package/dist/audioFxCopy.js.map +1 -0
  33. package/dist/audioFxEq.d.ts +75 -0
  34. package/dist/audioFxEq.d.ts.map +1 -0
  35. package/dist/audioFxEq.js +153 -0
  36. package/dist/audioFxEq.js.map +1 -0
  37. package/dist/audioFxJobs.d.ts +52 -0
  38. package/dist/audioFxJobs.d.ts.map +1 -0
  39. package/dist/audioFxJobs.js +92 -0
  40. package/dist/audioFxJobs.js.map +1 -0
  41. package/dist/audioFxPresets.d.ts +91 -0
  42. package/dist/audioFxPresets.d.ts.map +1 -0
  43. package/dist/audioFxPresets.js +320 -0
  44. package/dist/audioFxPresets.js.map +1 -0
  45. package/dist/audioFxProfiles.d.ts +65 -0
  46. package/dist/audioFxProfiles.d.ts.map +1 -0
  47. package/dist/audioFxProfiles.js +209 -0
  48. package/dist/audioFxProfiles.js.map +1 -0
  49. package/dist/audioLeveller.d.ts +62 -0
  50. package/dist/audioLeveller.d.ts.map +1 -0
  51. package/dist/audioLeveller.js +208 -0
  52. package/dist/audioLeveller.js.map +1 -0
  53. package/dist/canaryRegistry.d.ts.map +1 -1
  54. package/dist/canaryRegistry.js +8 -0
  55. package/dist/canaryRegistry.js.map +1 -1
  56. package/dist/compiler/compositionScoping.d.ts +3 -0
  57. package/dist/compiler/compositionScoping.d.ts.map +1 -1
  58. package/dist/compiler/compositionScoping.js +34 -11
  59. package/dist/compiler/compositionScoping.js.map +1 -1
  60. package/dist/compiler/htmlBundler.d.ts.map +1 -1
  61. package/dist/compiler/htmlBundler.js +42 -2
  62. package/dist/compiler/htmlBundler.js.map +1 -1
  63. package/dist/editing/affordances.d.ts +3 -0
  64. package/dist/editing/affordances.d.ts.map +1 -1
  65. package/dist/editing/affordances.js +1 -0
  66. package/dist/editing/affordances.js.map +1 -1
  67. package/dist/generated/audio-fx-runtime-inline.d.ts +3 -0
  68. package/dist/generated/audio-fx-runtime-inline.d.ts.map +1 -0
  69. package/dist/generated/audio-fx-runtime-inline.js +7 -0
  70. package/dist/generated/audio-fx-runtime-inline.js.map +1 -0
  71. package/dist/generated/runtime-inline.js +1 -1
  72. package/dist/generated/runtime-inline.js.map +1 -1
  73. package/dist/hyperframe.runtime.iife.js +238 -28
  74. package/dist/runtime/applyVariableBindings.d.ts +45 -0
  75. package/dist/runtime/applyVariableBindings.d.ts.map +1 -0
  76. package/dist/runtime/applyVariableBindings.js +194 -0
  77. package/dist/runtime/applyVariableBindings.js.map +1 -0
  78. package/dist/runtime/audioAutomationVolume.d.ts +17 -0
  79. package/dist/runtime/audioAutomationVolume.d.ts.map +1 -0
  80. package/dist/runtime/audioAutomationVolume.js +49 -0
  81. package/dist/runtime/audioAutomationVolume.js.map +1 -0
  82. package/dist/runtime/media.d.ts.map +1 -1
  83. package/dist/runtime/media.js +24 -2
  84. package/dist/runtime/media.js.map +1 -1
  85. package/dist/runtime/mediaVolumeEnvelope.d.ts +9 -2
  86. package/dist/runtime/mediaVolumeEnvelope.d.ts.map +1 -1
  87. package/dist/runtime/mediaVolumeEnvelope.js +13 -3
  88. package/dist/runtime/mediaVolumeEnvelope.js.map +1 -1
  89. package/dist/runtime/variableScope.d.ts +9 -0
  90. package/dist/runtime/variableScope.d.ts.map +1 -0
  91. package/dist/runtime/variableScope.js +21 -0
  92. package/dist/runtime/variableScope.js.map +1 -0
  93. package/dist/utils/richTextSanitize.d.ts +32 -0
  94. package/dist/utils/richTextSanitize.d.ts.map +1 -0
  95. package/dist/utils/richTextSanitize.js +227 -0
  96. package/dist/utils/richTextSanitize.js.map +1 -0
  97. package/package.json +55 -6
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audioAutomation.d.ts","sourceRoot":"","sources":["../src/audioAutomation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAElE,eAAO,MAAM,wBAAwB,oBAAoB,CAAC;AAE1D,4FAA4F;AAC5F,eAAO,MAAM,4BAA4B,QAAiD,CAAC;AAE3F,sFAAsF;AACtF,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,MAAM,WAAW,iBAAiB;IAChC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I,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAC1F,MAAM,CAIR;AAaD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,gBAAgB,EACtB,CAAC,EAAE,MAAM,EACT,KAAK,GAAE,QAAQ,GAAG,KAAgB,GACjC,MAAM,CAoBR;AAED,wFAAwF;AACxF,wBAAgB,cAAc,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAE9D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,gBAAgB,EACtB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,QAAQ,GAAG,KAAgB,GACjC,YAAY,CAQd"}
@@ -0,0 +1,488 @@
1
+ /**
2
+ * Automation envelopes for audio tracks.
3
+ *
4
+ * A lane is a list of breakpoints over one parameter — track volume, or one
5
+ * knob of one effect in the track's FX chain. Ableton's clip-envelope model:
6
+ * times are clip-local, so an envelope travels with the clip when it moves.
7
+ *
8
+ * Nothing here touches Web Audio. This module owns the format and the
9
+ * interpolation, and the same `sampleAutomationLane` is used to draw the lane
10
+ * in the timeline, to schedule it in preview, and to bake it at render — one
11
+ * curve, three consumers, or the picture and the sound disagree.
12
+ */
13
+ import { getAudioFxDef } from "./audioFx.js";
14
+ export const HF_AUDIO_AUTOMATION_ATTR = "data-automation";
15
+ /** The same attribute as a `dataset` / `dataAttributes` key. See `HF_AUDIO_FX_DATA_KEY`. */
16
+ export const HF_AUDIO_AUTOMATION_DATA_KEY = HF_AUDIO_AUTOMATION_ATTR.slice("data-".length);
17
+ /** Automation files are versioned; a reader must refuse a version it doesn't know. */
18
+ export const HF_AUDIO_AUTOMATION_VERSION = 1;
19
+ /**
20
+ * A pathological document should not be able to hang the scheduler, which
21
+ * expands every segment into scheduled ramps. Well past any hand-drawn
22
+ * envelope; a lane is dense at 100 points.
23
+ */
24
+ export const MAX_AUTOMATION_POINTS = 512;
25
+ export class AudioAutomationError extends Error {
26
+ constructor(message) {
27
+ super(message);
28
+ this.name = "AudioAutomationError";
29
+ }
30
+ }
31
+ export const VOLUME_TARGET = "volume";
32
+ /** Split a target string. Returns null for anything unrecognised. */
33
+ export function parseAutomationTarget(target) {
34
+ if (target === VOLUME_TARGET)
35
+ return { kind: "volume" };
36
+ const parts = target.split(".");
37
+ // `fx.preset.<id>` before the 3-part fx form, because it IS a 3-part fx form
38
+ // with a reserved node id — an effect can never be called "preset", since ids
39
+ // are minted `n1`, `n2`, ….
40
+ if (parts.length === 3 && parts[0] === "fx" && parts[1] === PRESET_TARGET_KEY) {
41
+ const presetId = parts[2];
42
+ return presetId ? { kind: "preset", presetId } : null;
43
+ }
44
+ if (parts.length !== 3 || parts[0] !== "fx")
45
+ return null;
46
+ const [, nodeId, param] = parts;
47
+ if (!nodeId || !param)
48
+ return null;
49
+ return { kind: "fx", nodeId, param };
50
+ }
51
+ export function fxAutomationTarget(nodeId, param) {
52
+ return `fx.${nodeId}.${param}`;
53
+ }
54
+ /** The reserved node-id slot that marks a whole-preset target. */
55
+ const PRESET_TARGET_KEY = "preset";
56
+ /**
57
+ * How much of a preset is applied, 0..1.
58
+ *
59
+ * A preset's nodes share no automatable parameter — and its worklet effects
60
+ * expose no AudioParams at all — so there is nothing to aim a lane at
61
+ * node-by-node. The graph wraps a preset's run in a wet/dry pair instead, and
62
+ * this drives the blend: 0 is the dry signal untouched, 1 is the preset fully
63
+ * applied, and between them it crossfades.
64
+ */
65
+ export function presetAutomationTarget(presetId) {
66
+ return `fx.${PRESET_TARGET_KEY}.${presetId}`;
67
+ }
68
+ /** 0..1 blend, the same shape as a wet/dry mix knob. */
69
+ export const PRESET_RANGE = {
70
+ min: 0,
71
+ max: 1,
72
+ step: 0.01,
73
+ unit: "",
74
+ label: "Amount",
75
+ scale: "linear",
76
+ default: 1,
77
+ };
78
+ export const VOLUME_RANGE = {
79
+ min: 0,
80
+ max: 1,
81
+ step: 0.01,
82
+ unit: "",
83
+ label: "Volume",
84
+ scale: "linear",
85
+ default: 1,
86
+ };
87
+ /**
88
+ * Resolve a lane's target against a chain. Returns null when the target names
89
+ * a node or parameter that is not there — the effect was deleted, or the
90
+ * parameter is an enum, which has no envelope between its values.
91
+ */
92
+ export function resolveAutomationRange(target, chain) {
93
+ const parsed = parseAutomationTarget(target);
94
+ if (!parsed)
95
+ return null;
96
+ if (parsed.kind === "volume")
97
+ return VOLUME_RANGE;
98
+ if (parsed.kind === "preset") {
99
+ // Only for a preset the chain actually carries, so a lane left behind by a
100
+ // removed preset resolves to nothing and is dropped at read time — the same
101
+ // contract an orphaned node lane has.
102
+ const present = chain?.nodes.some((n) => n.fromPreset === parsed.presetId);
103
+ return present ? { ...PRESET_RANGE, label: `${parsed.presetId} · Amount` } : null;
104
+ }
105
+ const node = chain?.nodes.find((n) => n.id === parsed.nodeId);
106
+ if (!node)
107
+ return null;
108
+ const def = getAudioFxDef(node.type);
109
+ const param = def?.params.find((p) => p.key === parsed.param);
110
+ if (!param || param.kind !== "number")
111
+ return null;
112
+ return {
113
+ min: param.min,
114
+ max: param.max,
115
+ step: param.step,
116
+ unit: param.unit,
117
+ label: `${def?.label ?? node.type} · ${param.label}`,
118
+ scale: param.scale === "log" && param.min > 0 ? "log" : "linear",
119
+ default: param.default,
120
+ };
121
+ }
122
+ /**
123
+ * Coerce a JSON field to a number, treating anything that is not already one —
124
+ * or a string that plainly reads as one — as absent.
125
+ *
126
+ * Not `Number(raw)`: that turns `null`, `""` and `[]` into 0, which for an
127
+ * envelope means a silent drop to zero rather than a point the reader rejects.
128
+ */
129
+ function numberOrNull(raw) {
130
+ if (typeof raw === "number")
131
+ return Number.isFinite(raw) ? raw : null;
132
+ if (typeof raw === "string" && raw.trim() !== "") {
133
+ const n = Number(raw);
134
+ return Number.isFinite(n) ? n : null;
135
+ }
136
+ return null;
137
+ }
138
+ function clampCurve(v) {
139
+ const n = numberOrNull(v);
140
+ if (n === null || n === 0)
141
+ return 0;
142
+ return Math.min(1, Math.max(-1, n));
143
+ }
144
+ /**
145
+ * A via point, or null when there isn't a usable one.
146
+ *
147
+ * Only two things disqualify one: a coordinate outside the segment, which names a
148
+ * point the curve does not travel through, and a point ON the straight line, which
149
+ * is a straight line — storing that would claim a bend the segment does not have.
150
+ *
151
+ * Depth is deliberately NOT limited. An earlier version held bends to a maximum
152
+ * slope so a segment could never leave a breakpoint steeply, and it was wrong twice
153
+ * over: it capped how far a curve could be pulled, and clamping the two coordinates
154
+ * separately could land a bend exactly on the straight line and flatten it mid-drag.
155
+ * A steep departure is a smooth curve doing what it was asked; what must never
156
+ * happen is a crease, and that is the sampler's job below, not a limit here.
157
+ */
158
+ function clampVia(rawX, rawY) {
159
+ const x = numberOrNull(rawX);
160
+ const y = numberOrNull(rawY);
161
+ if (x === null || y === null)
162
+ return null;
163
+ const inside = (n) => Math.min(0.999, Math.max(0.001, n));
164
+ const cx = inside(x);
165
+ const cy = inside(y);
166
+ if (Math.abs(cx - cy) < 1e-6)
167
+ return null;
168
+ return { x: cx, y: cy };
169
+ }
170
+ /**
171
+ * The via point a segment will actually be drawn with, given one that was asked
172
+ * for — pulled into the steady region, or null when it describes no bend.
173
+ *
174
+ * Exported so an editor can write what the model will honour rather than what the
175
+ * pointer happened to ask for. Without it a lane's attribute claims a shape the
176
+ * renderer quietly declines to draw, and the two only agree once the file makes a
177
+ * round trip.
178
+ */
179
+ export function steadyViaPoint(viaX, viaY) {
180
+ const via = clampVia(viaX, viaY);
181
+ return via ? { viaX: via.x, viaY: via.y } : null;
182
+ }
183
+ /**
184
+ * The shape fields a point carries, cleaned: whichever of `curve` and the via
185
+ * pair survive, each omitted when it describes nothing.
186
+ *
187
+ * The via pair is kept or dropped together. Half a via point says nothing, and
188
+ * letting one coordinate through would leave the segment's shape depending on
189
+ * which half survived a hand edit.
190
+ */
191
+ function shapeFields(p) {
192
+ const curve = clampCurve(p?.curve);
193
+ const via = clampVia(p?.viaX, p?.viaY);
194
+ return {
195
+ ...(curve ? { curve } : {}),
196
+ ...(via ? { viaX: via.x, viaY: via.y } : {}),
197
+ };
198
+ }
199
+ /**
200
+ * Clean one point, or reject it.
201
+ *
202
+ * A missing or non-finite value reaching an AudioParam silences the node for
203
+ * the rest of the render, so such a point is dropped rather than coerced.
204
+ */
205
+ function cleanPoint(p, range) {
206
+ const t = numberOrNull(p?.t);
207
+ const v = numberOrNull(p?.v);
208
+ if (t === null || v === null)
209
+ return null;
210
+ const clamped = range ? Math.min(range.max, Math.max(range.min, v)) : v;
211
+ return { t: Math.max(0, t), v: clamped, ...shapeFields(p) };
212
+ }
213
+ /**
214
+ * Order points, drop unusable ones, and collapse duplicate times.
215
+ *
216
+ * Later wins on a tie so that dragging a point onto another replaces it rather
217
+ * than leaving an invisible one underneath.
218
+ */
219
+ function normalizePoints(points, range) {
220
+ const clean = points
221
+ .map((p) => cleanPoint(p, range))
222
+ .filter((p) => p !== null)
223
+ .sort((a, b) => a.t - b.t);
224
+ const out = [];
225
+ for (const p of clean) {
226
+ if (out.length > 0 && out[out.length - 1].t === p.t)
227
+ out[out.length - 1] = p;
228
+ else
229
+ out.push(p);
230
+ }
231
+ return out.slice(0, MAX_AUTOMATION_POINTS);
232
+ }
233
+ /**
234
+ * Structural normalisation, with no knowledge of the chain: sort and clean the
235
+ * points of every lane and drop lanes that carry none. Range clamping and
236
+ * orphan removal need the chain and happen in `resolveAutomation`.
237
+ */
238
+ export function normalizeAutomation(automation) {
239
+ const lanes = [];
240
+ for (const lane of automation.lanes) {
241
+ if (!parseAutomationTarget(lane.target))
242
+ continue;
243
+ const range = lane.target === VOLUME_TARGET ? VOLUME_RANGE : null;
244
+ const points = normalizePoints(lane.points ?? [], range);
245
+ if (points.length > 0)
246
+ lanes.push({ target: lane.target, points });
247
+ }
248
+ return { version: HF_AUDIO_AUTOMATION_VERSION, lanes };
249
+ }
250
+ /**
251
+ * Bind automation to a chain: clamp each lane into its parameter's declared
252
+ * range and drop lanes whose target no longer exists.
253
+ *
254
+ * Dropping is deliberate. An envelope on a deleted effect has nothing to
255
+ * drive, and keeping it would silently reattach if an unrelated effect later
256
+ * took the same node id.
257
+ */
258
+ export function resolveAutomation(automation, chain) {
259
+ const lanes = [];
260
+ for (const lane of automation.lanes) {
261
+ const range = resolveAutomationRange(lane.target, chain);
262
+ if (!range)
263
+ continue;
264
+ const points = normalizePoints(lane.points, range);
265
+ if (points.length > 0)
266
+ lanes.push({ target: lane.target, points });
267
+ }
268
+ return { version: HF_AUDIO_AUTOMATION_VERSION, lanes };
269
+ }
270
+ /**
271
+ * Parse an automation attribute.
272
+ *
273
+ * Malformed input throws rather than being skipped, matching the chain reader:
274
+ * a track that quietly loses its envelope renders differently from the project
275
+ * the author saved, which is worse than refusing.
276
+ */
277
+ export function parseAutomation(json) {
278
+ let raw;
279
+ try {
280
+ raw = JSON.parse(json);
281
+ }
282
+ catch (err) {
283
+ throw new AudioAutomationError(`Automation is not valid JSON: ${err.message}`);
284
+ }
285
+ if (typeof raw !== "object" || raw === null) {
286
+ throw new AudioAutomationError("Automation must be a JSON object.");
287
+ }
288
+ const obj = raw;
289
+ if (obj.version !== HF_AUDIO_AUTOMATION_VERSION) {
290
+ throw new AudioAutomationError(`Unsupported automation version: ${String(obj.version)}`);
291
+ }
292
+ if (!Array.isArray(obj.lanes)) {
293
+ throw new AudioAutomationError("Automation is missing a `lanes` array.");
294
+ }
295
+ const lanes = obj.lanes.map((l, i) => {
296
+ if (typeof l !== "object" || l === null) {
297
+ throw new AudioAutomationError(`Lane ${i} is not an object.`);
298
+ }
299
+ const lane = l;
300
+ if (typeof lane.target !== "string" || !parseAutomationTarget(lane.target)) {
301
+ throw new AudioAutomationError(`Lane ${i} has an unreadable target: ${String(lane.target)}`);
302
+ }
303
+ if (!Array.isArray(lane.points)) {
304
+ throw new AudioAutomationError(`Lane ${i} is missing a \`points\` array.`);
305
+ }
306
+ return { target: lane.target, points: lane.points };
307
+ });
308
+ return normalizeAutomation({ version: HF_AUDIO_AUTOMATION_VERSION, lanes });
309
+ }
310
+ /** Serialise for the `data-automation` attribute. */
311
+ export function serializeAutomation(automation) {
312
+ return JSON.stringify({
313
+ version: HF_AUDIO_AUTOMATION_VERSION,
314
+ lanes: automation.lanes.map((lane) => ({
315
+ target: lane.target,
316
+ points: lane.points.map((p) => ({
317
+ t: p.t,
318
+ v: p.v,
319
+ ...(p.curve ? { curve: p.curve } : {}),
320
+ ...(p.viaX !== undefined && p.viaY !== undefined ? { viaX: p.viaX, viaY: p.viaY } : {}),
321
+ })),
322
+ })),
323
+ });
324
+ }
325
+ /**
326
+ * Shape the 0..1 progress across a segment.
327
+ *
328
+ * `curve` is an exponent in disguise: 0 is linear, and the ends reach a
329
+ * quarter-power and a fourth-power bend, which is about the range a DAW's
330
+ * envelope handle covers before the segment stops reading as a curve.
331
+ */
332
+ export function applyCurve(x, curve) {
333
+ if (!curve)
334
+ return x;
335
+ return Math.pow(x, Math.pow(2, 2 * curve));
336
+ }
337
+ /**
338
+ * The conic that carries a segment through its via point: control point and weight
339
+ * of a rational quadratic Bezier from (0,0) to (1,1).
340
+ *
341
+ * A rational quadratic at its own midparameter is `(P0 + 2wC + P1) / (2 + 2w)`, so
342
+ * demanding that equal the via point `Q` fixes the control point for any weight:
343
+ * `C = Q + (Q - M) / w`, with `M` the straight midpoint. The curve therefore passes
344
+ * exactly through `Q` whatever the weight, and — because it does so at the
345
+ * midparameter, with the two halves symmetric in parameter — its furthest departure
346
+ * from the straight line is at `Q` too. The pointer is the apex, by construction.
347
+ *
348
+ * The weight is what buys reach. A plain quadratic (`w = 1`) needs its control point
349
+ * at `2Q - M`, which leaves the segment as soon as `Q` is past the middle half — so
350
+ * a plain quadratic simply cannot pass through a deep or off-centre point. Raising
351
+ * the weight draws the control point back toward `Q`, so take the smallest weight
352
+ * that keeps `C` inside the segment: inside is what makes progress monotone, and
353
+ * smallest-that-fits is the broadest curve available through that point.
354
+ *
355
+ * Deep bends therefore come out tight and steep near the breakpoint they lean on.
356
+ * That is the shape being asked for, and it stays a single smooth arc while doing
357
+ * it — no join, no inflection, no crease.
358
+ */
359
+ function viaConic(viaX, viaY) {
360
+ const dx = viaX - 0.5;
361
+ const dy = viaY - 0.5;
362
+ const edge = 0.999;
363
+ // Per axis, `C` stays inside when the weight is at least the pull divided by the
364
+ // room left in the pull's own direction. A via point clamped to `edge` itself
365
+ // leaves zero room — `edge - viaX` is exactly 0 — which would divide out to
366
+ // Infinity and carry NaN into every downstream sample. Capped rather than left
367
+ // unbounded: past this weight the arc already reads as touching the via point,
368
+ // so the cap costs no visible reach.
369
+ const MAX_WEIGHT = 1e6;
370
+ const needX = dx > 0 ? dx / (edge - viaX) : dx < 0 ? -dx / (viaX - (1 - edge)) : 0;
371
+ const needY = dy > 0 ? dy / (edge - viaY) : dy < 0 ? -dy / (viaY - (1 - edge)) : 0;
372
+ const w = Math.min(MAX_WEIGHT, Math.max(1, needX, needY));
373
+ return { cx: viaX + dx / w, cy: viaY + dy / w, w };
374
+ }
375
+ /**
376
+ * Progress through a segment that passes through its via point: one conic arc, from
377
+ * breakpoint to breakpoint.
378
+ *
379
+ * One curve, not two joined at the via point, because anything joined there can only
380
+ * be as smooth as the join — and keeping such a join monotone forces its tangent
381
+ * down to a fraction of the slope the curve arrives with, creasing the segment
382
+ * exactly where the pointer is. A conic has no join and no inflection: its slope
383
+ * moves one way from end to end, which is what makes it read as one curve rather
384
+ * than a shape with features in it.
385
+ */
386
+ function shapeVia(x, viaX, viaY) {
387
+ const { cx, cy, w } = viaConic(viaX, viaY);
388
+ // Both coordinates are quadratics over one shared denominator, so `x(t) = x`
389
+ // rearranges into an ordinary quadratic in `t`: closed form, and the same answer on
390
+ // every machine, which a render that has to match its own preview depends on.
391
+ const spread = 2 - 2 * w;
392
+ const a = x * spread - 1 + 2 * w * cx;
393
+ const b = -x * spread - 2 * w * cx;
394
+ const t = conicParam(a, b, x);
395
+ const rest = 1 - t;
396
+ const denominator = rest * rest + 2 * w * t * rest + t * t;
397
+ if (!(denominator > 0))
398
+ return x;
399
+ return (2 * w * cy * t * rest + t * t) / denominator;
400
+ }
401
+ /** The root of `a*t^2 + b*t + c` that lies on the arc the segment travels. */
402
+ function conicParam(a, b, c) {
403
+ if (Math.abs(a) < 1e-12)
404
+ return Math.abs(b) < 1e-12 ? c : -c / b;
405
+ const root = Math.sqrt(Math.max(0, b * b - 4 * a * c));
406
+ const first = (-b + root) / (2 * a);
407
+ const second = (-b - root) / (2 * a);
408
+ const onArc = (t) => t >= -1e-9 && t <= 1 + 1e-9;
409
+ if (onArc(first))
410
+ return Math.min(1, Math.max(0, first));
411
+ if (onArc(second))
412
+ return Math.min(1, Math.max(0, second));
413
+ return c;
414
+ }
415
+ /**
416
+ * The progress a segment leaving `point` has reached at normalised `x`.
417
+ *
418
+ * A via point wins when it is there, since it says strictly more than an
419
+ * exponent can. Everything authored before via points existed carries only
420
+ * `curve` and takes the exponent path unchanged.
421
+ */
422
+ export function shapeProgress(x, point) {
423
+ const via = clampVia(point.viaX, point.viaY);
424
+ if (via)
425
+ return shapeVia(Math.min(1, Math.max(0, x)), via.x, via.y);
426
+ return applyCurve(x, point.curve);
427
+ }
428
+ function lerpValue(a, b, x, scale) {
429
+ // A frequency sweep interpolated linearly spends almost all its time in the
430
+ // top octave. Log-scaled parameters interpolate in log space so a 200 Hz to
431
+ // 8 kHz move sounds like an even sweep, which is what the knob's own scale
432
+ // already promises.
433
+ if (scale === "log" && a > 0 && b > 0) {
434
+ return Math.exp(Math.log(a) + (Math.log(b) - Math.log(a)) * x);
435
+ }
436
+ return a + (b - a) * x;
437
+ }
438
+ /**
439
+ * Value of a lane at a clip-local time.
440
+ *
441
+ * Outside the points, the envelope holds — the first value before it starts
442
+ * and the last value after it ends, so a lane never snaps to zero at the edges.
443
+ */
444
+ export function sampleAutomationLane(lane, t, scale = "linear") {
445
+ const pts = lane.points;
446
+ if (pts.length === 0)
447
+ return 0;
448
+ const first = pts[0];
449
+ if (t <= first.t)
450
+ return first.v;
451
+ const last = pts[pts.length - 1];
452
+ if (t >= last.t)
453
+ return last.v;
454
+ let lo = 0;
455
+ let hi = pts.length - 1;
456
+ while (hi - lo > 1) {
457
+ const mid = (lo + hi) >> 1;
458
+ if (pts[mid].t <= t)
459
+ lo = mid;
460
+ else
461
+ hi = mid;
462
+ }
463
+ const a = pts[lo];
464
+ const b = pts[hi];
465
+ const span = b.t - a.t;
466
+ if (span <= 0)
467
+ return b.v;
468
+ return lerpValue(a.v, b.v, shapeProgress((t - a.t) / span, a), scale);
469
+ }
470
+ /** True when the lane is a single value, i.e. worth setting once and not scheduling. */
471
+ export function isConstantLane(lane) {
472
+ return lane.points.length <= 1 || lane.points.every((p) => p.v === lane.points[0].v);
473
+ }
474
+ /**
475
+ * Sample a lane onto evenly spaced times, for consumers that want a plain
476
+ * curve rather than a breakpoint list: `setValueCurveAtTime`, the render-side
477
+ * volume envelope, and the lane's own drawing code.
478
+ */
479
+ export function sampleAutomationCurve(lane, from, to, count, scale = "linear") {
480
+ const n = Math.max(2, Math.floor(count));
481
+ const out = new Float32Array(n);
482
+ const span = to - from;
483
+ for (let i = 0; i < n; i += 1) {
484
+ out[i] = sampleAutomationLane(lane, from + (span * i) / (n - 1), scale);
485
+ }
486
+ return out;
487
+ }
488
+ //# sourceMappingURL=audioAutomation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audioAutomation.js","sourceRoot":"","sources":["../src/audioAutomation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,aAAa,EAAuB,MAAM,cAAc,CAAC;AAElE,MAAM,CAAC,MAAM,wBAAwB,GAAG,iBAAiB,CAAC;AAE1D,4FAA4F;AAC5F,MAAM,CAAC,MAAM,4BAA4B,GAAG,wBAAwB,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAE3F,sFAAsF;AACtF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAE7C;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GA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