@hyperframes/core 0.7.107 → 0.7.109

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 (89) 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 +17 -1
  84. package/dist/runtime/media.js.map +1 -1
  85. package/dist/runtime/variableScope.d.ts +9 -0
  86. package/dist/runtime/variableScope.d.ts.map +1 -0
  87. package/dist/runtime/variableScope.js +21 -0
  88. package/dist/runtime/variableScope.js.map +1 -0
  89. package/package.json +51 -6
@@ -0,0 +1,182 @@
1
+ /**
2
+ * Audio FX chain: the one description of every effect that can be applied to an
3
+ * audio track.
4
+ *
5
+ * Preview and render both run the same Web Audio graph — the studio in a live
6
+ * AudioContext, the engine in an OfflineAudioContext inside the headless
7
+ * browser it already drives. There is only one implementation of each effect,
8
+ * so preview predicting the render is a property of the architecture rather
9
+ * than something to measure and defend.
10
+ *
11
+ * This file holds what both ends need to agree on: the parameter set for each
12
+ * effect with its usable range, and the id of the graph builder that realises
13
+ * it. Parameters are declared in the units a person thinks in (dB, ms, Hz);
14
+ * the graph builders convert where the Web Audio node wants something else.
15
+ */
16
+ export declare const HF_AUDIO_FX_ATTR = "data-fx-chain";
17
+ /**
18
+ * The same attribute as a `dataset` / `dataAttributes` key — the `data-` prefix
19
+ * is not part of that spelling.
20
+ *
21
+ * Derived rather than restated: the studio writes through
22
+ * `HF_AUDIO_FX_ATTR` and reads through the key, so a hardcoded `"fx-chain"`
23
+ * on the read side is a rename waiting to half-land.
24
+ */
25
+ export declare const HF_AUDIO_FX_DATA_KEY: string;
26
+ /** Chain files are versioned; a reader must refuse a version it doesn't know. */
27
+ export declare const HF_AUDIO_FX_CHAIN_VERSION = 1;
28
+ export type HfAudioFxGroup = "filter" | "dynamics" | "nonlinear" | "time";
29
+ export interface HfAudioFxNumberParam {
30
+ kind: "number";
31
+ key: string;
32
+ label: string;
33
+ /** Shown after the value in the panel; "" for a bare ratio. */
34
+ unit: string;
35
+ min: number;
36
+ max: number;
37
+ step: number;
38
+ default: number;
39
+ /** Frequency-style controls need a log knob to be usable. */
40
+ scale?: "linear" | "log";
41
+ /**
42
+ * The knob is backed by an AudioParam, so an automation lane can drive it.
43
+ *
44
+ * Not every knob can be: a WaveShaper curve, a convolution impulse and a
45
+ * worklet's `processorOptions` are all set wholesale rather than scheduled.
46
+ * A graph builder must expose an AudioParam for every parameter flagged here
47
+ * — `audioFxGraph.test.ts` builds each effect and checks it.
48
+ */
49
+ automatable?: boolean;
50
+ /** One line explaining what turning this does, shown on the control. */
51
+ hint?: string;
52
+ }
53
+ export interface HfAudioFxEnumParam {
54
+ kind: "enum";
55
+ key: string;
56
+ label: string;
57
+ options: readonly {
58
+ value: string;
59
+ label: string;
60
+ }[];
61
+ default: string;
62
+ hint?: string;
63
+ }
64
+ export type HfAudioFxParam = HfAudioFxNumberParam | HfAudioFxEnumParam;
65
+ export type HfAudioFxParamValues = Record<string, number | string>;
66
+ export interface HfAudioFxDef {
67
+ id: string;
68
+ label: string;
69
+ group: HfAudioFxGroup;
70
+ /** One sentence on what the effect is for, shown when adding it. */
71
+ description: string;
72
+ params: readonly HfAudioFxParam[];
73
+ /**
74
+ * Identifier for the Web Audio graph builder that realises this effect. Kept
75
+ * as a string rather than a function so this module stays free of browser
76
+ * globals and can be imported by the engine and the linter.
77
+ */
78
+ web: string;
79
+ }
80
+ /**
81
+ * Every effect, in panel order. Ranges are the usable span for each control;
82
+ * a value that survives `normalizeAudioFxParams` is always safe to realise.
83
+ */
84
+ export declare const HF_AUDIO_FX: readonly HfAudioFxDef[];
85
+ export declare function getAudioFxDef(id: string): HfAudioFxDef | undefined;
86
+ export declare const HF_AUDIO_FX_IDS: readonly string[];
87
+ /** Every parameter at its declared default, ready to seed a freshly added effect. */
88
+ export declare function defaultAudioFxParams(id: string): HfAudioFxParamValues;
89
+ /**
90
+ * Clamp and fill a parameter set so it is always renderable: unknown keys are
91
+ * dropped, missing keys take their default, numbers are clamped into their
92
+ * declared range, and an unrecognised enum value falls back to its default.
93
+ * A non-finite number is treated as missing rather than passed through, since
94
+ * NaN reaching an AudioParam silences the node for the rest of the render.
95
+ */
96
+ export declare function normalizeAudioFxParams(id: string, values: Readonly<HfAudioFxParamValues> | undefined): HfAudioFxParamValues;
97
+ export interface HfAudioFxNode {
98
+ /** Effect id from HF_AUDIO_FX. */
99
+ type: string;
100
+ /**
101
+ * Stable handle for this node within its chain, minted when the node is
102
+ * added. Automation lanes address nodes by id (`fx.<id>.<param>`) so that
103
+ * reordering the chain never re-points a lane at a different effect. Older
104
+ * chains have no ids; they load fine and simply cannot be automated until
105
+ * the panel touches them.
106
+ */
107
+ id?: string;
108
+ /** Set on nodes the carve analysis generated, so re-running replaces them
109
+ * instead of stacking another set on top of hand-added effects. */
110
+ fromCarve?: boolean;
111
+ /**
112
+ * Id of the preset that wrote this node, for the same reason `fromCarve`
113
+ * exists: re-applying a preset replaces its own nodes rather than adding a
114
+ * second copy, and the rack can brace them together under the preset's name.
115
+ *
116
+ * The id rather than a flag, because a chain can carry more than one preset
117
+ * and each has to be able to find its own.
118
+ */
119
+ fromPreset?: string;
120
+ /**
121
+ * What the rack calls this node, when the effect's own name is not specific
122
+ * enough to be useful.
123
+ *
124
+ * A peaking filter is "Shape One Range" wherever it appears, so a chain that
125
+ * cuts mud at 250 Hz and lifts clarity at 3 kHz shows the same words twice
126
+ * and an author cannot tell the two apart. A preset names each node for the
127
+ * JOB it is doing instead — "Reduce Mud", "Add Clarity" — and the rack reads
128
+ * as a list of things that were done rather than a list of filter types.
129
+ */
130
+ label?: string;
131
+ /**
132
+ * Id of the multi-band EQ that owns this node, when it is one of its bands.
133
+ *
134
+ * Same device as `fromCarve`: the module gathers its own nodes out of the
135
+ * chain and presents them as one control surface, so an EQ needs no new
136
+ * effect type and its bands stay ordinary filters underneath.
137
+ */
138
+ fromEq?: string;
139
+ /**
140
+ * How much of this node's preset is applied, 0..1 — the wet/dry blend the
141
+ * graph wraps its run in.
142
+ *
143
+ * On every node of the run rather than beside the chain, because the chain has
144
+ * nowhere else to put it: `HfAudioFxChain` is a version and a list of nodes,
145
+ * and a preset is defined by which nodes carry its tag. The graph reads it off
146
+ * the first node of each run. Absent means fully applied, which is what every
147
+ * chain written before this means.
148
+ */
149
+ presetAmount?: number;
150
+ /**
151
+ * Set on the gain stage the leveller writes, so re-running replaces it rather
152
+ * than stacking a second one — the same contract `fromCarve` has.
153
+ */
154
+ fromLeveller?: boolean;
155
+ /** Absent means enabled — chain files written before the field existed still load. */
156
+ enabled?: boolean;
157
+ params?: HfAudioFxParamValues;
158
+ }
159
+ export interface HfAudioFxChain {
160
+ version: number;
161
+ nodes: HfAudioFxNode[];
162
+ }
163
+ export declare class AudioFxChainError extends Error {
164
+ constructor(message: string);
165
+ }
166
+ /**
167
+ * Parse a chain file. Unknown effect ids are rejected rather than skipped: a
168
+ * chain that silently loses a node would render differently from the project
169
+ * the author saved, which is worse than refusing to render at all.
170
+ */
171
+ export declare function parseAudioFxChain(json: string): HfAudioFxChain;
172
+ /** The nodes that should process audio, in order. */
173
+ export declare function enabledAudioFxNodes(chain: HfAudioFxChain): HfAudioFxNode[];
174
+ /** Serialise a chain for the `data-fx-chain` attribute. */
175
+ export declare function serializeAudioFxChain(chain: HfAudioFxChain): string;
176
+ /**
177
+ * Next free node id for a chain, as `n1`, `n2`, … — counted rather than random
178
+ * so that adding an effect produces the same document on every machine, which
179
+ * compositions require.
180
+ */
181
+ export declare function mintAudioFxNodeId(chain: HfAudioFxChain): string;
182
+ //# sourceMappingURL=audioFx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audioFx.d.ts","sourceRoot":"","sources":["../src/audioFx.ts"],"names":[],"m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