@codexo/exojs-audio-fx 0.18.0 → 0.19.1

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 (109) hide show
  1. package/README.md +47 -7
  2. package/dist/esm/AudioAnalyser.d.ts +6 -8
  3. package/dist/esm/AudioAnalyser.d.ts.map +1 -1
  4. package/dist/esm/AudioAnalyser.js +6 -80
  5. package/dist/esm/AudioAnalyser.js.map +1 -1
  6. package/dist/esm/AudioTap.d.ts +33 -0
  7. package/dist/esm/AudioTap.d.ts.map +1 -0
  8. package/dist/esm/AudioTap.js +126 -0
  9. package/dist/esm/AudioTap.js.map +1 -0
  10. package/dist/esm/BeatDetector.d.ts +14 -9
  11. package/dist/esm/BeatDetector.d.ts.map +1 -1
  12. package/dist/esm/BeatDetector.js +30 -84
  13. package/dist/esm/BeatDetector.js.map +1 -1
  14. package/dist/esm/PcmStreamSource.d.ts +132 -0
  15. package/dist/esm/PcmStreamSource.d.ts.map +1 -0
  16. package/dist/esm/PcmStreamSource.js +313 -0
  17. package/dist/esm/PcmStreamSource.js.map +1 -0
  18. package/dist/esm/ReadyGate.d.ts +25 -0
  19. package/dist/esm/ReadyGate.d.ts.map +1 -0
  20. package/dist/esm/ReadyGate.js +69 -0
  21. package/dist/esm/ReadyGate.js.map +1 -0
  22. package/dist/esm/dsp/fft.d.ts.map +1 -1
  23. package/dist/esm/dsp/mel.d.ts.map +1 -1
  24. package/dist/esm/dsp/tempogram.d.ts.map +1 -1
  25. package/dist/esm/effects/AutoWahEffect.d.ts +0 -1
  26. package/dist/esm/effects/AutoWahEffect.d.ts.map +1 -1
  27. package/dist/esm/effects/AutoWahEffect.js +3 -8
  28. package/dist/esm/effects/AutoWahEffect.js.map +1 -1
  29. package/dist/esm/effects/BitCrusherEffect.d.ts.map +1 -1
  30. package/dist/esm/effects/ChorusEffect.d.ts +11 -5
  31. package/dist/esm/effects/ChorusEffect.d.ts.map +1 -1
  32. package/dist/esm/effects/ChorusEffect.js +19 -16
  33. package/dist/esm/effects/ChorusEffect.js.map +1 -1
  34. package/dist/esm/effects/CompressorEffect.d.ts +0 -1
  35. package/dist/esm/effects/CompressorEffect.d.ts.map +1 -1
  36. package/dist/esm/effects/CompressorEffect.js +3 -8
  37. package/dist/esm/effects/CompressorEffect.js.map +1 -1
  38. package/dist/esm/effects/ConvolutionEffect.d.ts +0 -1
  39. package/dist/esm/effects/ConvolutionEffect.d.ts.map +1 -1
  40. package/dist/esm/effects/ConvolutionEffect.js +3 -8
  41. package/dist/esm/effects/ConvolutionEffect.js.map +1 -1
  42. package/dist/esm/effects/DelayEffect.d.ts +0 -1
  43. package/dist/esm/effects/DelayEffect.d.ts.map +1 -1
  44. package/dist/esm/effects/DelayEffect.js +3 -8
  45. package/dist/esm/effects/DelayEffect.js.map +1 -1
  46. package/dist/esm/effects/DistortionEffect.d.ts +9 -13
  47. package/dist/esm/effects/DistortionEffect.d.ts.map +1 -1
  48. package/dist/esm/effects/DistortionEffect.js +11 -16
  49. package/dist/esm/effects/DistortionEffect.js.map +1 -1
  50. package/dist/esm/effects/DuckingEffect.d.ts.map +1 -1
  51. package/dist/esm/effects/DuckingEffect.js +1 -7
  52. package/dist/esm/effects/DuckingEffect.js.map +1 -1
  53. package/dist/esm/effects/EqualizerEffect.d.ts +0 -1
  54. package/dist/esm/effects/EqualizerEffect.d.ts.map +1 -1
  55. package/dist/esm/effects/EqualizerEffect.js +3 -8
  56. package/dist/esm/effects/EqualizerEffect.js.map +1 -1
  57. package/dist/esm/effects/FlangerEffect.d.ts +12 -4
  58. package/dist/esm/effects/FlangerEffect.d.ts.map +1 -1
  59. package/dist/esm/effects/FlangerEffect.js +17 -15
  60. package/dist/esm/effects/FlangerEffect.js.map +1 -1
  61. package/dist/esm/effects/GranularEffect.d.ts.map +1 -1
  62. package/dist/esm/effects/LimiterEffect.d.ts +12 -8
  63. package/dist/esm/effects/LimiterEffect.d.ts.map +1 -1
  64. package/dist/esm/effects/LimiterEffect.js +12 -13
  65. package/dist/esm/effects/LimiterEffect.js.map +1 -1
  66. package/dist/esm/effects/PhaserEffect.d.ts +0 -1
  67. package/dist/esm/effects/PhaserEffect.d.ts.map +1 -1
  68. package/dist/esm/effects/PhaserEffect.js +3 -8
  69. package/dist/esm/effects/PhaserEffect.js.map +1 -1
  70. package/dist/esm/effects/PingPongDelayEffect.d.ts +0 -1
  71. package/dist/esm/effects/PingPongDelayEffect.d.ts.map +1 -1
  72. package/dist/esm/effects/PingPongDelayEffect.js +3 -8
  73. package/dist/esm/effects/PingPongDelayEffect.js.map +1 -1
  74. package/dist/esm/effects/PitchShiftEffect.d.ts.map +1 -1
  75. package/dist/esm/effects/ReverbEffect.d.ts +0 -1
  76. package/dist/esm/effects/ReverbEffect.d.ts.map +1 -1
  77. package/dist/esm/effects/ReverbEffect.js +3 -8
  78. package/dist/esm/effects/ReverbEffect.js.map +1 -1
  79. package/dist/esm/effects/RingModulatorEffect.d.ts +0 -1
  80. package/dist/esm/effects/RingModulatorEffect.d.ts.map +1 -1
  81. package/dist/esm/effects/RingModulatorEffect.js +3 -8
  82. package/dist/esm/effects/RingModulatorEffect.js.map +1 -1
  83. package/dist/esm/effects/TremoloEffect.d.ts +12 -15
  84. package/dist/esm/effects/TremoloEffect.d.ts.map +1 -1
  85. package/dist/esm/effects/TremoloEffect.js +15 -20
  86. package/dist/esm/effects/TremoloEffect.js.map +1 -1
  87. package/dist/esm/effects/VocoderEffect.d.ts.map +1 -1
  88. package/dist/esm/effects/VocoderEffect.js +2 -7
  89. package/dist/esm/effects/VocoderEffect.js.map +1 -1
  90. package/dist/esm/index.d.ts +1 -0
  91. package/dist/esm/index.d.ts.map +1 -1
  92. package/dist/esm/index.js +2 -1
  93. package/dist/esm/worklets/beat-detector.worklet.js +1 -1
  94. package/dist/esm/worklets/beat-detector.worklet.js.map +1 -1
  95. package/dist/esm/worklets/bit-crusher.worklet.js +1 -1
  96. package/dist/esm/worklets/bit-crusher.worklet.js.map +1 -1
  97. package/dist/esm/worklets/disposable-processor.d.ts +13 -0
  98. package/dist/esm/worklets/disposable-processor.d.ts.map +1 -0
  99. package/dist/esm/worklets/ducking.worklet.js +1 -1
  100. package/dist/esm/worklets/ducking.worklet.js.map +1 -1
  101. package/dist/esm/worklets/granular.worklet.js +1 -1
  102. package/dist/esm/worklets/granular.worklet.js.map +1 -1
  103. package/dist/esm/worklets/pcm-stream.worklet.js +6 -0
  104. package/dist/esm/worklets/pcm-stream.worklet.js.map +1 -0
  105. package/dist/esm/worklets/pitch-shift.worklet.js +1 -1
  106. package/dist/esm/worklets/pitch-shift.worklet.js.map +1 -1
  107. package/dist/esm/worklets/vocoder.worklet.js +1 -1
  108. package/dist/esm/worklets/vocoder.worklet.js.map +1 -1
  109. package/package.json +5 -5
@@ -0,0 +1,313 @@
1
+ import pcm_stream_worklet_default from "./worklets/pcm-stream.worklet.js";
2
+ import { Signal, getAudioContext, registerAudioWorkletProcessor } from "@codexo/exojs";
3
+
4
+ //#region src/PcmStreamSource.ts
5
+ /**
6
+ * A bounded, externally fed Float32 PCM source at the shared AudioContext's
7
+ * sample rate. Lives in `@codexo/exojs-audio-fx`; no extension registration is
8
+ * required. Feed a bus or connect {@link output} to an analysis tap.
9
+ *
10
+ * Await {@link ready}, enqueue a caller-chosen amount of audio, then call
11
+ * {@link start}. The worklet consumes FIFO samples without waiting for the
12
+ * producer. An empty running queue emits silence; later blocks resume at the
13
+ * next available render quantum, without catching up or skipping samples.
14
+ * Browser suspension freezes the audio clock and playback, but writes remain
15
+ * bounded. Readiness does not unlock browser autoplay.
16
+ *
17
+ * Input arrays are copied synchronously and never detached. The private copy
18
+ * is transferred without requiring cross-origin isolation. Values must be
19
+ * finite; nominal full scale is -1..1, with no clipping or normalization here.
20
+ * Resampling, producer timestamps and audiovisual lookahead belong to callers.
21
+ *
22
+ * Own and destroy the source separately from its bus, for example with a scene
23
+ * DestroyScope. Destroying an AudioSystem or bus does not destroy this source.
24
+ */
25
+ var PcmStreamSource = class {
26
+ channels;
27
+ capacityFrames;
28
+ sampleRate;
29
+ /** Resolves after module loading, even while audio is suspended. Rejects on loading failure or destruction during loading (`AbortError`). */
30
+ ready;
31
+ /** Fires once after close has drained, not on destroy or failure. */
32
+ onEnd = new Signal();
33
+ /** Reports module loading, processor or context closure failures. The source is terminal afterwards. */
34
+ onError = new Signal();
35
+ /**
36
+ * Stable source tap for Web Audio interop; routing through a bus needs no
37
+ * access to it. Bus routing changes preserve caller-created connections;
38
+ * terminal cleanup disconnects it.
39
+ * @advanced
40
+ */
41
+ output;
42
+ _context;
43
+ _state = "loading";
44
+ _node = null;
45
+ _bus = null;
46
+ _busNode = null;
47
+ _cancelBusSetup = null;
48
+ _submittedFrames = 0;
49
+ _highWaterFrames = 0;
50
+ _releasedFrames = 0;
51
+ _playedFrames = 0;
52
+ _underrunFrames = 0;
53
+ _underruns = 0;
54
+ _overflowCount = 0;
55
+ _droppedFrames = 0;
56
+ _clearing = false;
57
+ _resolveReady;
58
+ _rejectReady;
59
+ _onContextState = () => {
60
+ if (this._context.state === "closed" && !this._terminal) this._fail(/* @__PURE__ */ new Error("PcmStreamSource: the audio context was closed."));
61
+ };
62
+ constructor(options) {
63
+ const capacity = options.capacityFrames ?? 8192;
64
+ if (options.channels !== 1 && options.channels !== 2) throw new RangeError("PcmStreamSource requires one or two channels.");
65
+ if (!Number.isInteger(capacity) || capacity < 1 || capacity > 1048576) throw new RangeError("PcmStreamSource capacityFrames must be an integer from 1 to 1048576.");
66
+ this.channels = options.channels;
67
+ this.capacityFrames = capacity;
68
+ this._context = getAudioContext();
69
+ this.sampleRate = this._context.sampleRate;
70
+ this.output = this._context.createGain();
71
+ this.ready = new Promise((resolve, reject) => {
72
+ this._resolveReady = resolve;
73
+ this._rejectReady = reject;
74
+ });
75
+ this.ready.catch(() => {});
76
+ this.bus = options.bus ?? null;
77
+ this._context.addEventListener?.("statechange", this._onContextState);
78
+ if (this._context.state === "closed") this._onContextState();
79
+ else this._load();
80
+ }
81
+ get state() {
82
+ return this._state;
83
+ }
84
+ /** Conservative occupancy: submitted frames minus acknowledged consumed/discarded frames. May lag playback while messages are in flight. */
85
+ get bufferedFrames() {
86
+ return this._submittedFrames - this._releasedFrames;
87
+ }
88
+ /** Queue occupancy in seconds, excluding output-device latency. */
89
+ get bufferedSeconds() {
90
+ return this.bufferedFrames / this.sampleRate;
91
+ }
92
+ /** Lifetime accepted frames. Refused, invalid and empty writes do not increase this count; clear and teardown preserve it. */
93
+ get enqueuedFrames() {
94
+ return this._submittedFrames;
95
+ }
96
+ /** Lifetime maximum bufferedFrames after an accepted write, including transport and unacknowledged consumption. Never exceeds capacityFrames; clear and teardown preserve it. */
97
+ get highWaterFrames() {
98
+ return this._highWaterFrames;
99
+ }
100
+ /** True until the worklet acknowledges clear; writes are refused during this interval. */
101
+ get clearing() {
102
+ return this._clearing;
103
+ }
104
+ /** Lifetime frames actually rendered from PCM, as of the latest worklet report. */
105
+ get playedFrames() {
106
+ return this._playedFrames;
107
+ }
108
+ /** Lifetime silent frames caused by starvation after start; excludes idle, suspended and drained time. */
109
+ get underrunFrames() {
110
+ return this._underrunFrames;
111
+ }
112
+ /** Lifetime contiguous starvation episodes, as of the latest report. */
113
+ get underruns() {
114
+ return this._underruns;
115
+ }
116
+ /** Lifetime blocks refused for insufficient capacity. Other refused writes are not overflow. */
117
+ get overflowCount() {
118
+ return this._overflowCount;
119
+ }
120
+ /** Lifetime frames refused for insufficient capacity; not frames discarded by clear or destroy. */
121
+ get droppedFrames() {
122
+ return this._droppedFrames;
123
+ }
124
+ get bus() {
125
+ return this._bus;
126
+ }
127
+ /** Reroute to a bus input, or disconnect that route with `null`. Does not take ownership of the bus or its effects. */
128
+ set bus(bus) {
129
+ if (this._terminal || bus === this._bus) return;
130
+ this._disconnectBus();
131
+ this._bus = bus;
132
+ if (!bus) return;
133
+ const connect = () => {
134
+ if (this._terminal || this._bus !== bus) return;
135
+ const input = bus.getInputNode();
136
+ if (input) {
137
+ this.output.connect(input);
138
+ this._busNode = input;
139
+ }
140
+ };
141
+ if (bus.getInputNode()) connect();
142
+ else this._cancelBusSetup = bus.onceSetup(connect);
143
+ }
144
+ /**
145
+ * Begin once, no earlier than `time` in audio-context seconds (default now).
146
+ * Sample positions round up to the next audio frame; a past time starts at
147
+ * the next available quantum. Returns false unless ready and not yet started.
148
+ */
149
+ start(time = this._context.currentTime) {
150
+ if (this._state !== "ready") return false;
151
+ if (!Number.isFinite(time) || time < 0) throw new RangeError("PcmStreamSource start time must be finite and nonnegative.");
152
+ this._node.port.postMessage({
153
+ type: "start",
154
+ time
155
+ });
156
+ this._state = "running";
157
+ return true;
158
+ }
159
+ /**
160
+ * Copy equal-length mono/stereo channel arrays in FIFO order. Returns false
161
+ * before ready, during clear, after close/failure/destroy, or on overflow.
162
+ * Overflow rejects the entire block before copying. Empty blocks succeed
163
+ * without sending a message. Invalid layout or nonfinite samples throw.
164
+ */
165
+ enqueuePlanar(channels) {
166
+ if (!this._writable) return false;
167
+ if (channels.length !== this.channels) throw new RangeError("PCM channel count does not match the source.");
168
+ const frames = channels[0].length;
169
+ for (const channel of channels) if (!(channel instanceof Float32Array) || channel.length !== frames) throw new RangeError("PCM channels must be equal-length Float32Arrays.");
170
+ if (!this._admit(frames)) return false;
171
+ for (const channel of channels) this._validateSamples(channel);
172
+ if (frames === 0) return true;
173
+ const packed = new Float32Array(frames * this.channels);
174
+ for (let channel = 0; channel < this.channels; channel++) packed.set(channels[channel], channel * frames);
175
+ return this._submit(packed, frames);
176
+ }
177
+ /** Copy interleaved frames (L,R,L,R for stereo). Same acceptance and ownership contract as {@link enqueuePlanar}. */
178
+ enqueueInterleaved(data) {
179
+ if (!this._writable) return false;
180
+ if (!(data instanceof Float32Array) || data.length % this.channels !== 0) throw new RangeError("PCM must contain whole Float32 frames.");
181
+ const frames = data.length / this.channels;
182
+ if (!this._admit(frames)) return false;
183
+ this._validateSamples(data);
184
+ if (frames === 0) return true;
185
+ const packed = new Float32Array(data.length);
186
+ for (let channel = 0; channel < this.channels; channel++) for (let frame = 0; frame < frames; frame++) packed[channel * frames + frame] = data[frame * this.channels + channel];
187
+ return this._submit(packed, frames);
188
+ }
189
+ /**
190
+ * Discard queued PCM once the worklet receives the command, retaining the
191
+ * start schedule and lifetime counters. Coalesces while pending and refuses
192
+ * new writes until acknowledged. No-op while loading or after close.
193
+ */
194
+ clear() {
195
+ if (!this._writable) return;
196
+ this._node.port.postMessage({ type: "clear" });
197
+ this._clearing = true;
198
+ }
199
+ /**
200
+ * Refuse further writes and drain. If not started, begin draining immediately;
201
+ * otherwise preserve the scheduled start. Empty tails do not count as
202
+ * underruns. Completes only when the context processes audio; use destroy for
203
+ * immediate cancellation while suspended. Idempotent and terminal.
204
+ */
205
+ close() {
206
+ if (this._terminal || this._state === "closing") return;
207
+ this._state = "closing";
208
+ this._node?.port.postMessage({ type: "close" });
209
+ }
210
+ /** Stop immediately, discard pending PCM, detach routes and release the port. Idempotent; never destroys the bus or shared context. */
211
+ destroy() {
212
+ if (this._state === "destroyed") return;
213
+ this._state = "destroyed";
214
+ this._rejectReady(new DOMException("PcmStreamSource was destroyed during loading.", "AbortError"));
215
+ this._dispose(true);
216
+ this.onEnd.destroy();
217
+ this.onError.destroy();
218
+ }
219
+ get _terminal() {
220
+ return this._state === "closed" || this._state === "destroyed" || this._state === "failed";
221
+ }
222
+ get _writable() {
223
+ return (this._state === "ready" || this._state === "running") && !this._clearing;
224
+ }
225
+ _admit(frames) {
226
+ if (frames <= this.capacityFrames - this.bufferedFrames) return true;
227
+ this._overflowCount++;
228
+ this._droppedFrames += frames;
229
+ return false;
230
+ }
231
+ _validateSamples(data) {
232
+ for (const sample of data) if (!Number.isFinite(sample)) throw new RangeError("PCM samples must be finite.");
233
+ }
234
+ _submit(data, frames) {
235
+ this._node.port.postMessage({
236
+ type: "write",
237
+ data
238
+ }, [data.buffer]);
239
+ this._submittedFrames += frames;
240
+ this._highWaterFrames = Math.max(this._highWaterFrames, this.bufferedFrames);
241
+ return true;
242
+ }
243
+ async _load() {
244
+ try {
245
+ await registerAudioWorkletProcessor(this._context, "exojs-pcm-stream", pcm_stream_worklet_default);
246
+ if (this._terminal) return;
247
+ const node = new AudioWorkletNode(this._context, "exojs-pcm-stream", {
248
+ numberOfInputs: 0,
249
+ numberOfOutputs: 1,
250
+ outputChannelCount: [this.channels],
251
+ processorOptions: {
252
+ channels: this.channels,
253
+ capacityFrames: this.capacityFrames
254
+ }
255
+ });
256
+ this._node = node;
257
+ node.port.onmessage = (event) => this._receive(event.data);
258
+ node.onprocessorerror = () => this._fail(/* @__PURE__ */ new Error("PcmStreamSource: the audio processor failed."));
259
+ node.connect(this.output);
260
+ if (this._state === "closing") node.port.postMessage({ type: "close" });
261
+ else this._state = "ready";
262
+ this._resolveReady();
263
+ } catch (error) {
264
+ if (!this._terminal) this._fail(error instanceof Error ? error : new Error(String(error)));
265
+ }
266
+ }
267
+ _receive(status) {
268
+ if (this._terminal) return;
269
+ this._releasedFrames = status.releasedFrames;
270
+ this._playedFrames = status.playedFrames;
271
+ this._underrunFrames = status.underrunFrames;
272
+ this._underruns = status.underruns;
273
+ if (status.type === "status") this._node.port.postMessage({ type: "ack" });
274
+ if (status.type === "cleared") this._clearing = false;
275
+ if (status.type === "ended") {
276
+ this._state = "closed";
277
+ this._dispose(false);
278
+ this.onEnd.dispatch();
279
+ }
280
+ }
281
+ _fail(error) {
282
+ if (this._terminal) return;
283
+ this._state = "failed";
284
+ this._rejectReady(error);
285
+ this._dispose(true);
286
+ this.onError.dispatch(error);
287
+ }
288
+ _disconnectBus() {
289
+ this._cancelBusSetup?.();
290
+ this._cancelBusSetup = null;
291
+ if (this._busNode) this.output.disconnect(this._busNode);
292
+ this._busNode = null;
293
+ }
294
+ _dispose(terminate) {
295
+ this._context.removeEventListener?.("statechange", this._onContextState);
296
+ this._disconnectBus();
297
+ if (this._node) {
298
+ if (terminate) this._node.port.postMessage({ type: "destroy" });
299
+ this._node.port.onmessage = null;
300
+ this._node.onprocessorerror = null;
301
+ this._node.disconnect();
302
+ this._node.port.close();
303
+ this._node = null;
304
+ }
305
+ this.output.disconnect();
306
+ this._releasedFrames = this._submittedFrames;
307
+ this._clearing = false;
308
+ }
309
+ };
310
+
311
+ //#endregion
312
+ export { PcmStreamSource };
313
+ //# sourceMappingURL=PcmStreamSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PcmStreamSource.js","names":["pcmStreamWorkletSource"],"sources":["../../src/PcmStreamSource.ts"],"sourcesContent":["import { type AudioBus, getAudioContext, registerAudioWorkletProcessor, type Seconds, Signal } from '@codexo/exojs';\n\nimport pcmStreamWorkletSource from './worklets/pcm-stream.worklet.ts?worklet';\n\nexport interface PcmStreamSourceOptions {\n /** Fixed channel count. PCM is not remixed or resampled by this source. */\n channels: 1 | 2;\n /** Maximum outstanding frames, including messages in transit. Integer 1..1048576; default 8192. This is a capacity, not a target latency. */\n capacityFrames?: number;\n /** Destination bus. Default `null` leaves the output disconnected. Ownership stays with the caller. */\n bus?: AudioBus | null;\n}\n\nexport type PcmStreamState = 'loading' | 'ready' | 'running' | 'closing' | 'closed' | 'failed' | 'destroyed';\n\ninterface PcmStatus {\n type: 'status' | 'cleared' | 'ended';\n releasedFrames: number;\n playedFrames: number;\n underrunFrames: number;\n underruns: number;\n}\n\n/**\n * A bounded, externally fed Float32 PCM source at the shared AudioContext's\n * sample rate. Lives in `@codexo/exojs-audio-fx`; no extension registration is\n * required. Feed a bus or connect {@link output} to an analysis tap.\n *\n * Await {@link ready}, enqueue a caller-chosen amount of audio, then call\n * {@link start}. The worklet consumes FIFO samples without waiting for the\n * producer. An empty running queue emits silence; later blocks resume at the\n * next available render quantum, without catching up or skipping samples.\n * Browser suspension freezes the audio clock and playback, but writes remain\n * bounded. Readiness does not unlock browser autoplay.\n *\n * Input arrays are copied synchronously and never detached. The private copy\n * is transferred without requiring cross-origin isolation. Values must be\n * finite; nominal full scale is -1..1, with no clipping or normalization here.\n * Resampling, producer timestamps and audiovisual lookahead belong to callers.\n *\n * Own and destroy the source separately from its bus, for example with a scene\n * DestroyScope. Destroying an AudioSystem or bus does not destroy this source.\n */\nexport class PcmStreamSource {\n public readonly channels: 1 | 2;\n public readonly capacityFrames: number;\n public readonly sampleRate: number;\n /** Resolves after module loading, even while audio is suspended. Rejects on loading failure or destruction during loading (`AbortError`). */\n public readonly ready: Promise<void>;\n /** Fires once after close has drained, not on destroy or failure. */\n public readonly onEnd = new Signal();\n /** Reports module loading, processor or context closure failures. The source is terminal afterwards. */\n public readonly onError = new Signal<[Error]>();\n /**\n * Stable source tap for Web Audio interop; routing through a bus needs no\n * access to it. Bus routing changes preserve caller-created connections;\n * terminal cleanup disconnects it.\n * @advanced\n */\n public readonly output: GainNode;\n\n private readonly _context: AudioContext;\n private _state: PcmStreamState = 'loading';\n private _node: AudioWorkletNode | null = null;\n private _bus: AudioBus | null = null;\n private _busNode: AudioNode | null = null;\n private _cancelBusSetup: (() => void) | null = null;\n private _submittedFrames = 0;\n private _highWaterFrames = 0;\n private _releasedFrames = 0;\n private _playedFrames = 0;\n private _underrunFrames = 0;\n private _underruns = 0;\n private _overflowCount = 0;\n private _droppedFrames = 0;\n private _clearing = false;\n private _resolveReady!: () => void;\n private _rejectReady!: (error: Error) => void;\n private readonly _onContextState = (): void => {\n if (this._context.state === 'closed' && !this._terminal) {\n this._fail(new Error('PcmStreamSource: the audio context was closed.'));\n }\n };\n\n public constructor(options: PcmStreamSourceOptions) {\n const capacity = options.capacityFrames ?? 8192;\n if (options.channels !== 1 && options.channels !== 2) {\n throw new RangeError('PcmStreamSource requires one or two channels.');\n }\n if (!Number.isInteger(capacity) || capacity < 1 || capacity > 1048576) {\n throw new RangeError('PcmStreamSource capacityFrames must be an integer from 1 to 1048576.');\n }\n this.channels = options.channels;\n this.capacityFrames = capacity;\n this._context = getAudioContext();\n this.sampleRate = this._context.sampleRate;\n this.output = this._context.createGain();\n this.ready = new Promise<void>((resolve, reject) => {\n this._resolveReady = resolve;\n this._rejectReady = reject;\n });\n void this.ready.catch(() => {\n // Cancellation may precede the caller's await; keep that original rejection observable.\n });\n this.bus = options.bus ?? null;\n this._context.addEventListener?.('statechange', this._onContextState);\n if (this._context.state === 'closed') {\n this._onContextState();\n } else {\n void this._load();\n }\n }\n\n public get state(): PcmStreamState {\n return this._state;\n }\n\n /** Conservative occupancy: submitted frames minus acknowledged consumed/discarded frames. May lag playback while messages are in flight. */\n public get bufferedFrames(): number {\n return this._submittedFrames - this._releasedFrames;\n }\n\n /** Queue occupancy in seconds, excluding output-device latency. */\n public get bufferedSeconds(): Seconds {\n return (this.bufferedFrames / this.sampleRate) as Seconds;\n }\n\n /** Lifetime accepted frames. Refused, invalid and empty writes do not increase this count; clear and teardown preserve it. */\n public get enqueuedFrames(): number {\n return this._submittedFrames;\n }\n\n /** Lifetime maximum bufferedFrames after an accepted write, including transport and unacknowledged consumption. Never exceeds capacityFrames; clear and teardown preserve it. */\n public get highWaterFrames(): number {\n return this._highWaterFrames;\n }\n\n /** True until the worklet acknowledges clear; writes are refused during this interval. */\n public get clearing(): boolean {\n return this._clearing;\n }\n\n /** Lifetime frames actually rendered from PCM, as of the latest worklet report. */\n public get playedFrames(): number {\n return this._playedFrames;\n }\n\n /** Lifetime silent frames caused by starvation after start; excludes idle, suspended and drained time. */\n public get underrunFrames(): number {\n return this._underrunFrames;\n }\n\n /** Lifetime contiguous starvation episodes, as of the latest report. */\n public get underruns(): number {\n return this._underruns;\n }\n\n /** Lifetime blocks refused for insufficient capacity. Other refused writes are not overflow. */\n public get overflowCount(): number {\n return this._overflowCount;\n }\n\n /** Lifetime frames refused for insufficient capacity; not frames discarded by clear or destroy. */\n public get droppedFrames(): number {\n return this._droppedFrames;\n }\n\n public get bus(): AudioBus | null {\n return this._bus;\n }\n\n /** Reroute to a bus input, or disconnect that route with `null`. Does not take ownership of the bus or its effects. */\n public set bus(bus: AudioBus | null) {\n if (this._terminal || bus === this._bus) return;\n this._disconnectBus();\n this._bus = bus;\n if (!bus) return;\n const connect = (): void => {\n if (this._terminal || this._bus !== bus) return;\n const input = bus.getInputNode();\n if (input) {\n this.output.connect(input);\n this._busNode = input;\n }\n };\n if (bus.getInputNode()) connect();\n else this._cancelBusSetup = bus.onceSetup(connect);\n }\n\n /**\n * Begin once, no earlier than `time` in audio-context seconds (default now).\n * Sample positions round up to the next audio frame; a past time starts at\n * the next available quantum. Returns false unless ready and not yet started.\n */\n public start(time = this._context.currentTime): boolean {\n if (this._state !== 'ready') return false;\n if (!Number.isFinite(time) || time < 0) throw new RangeError('PcmStreamSource start time must be finite and nonnegative.');\n this._node!.port.postMessage({ type: 'start', time });\n this._state = 'running';\n return true;\n }\n\n /**\n * Copy equal-length mono/stereo channel arrays in FIFO order. Returns false\n * before ready, during clear, after close/failure/destroy, or on overflow.\n * Overflow rejects the entire block before copying. Empty blocks succeed\n * without sending a message. Invalid layout or nonfinite samples throw.\n */\n public enqueuePlanar(channels: readonly Float32Array[]): boolean {\n if (!this._writable) return false;\n if (channels.length !== this.channels) throw new RangeError('PCM channel count does not match the source.');\n const frames = channels[0]!.length;\n for (const channel of channels) {\n if (!(channel instanceof Float32Array) || channel.length !== frames) throw new RangeError('PCM channels must be equal-length Float32Arrays.');\n }\n if (!this._admit(frames)) return false;\n for (const channel of channels) this._validateSamples(channel);\n if (frames === 0) return true;\n const packed = new Float32Array(frames * this.channels);\n for (let channel = 0; channel < this.channels; channel++) packed.set(channels[channel]!, channel * frames);\n return this._submit(packed, frames);\n }\n\n /** Copy interleaved frames (L,R,L,R for stereo). Same acceptance and ownership contract as {@link enqueuePlanar}. */\n public enqueueInterleaved(data: Float32Array): boolean {\n if (!this._writable) return false;\n if (!(data instanceof Float32Array) || data.length % this.channels !== 0) throw new RangeError('PCM must contain whole Float32 frames.');\n const frames = data.length / this.channels;\n if (!this._admit(frames)) return false;\n this._validateSamples(data);\n if (frames === 0) return true;\n const packed = new Float32Array(data.length);\n for (let channel = 0; channel < this.channels; channel++) {\n for (let frame = 0; frame < frames; frame++) packed[channel * frames + frame] = data[frame * this.channels + channel]!;\n }\n return this._submit(packed, frames);\n }\n\n /**\n * Discard queued PCM once the worklet receives the command, retaining the\n * start schedule and lifetime counters. Coalesces while pending and refuses\n * new writes until acknowledged. No-op while loading or after close.\n */\n public clear(): void {\n if (!this._writable) return;\n this._node!.port.postMessage({ type: 'clear' });\n this._clearing = true;\n }\n\n /**\n * Refuse further writes and drain. If not started, begin draining immediately;\n * otherwise preserve the scheduled start. Empty tails do not count as\n * underruns. Completes only when the context processes audio; use destroy for\n * immediate cancellation while suspended. Idempotent and terminal.\n */\n public close(): void {\n if (this._terminal || this._state === 'closing') return;\n this._state = 'closing';\n this._node?.port.postMessage({ type: 'close' });\n }\n\n /** Stop immediately, discard pending PCM, detach routes and release the port. Idempotent; never destroys the bus or shared context. */\n public destroy(): void {\n if (this._state === 'destroyed') return;\n this._state = 'destroyed';\n this._rejectReady(new DOMException('PcmStreamSource was destroyed during loading.', 'AbortError'));\n this._dispose(true);\n this.onEnd.destroy();\n this.onError.destroy();\n }\n\n private get _terminal(): boolean {\n return this._state === 'closed' || this._state === 'destroyed' || this._state === 'failed';\n }\n\n private get _writable(): boolean {\n return (this._state === 'ready' || this._state === 'running') && !this._clearing;\n }\n\n private _admit(frames: number): boolean {\n if (frames <= this.capacityFrames - this.bufferedFrames) return true;\n this._overflowCount++;\n this._droppedFrames += frames;\n return false;\n }\n\n private _validateSamples(data: Float32Array): void {\n for (const sample of data) {\n if (!Number.isFinite(sample)) throw new RangeError('PCM samples must be finite.');\n }\n }\n\n private _submit(data: Float32Array, frames: number): boolean {\n this._node!.port.postMessage({ type: 'write', data }, [data.buffer]);\n this._submittedFrames += frames;\n this._highWaterFrames = Math.max(this._highWaterFrames, this.bufferedFrames);\n return true;\n }\n\n private async _load(): Promise<void> {\n try {\n await registerAudioWorkletProcessor(this._context, 'exojs-pcm-stream', pcmStreamWorkletSource);\n if (this._terminal) return;\n const node = new AudioWorkletNode(this._context, 'exojs-pcm-stream', {\n numberOfInputs: 0,\n numberOfOutputs: 1,\n outputChannelCount: [this.channels],\n processorOptions: { channels: this.channels, capacityFrames: this.capacityFrames },\n });\n this._node = node;\n node.port.onmessage = (event: MessageEvent<PcmStatus>): void => this._receive(event.data);\n node.onprocessorerror = (): void => this._fail(new Error('PcmStreamSource: the audio processor failed.'));\n node.connect(this.output);\n if (this._state === 'closing') node.port.postMessage({ type: 'close' });\n else this._state = 'ready';\n this._resolveReady();\n } catch (error) {\n if (!this._terminal) this._fail(error instanceof Error ? error : new Error(String(error)));\n }\n }\n\n private _receive(status: PcmStatus): void {\n if (this._terminal) return;\n this._releasedFrames = status.releasedFrames;\n this._playedFrames = status.playedFrames;\n this._underrunFrames = status.underrunFrames;\n this._underruns = status.underruns;\n if (status.type === 'status') this._node!.port.postMessage({ type: 'ack' });\n if (status.type === 'cleared') this._clearing = false;\n if (status.type === 'ended') {\n this._state = 'closed';\n this._dispose(false);\n this.onEnd.dispatch();\n }\n }\n\n private _fail(error: Error): void {\n if (this._terminal) return;\n this._state = 'failed';\n this._rejectReady(error);\n this._dispose(true);\n this.onError.dispatch(error);\n }\n\n private _disconnectBus(): void {\n this._cancelBusSetup?.();\n this._cancelBusSetup = null;\n if (this._busNode) this.output.disconnect(this._busNode);\n this._busNode = null;\n }\n\n private _dispose(terminate: boolean): void {\n this._context.removeEventListener?.('statechange', this._onContextState);\n this._disconnectBus();\n if (this._node) {\n if (terminate) this._node.port.postMessage({ type: 'destroy' });\n this._node.port.onmessage = null;\n this._node.onprocessorerror = null;\n this._node.disconnect();\n this._node.port.close();\n this._node = null;\n }\n this.output.disconnect();\n this._releasedFrames = this._submittedFrames;\n this._clearing = false;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA2CA,IAAa,kBAAb,MAA6B;CAC3B,AAAgB;CAChB,AAAgB;CAChB,AAAgB;;CAEhB,AAAgB;;CAEhB,AAAgB,QAAQ,IAAI,OAAO;;CAEnC,AAAgB,UAAU,IAAI,OAAgB;;;;;;;CAO9C,AAAgB;C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AAK,MAAM,KAAK,YAAY;GAC5B,KAAK,MAAM,mBAAmB;GAC9B,KAAK,MAAM,WAAW;GACtB,KAAK,MAAM,KAAK,MAAM;GACtB,KAAK,QAAQ;EACf;EACA,KAAK,OAAO,WAAW;EACvB,KAAK,kBAAkB,KAAK;EAC5B,KAAK,YAAY;CACnB;AACF"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The `ready` contract `AudioEffect` gives effects, for the package's
3
+ * non-effect worklet components: pending until set up, resolved once ready,
4
+ * rejected with the setup error, or with an `AbortError` when destroyed first.
5
+ *
6
+ * The promise is created only when someone asks for it, so a failure nobody
7
+ * awaits raises no unhandled rejection.
8
+ */
9
+ export declare class ReadyGate {
10
+ private readonly _abortMessage;
11
+ private _state;
12
+ private _failure;
13
+ private _promise;
14
+ private _resolve;
15
+ private _reject;
16
+ constructor(_abortMessage: string);
17
+ get promise(): Promise<void>;
18
+ resolve(): void;
19
+ fail(error: unknown): void;
20
+ /** Rejects a gate that is still pending; a settled gate keeps its outcome. */
21
+ abort(): void;
22
+ private _createAbortError;
23
+ private _clear;
24
+ }
25
+ //# sourceMappingURL=ReadyGate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadyGate.d.ts","sourceRoot":"","sources":["../../src/ReadyGate.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,SAAS;IAOD,OAAO,CAAC,QAAQ,CAAC,aAAa;IANjD,OAAO,CAAC,MAAM,CAAyD;IACvE,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,QAAQ,CAA8B;IAC9C,OAAO,CAAC,QAAQ,CAA6B;IAC7C,OAAO,CAAC,OAAO,CAA0C;IAEzD,YAAoC,aAAa,EAAE,MAAM,EAAI;IAE7D,IAAW,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAsBlC;IAEM,OAAO,IAAI,IAAI,CAKrB;IAEM,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAMhC;IAED,8EAA8E;IACvE,KAAK,IAAI,IAAI,CAKnB;IAED,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,MAAM;CAIf"}
@@ -0,0 +1,69 @@
1
+ //#region src/ReadyGate.ts
2
+ /**
3
+ * The `ready` contract `AudioEffect` gives effects, for the package's
4
+ * non-effect worklet components: pending until set up, resolved once ready,
5
+ * rejected with the setup error, or with an `AbortError` when destroyed first.
6
+ *
7
+ * The promise is created only when someone asks for it, so a failure nobody
8
+ * awaits raises no unhandled rejection.
9
+ */
10
+ var ReadyGate = class {
11
+ _abortMessage;
12
+ _state = "pending";
13
+ _failure = null;
14
+ _promise = null;
15
+ _resolve = null;
16
+ _reject = null;
17
+ constructor(_abortMessage) {
18
+ this._abortMessage = _abortMessage;
19
+ }
20
+ get promise() {
21
+ if (this._promise === null) switch (this._state) {
22
+ case "ready":
23
+ this._promise = Promise.resolve();
24
+ break;
25
+ case "failed":
26
+ this._promise = Promise.reject(this._failure ?? /* @__PURE__ */ new Error("Setup failed."));
27
+ break;
28
+ case "aborted":
29
+ this._promise = Promise.reject(this._createAbortError());
30
+ break;
31
+ case "pending": this._promise = new Promise((resolve, reject) => {
32
+ this._resolve = resolve;
33
+ this._reject = reject;
34
+ });
35
+ }
36
+ return this._promise;
37
+ }
38
+ resolve() {
39
+ if (this._state !== "pending") return;
40
+ this._state = "ready";
41
+ this._resolve?.();
42
+ this._clear();
43
+ }
44
+ fail(error) {
45
+ if (this._state !== "pending") return;
46
+ this._state = "failed";
47
+ this._failure = error instanceof Error ? error : new Error(String(error));
48
+ this._reject?.(this._failure);
49
+ this._clear();
50
+ }
51
+ /** Rejects a gate that is still pending; a settled gate keeps its outcome. */
52
+ abort() {
53
+ if (this._state !== "pending") return;
54
+ this._state = "aborted";
55
+ this._reject?.(this._createAbortError());
56
+ this._clear();
57
+ }
58
+ _createAbortError() {
59
+ return new DOMException(this._abortMessage, "AbortError");
60
+ }
61
+ _clear() {
62
+ this._resolve = null;
63
+ this._reject = null;
64
+ }
65
+ };
66
+
67
+ //#endregion
68
+ export { ReadyGate };
69
+ //# sourceMappingURL=ReadyGate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadyGate.js","names":[],"sources":["../../src/ReadyGate.ts"],"sourcesContent":["/**\n * The `ready` contract `AudioEffect` gives effects, for the package's\n * non-effect worklet components: pending until set up, resolved once ready,\n * rejected with the setup error, or with an `AbortError` when destroyed first.\n *\n * The promise is created only when someone asks for it, so a failure nobody\n * awaits raises no unhandled rejection.\n */\nexport class ReadyGate {\n private _state: 'pending' | 'ready' | 'failed' | 'aborted' = 'pending';\n private _failure: Error | null = null;\n private _promise: Promise<void> | null = null;\n private _resolve: (() => void) | null = null;\n private _reject: ((reason: Error) => void) | null = null;\n\n public constructor(private readonly _abortMessage: string) {}\n\n public get promise(): Promise<void> {\n if (this._promise === null) {\n switch (this._state) {\n case 'ready':\n this._promise = Promise.resolve();\n break;\n case 'failed':\n this._promise = Promise.reject(this._failure ?? new Error('Setup failed.'));\n break;\n case 'aborted':\n this._promise = Promise.reject(this._createAbortError());\n break;\n case 'pending':\n this._promise = new Promise<void>((resolve, reject) => {\n this._resolve = resolve;\n this._reject = reject;\n });\n break;\n }\n }\n\n return this._promise;\n }\n\n public resolve(): void {\n if (this._state !== 'pending') return;\n this._state = 'ready';\n this._resolve?.();\n this._clear();\n }\n\n public fail(error: unknown): void {\n if (this._state !== 'pending') return;\n this._state = 'failed';\n this._failure = error instanceof Error ? error : new Error(String(error));\n this._reject?.(this._failure);\n this._clear();\n }\n\n /** Rejects a gate that is still pending; a settled gate keeps its outcome. */\n public abort(): void {\n if (this._state !== 'pending') return;\n this._state = 'aborted';\n this._reject?.(this._createAbortError());\n this._clear();\n }\n\n private _createAbortError(): DOMException {\n return new DOMException(this._abortMessage, 'AbortError');\n }\n\n private _clear(): void {\n this._resolve = null;\n this._reject = null;\n }\n}\n"],"mappings":";;;;;;;;;AAQA,IAAa,YAAb,MAAuB;CAOe;CANpC,AAAQ,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AgE;AAChE,eAAO,MAAM,UAAU,GAAI,MAAM,YAAY,EAAE,MAAM,YAAY,KAAG,IAOnE,CAAC;AAuBF;;;GAGG;AACH,eAAO,MAAM,GAAG,GAAI,MAAM,YAAY,EAAE,MAAM,YAAY,KAAG,IAsB5D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,YAAY,EAAE,MAAM,YAAY,KAAG,YAO1E,CAAC"}
1
+ {"version":3,"file":"fft.d.ts","sourceRoot":"","sources":["../../../src/dsp/fft.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,gEAAgE;AAChE,eAAO,MAAM,UAAU,SAAU,YAAY,QAAQ,YAAY,KAAG,IAOnE,CAAC;AAuBF;;;GAGG;AACH,eAAO,MAAM,GAAG,SAAU,YAAY,QAAQ,YAAY,KAAG,IAsB5D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,SAAU,YAAY,QAAQ,YAAY,KAAG,YAO1E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"mel.d.ts","sourceRoot":"","sources":["../../../src/dsp/mel.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,yBAAyB;AACzB,eAAO,MAAM,OAAO,GAAI,IAAI,MAAM,KAAG,MAAyC,CAAC;AAE/E,yBAAyB;AACzB,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,KAAG,MAA8C,CAAC;AAErF,MAAM,WAAW,OAAO;IACtB,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,4CAA4C;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,8DAA8D;IAC9D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kFAAkF;IAClF,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,GAAI,WAAW,MAAM,EAAE,MAAM,MAAM,EAAE,MAAM,MAAM,EAAE,SAAS,MAAM,EAAE,YAAY,MAAM,KAAG,OAAO,EA2C9H,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,YAAY,EAAE,OAAO,SAAS,OAAO,EAAE,EAAE,MAAM,YAAY,KAAG,YAWlG,CAAC"}
1
+ {"version":3,"file":"mel.d.ts","sourceRoot":"","sources":["../../../src/dsp/mel.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,yBAAyB;AACzB,eAAO,MAAM,OAAO,OAAQ,MAAM,KAAG,MAAyC,CAAC;AAE/E,yBAAyB;AACzB,eAAO,MAAM,OAAO,QAAS,MAAM,KAAG,MAA8C,CAAC;AAErF,MAAM,WAAW,OAAO;IACtB,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,4CAA4C;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,8DAA8D;IAC9D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kFAAkF;IAClF,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,cAAe,MAAM,QAAQ,MAAM,QAAQ,MAAM,WAAW,MAAM,cAAc,MAAM,KAAG,OAAO,EA2C9H,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,QAAS,YAAY,SAAS,SAAS,OAAO,EAAE,QAAQ,YAAY,KAAG,YAWlG,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"tempogram.d.ts","sourceRoot":"","sources":["../../../src/dsp/tempogram.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,MAAM,WAAW,oBAAoB;IACnC,iBAAiB;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC;I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UAAU,QAAS,MAAM,kCAAmD,MAGxF,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,UACxB,oBAAoB,EAAE,OACxB,YAAY,UACT,MAAM,YACL,mBAAmB,KAC3B,oBAAoB,EA0BtB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,SAC3B,YAAY,UACV,MAAM,UACN,MAAM,WACL,MAAM,cACH,MAAM,YACT,mBAAmB,KAC3B,oBAAoB,EAatB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,QAAS,MAAM,aAAa,MAAM,KAAG,OAWhE,CAAC"}
@@ -71,7 +71,6 @@ export declare class AutoWahEffect extends AudioEffect {
71
71
  private _q;
72
72
  private _responseMs;
73
73
  private _wet;
74
- private readonly _onAudioContextReady;
75
74
  constructor(options?: AutoWahEffectOptions);
76
75
  /**
77
76
  * The node where audio enters this effect. Throws if the audio context is
@@ -1 +1 @@
1
- {"version":3,"file":"AutoWahEffect.d.ts","sourceRoot":"","sources":["../../../src/effects/AutoWahEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA6D,MAAM,eAAe,CAAC;AAEvG,sDAAsD;AACtD,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,CAAC,CAAC,EAAE,MAAM,CAAC;IACX;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAaD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBAAa,aAAc,SAAQ,WAAW;IAC5C,OAAO,CAAC,MAAM,CAAmC;IACjD,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAA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"@codexo/exojs";
1
+ import { AudioEffect } from "@codexo/exojs";
2
2
 
3
3
  //#region src/effects/AutoWahEffect.ts
4
4
  /**
@@ -43,10 +43,6 @@ var AutoWahEffect = class AutoWahEffect extends AudioEffect {
43
43
  _q;
44
44
  _responseMs;
45
45
  _wet;
46
- _onAudioContextReady = (ctx) => {
47
- onAudioContextReady.remove(this._onAudioContextReady);
48
- this._setupNodes(ctx);
49
- };
50
46
  constructor(options = {}) {
51
47
  super();
52
48
  this._baseFrequency = Math.max(50, Math.min(2e3, options.baseFrequency ?? 200));
@@ -54,8 +50,7 @@ var AutoWahEffect = class AutoWahEffect extends AudioEffect {
54
50
  this._q = Math.max(.1, Math.min(20, options.q ?? 4));
55
51
  this._responseMs = Math.max(1, Math.min(500, options.responseMs ?? 30));
56
52
  this._wet = Math.max(0, Math.min(1, options.wet ?? .7));
57
- if (isAudioContextReady()) this._setupNodes(getAudioContext());
58
- else onAudioContextReady.add(this._onAudioContextReady);
53
+ this._deferSetup((context) => this._setupNodes(context));
59
54
  }
60
55
  /**
61
56
  * The node where audio enters this effect. Throws if the audio context is
@@ -135,7 +130,7 @@ var AutoWahEffect = class AutoWahEffect extends AudioEffect {
135
130
  }
136
131
  }
137
132
  destroy() {
138
- onAudioContextReady.remove(this._onAudioContextReady);
133
+ this._teardown();
139
134
  if (this._setup) {
140
135
  this._setup.inputGain.disconnect();
141
136
  this._setup.dryGain.disconnect();
@@ -1 +1 @@
1
- {"version":3,"file":"AutoWahEffect.js","names":[],"sources":["../../../src/effects/AutoWahEffect.ts"],"sourcesContent":["import { AudioEffect, getAudioContext, isAudioContextReady, onAudioContextReady } from '@codexo/exojs';\n\n/** Construction options for {@link AutoWahEffect}. */\nexport interface AutoWahEffectOptions {\n /**\n * Centre frequency of the wah bandpass filter in Hz. The envelope control\n * signal sweeps the filter upward from this base. Range 50..2000, default 200.\n */\n baseFrequency?: number;\n /**\n * Envelope sensitivity: Hz of filter-frequency sweep added per unit of\n * rectified envelope amplitude. At full signal amplitude the filter shifts up\n * by this amount above `baseFrequency`. Range 0..6000, default 3000.\n */\n sensitivity?: number;\n /**\n * Q (resonance) of the bandpass wah filter. Higher values produce a narrower,\n * more pronounced peak. Range 0.1..20, default 4.\n */\n q?: number;\n /**\n * Envelope smoothing time constant in milliseconds. Longer values make the\n * wah react slowly (legato); shorter values produce a snappier attack\n * (percussive). Translated to the smoothing lowpass cutoff as\n * `1000 / (2π × responseMs)` Hz. Range 1..500, default 30.\n */\n responseMs?: number;\n /**\n * Dry/wet mix, 0..1. The dry level is automatically `1 - wet`. Default 0.7.\n */\n wet?: number;\n}\n\ninterface AutoWahEffectSetup {\n readonly inputGain: GainNode;\n readonly outputGain: GainNode;\n readonly dryGain: GainNode;\n readonly wetGain: GainNode;\n readonly sensitivityGain: GainNode;\n readonly wahFilter: BiquadFilterNode;\n readonly smoothingLowpass: BiquadFilterNode;\n readonly rectifier: WaveShaperNode;\n}\n\n/**\n * Auto-wah effect that uses an amplitude envelope follower to modulate a\n * bandpass filter, creating the characteristic \"wah\" sweep driven by the\n * loudness of the input signal.\n *\n * The envelope follower is built entirely from native Web Audio nodes - no\n * `ScriptProcessor` or `AudioWorklet` required:\n *\n * 1. A `WaveShaperNode` rectifier approximates `|x|` (full-wave rectification),\n * converting the AC audio signal to a unipolar amplitude proxy.\n * 2. A `BiquadFilterNode` (lowpass) smooths the rectified signal. The cutoff is\n * derived from `responseMs` to control attack/release speed.\n * 3. A `GainNode` scales the smoothed envelope by `sensitivity` (Hz/unit) and\n * connects its output directly to the wah filter's `frequency` `AudioParam`,\n * sweeping the filter centre upward with input loudness.\n *\n * Node graph:\n * ```\n * inputGain ─┬─ dryGain ─────────────────────────────┐\n * │ ├── outputGain\n * └─ wahFilter(bandpass) ─── wetGain ──────┘\n *\n * Envelope (control) path - parallel off inputGain, sums into wahFilter.frequency:\n * inputGain → rectifier(WaveShaper,|x|) → smoothingLowpass(BiquadFilter,lowpass)\n * → sensitivityGain → wahFilter.frequency (AudioParam)\n * ```\n *\n * Gains: `dryGain.gain = 1 - wet`; `wetGain.gain = wet`.\n *\n * @example\n * ```ts\n * const wah = new AutoWahEffect({ baseFrequency: 300, sensitivity: 2500, wet: 0.8 });\n * bus.addEffect(wah);\n * ```\n */\nexport class AutoWahEffect extends AudioEffect {\n private _setup: AutoWahEffectSetup | null = null;\n private _baseFrequency: number;\n private _sensitivity: number;\n private _q: number;\n private _responseMs: number;\n private _wet: number;\n private readonly _onAudioContextReady = (ctx: AudioContext): void => {\n onAudioContextReady.remove(this._onAudioContextReady);\n this._setupNodes(ctx);\n };\n\n public constructor(options: AutoWahEffectOptions = {}) {\n super();\n this._baseFrequency = Math.max(50, Math.min(2000, options.baseFrequency ?? 200));\n this._sensitivity = Math.max(0, Math.min(6000, options.sensitivity ?? 3000));\n this._q = Math.max(0.1, Math.min(20, options.q ?? 4));\n this._responseMs = Math.max(1, Math.min(500, options.responseMs ?? 30));\n this._wet = Math.max(0, Math.min(1, options.wet ?? 0.7));\n if (isAudioContextReady()) {\n this._setupNodes(getAudioContext());\n } else {\n onAudioContextReady.add(this._onAudioContextReady);\n }\n }\n\n /**\n * The node where audio enters this effect. Throws if the audio context is\n * not yet initialized.\n */\n public get inputNode(): AudioNode {\n if (!this._setup) throw new Error('AutoWahEffect not yet initialized.');\n return this._setup.inputGain;\n }\n\n /**\n * The node where audio exits this effect. Throws if the audio context is\n * not yet initialized.\n */\n public get outputNode(): AudioNode {\n if (!this._setup) throw new Error('AutoWahEffect not yet initialized.');\n return this._setup.outputGain;\n }\n\n // ---------------------------------------------------------------------------\n // Getters / setters\n // ---------------------------------------------------------------------------\n\n /**\n * Centre frequency of the wah filter in Hz. Range 50..2000, default 200.\n * Changes are ramped smoothly via `setTargetAtTime`.\n */\n public get baseFrequency(): number {\n return this._baseFrequency;\n }\n\n public set baseFrequency(value: number) {\n this._baseFrequency = Math.max(50, Math.min(2000, value));\n if (this._setup) {\n this._setup.wahFilter.frequency.setTargetAtTime(this._baseFrequency, this._setup.wahFilter.context.currentTime, 0.01);\n }\n }\n\n /**\n * Envelope sensitivity in Hz/unit: the maximum filter sweep above\n * `baseFrequency` when input is at full amplitude. Range 0..6000, default 3000.\n * Changes are ramped smoothly via `setTargetAtTime`.\n */\n public get sensitivity(): number {\n return this._sensitivity;\n }\n\n public set sensitivity(value: number) {\n this._sensitivity = Math.max(0, Math.min(6000, value));\n if (this._setup) {\n this._setup.sensitivityGain.gain.setTargetAtTime(this._sensitivity, this._setup.sensitivityGain.context.currentTime, 0.01);\n }\n }\n\n /**\n * Q (resonance) of the bandpass wah filter. Range 0.1..20, default 4.\n * Changes are ramped smoothly via `setTargetAtTime`.\n */\n public get q(): number {\n return this._q;\n }\n\n public set q(value: number) {\n this._q = Math.max(0.1, Math.min(20, value));\n if (this._setup) {\n this._setup.wahFilter.Q.setTargetAtTime(this._q, this._setup.wahFilter.context.currentTime, 0.01);\n }\n }\n\n /**\n * Envelope smoothing time constant in milliseconds. Range 1..500, default 30.\n * Updating this adjusts the smoothing lowpass cutoff immediately via\n * `setTargetAtTime`.\n */\n public get responseMs(): number {\n return this._responseMs;\n }\n\n public set responseMs(value: number) {\n this._responseMs = Math.max(1, Math.min(500, value));\n if (this._setup) {\n this._setup.smoothingLowpass.frequency.setTargetAtTime(this._smoothingCutoff(), this._setup.smoothingLowpass.context.currentTime, 0.01);\n }\n }\n\n /**\n * Wet (wah-filtered) mix level, 0..1. The dry level is automatically\n * `1 - wet`. Changes are ramped smoothly via `setTargetAtTime`. Default 0.7.\n */\n public get wet(): number {\n return this._wet;\n }\n\n public set wet(value: number) {\n this._wet = Math.max(0, Math.min(1, value));\n if (this._setup) {\n const ctx = this._setup.wetGain.context;\n this._setup.wetGain.gain.setTargetAtTime(this._wet, ctx.currentTime, 0.01);\n this._setup.dryGain.gain.setTargetAtTime(1 - this._wet, ctx.currentTime, 0.01);\n }\n }\n\n // ---------------------------------------------------------------------------\n // Lifecycle\n // ---------------------------------------------------------------------------\n\n public override destroy(): void {\n onAudioContextReady.remove(this._onAudioContextReady);\n if (this._setup) {\n this._setup.inputGain.disconnect();\n this._setup.dryGain.disconnect();\n this._setup.wetGain.disconnect();\n this._setup.sensitivityGain.disconnect();\n this._setup.wahFilter.disconnect();\n this._setup.smoothingLowpass.disconnect();\n this._setup.rectifier.disconnect();\n this._setup.outputGain.disconnect();\n this._setup = null;\n }\n }\n\n // ---------------------------------------------------------------------------\n // Private\n // ---------------------------------------------------------------------------\n\n /** Converts `responseMs` to a lowpass cutoff frequency using f = 1/(2π×τ). */\n private _smoothingCutoff(): number {\n return 1000 / (2 * Math.PI * this._responseMs);\n }\n\n /**\n * Builds a 256-point `Float32Array` curve approximating the full-wave\n * rectifier `f(x) = |x|` for use with `WaveShaperNode`.\n */\n private static _makeRectifierCurve(): Float32Array<ArrayBuffer> {\n const n = 256;\n const curve = new Float32Array(n);\n for (let i = 0; i < n; i++) {\n const x = (i * 2) / (n - 1) - 1; // maps index to -1..1\n curve[i] = Math.abs(x);\n }\n return curve;\n }\n\n private _setupNodes(ctx: AudioContext): void {\n // Audio-path gain nodes (createGain order: 0=inputGain, 1=outputGain,\n // 2=dryGain, 3=wetGain, 4=sensitivityGain).\n const inputGain = ctx.createGain();\n const outputGain = ctx.createGain();\n const dryGain = ctx.createGain();\n const wetGain = ctx.createGain();\n const sensitivityGain = ctx.createGain();\n\n // Wah filter (audio path) and smoothing filter (envelope control path)\n // (createBiquadFilter order: 0=wahFilter, 1=smoothingLowpass).\n const wahFilter = ctx.createBiquadFilter();\n const smoothingLowpass = ctx.createBiquadFilter();\n\n // Full-wave rectifier for the envelope follower.\n const rectifier = ctx.createWaveShaper();\n\n // ── Initialize values ────────────────────────────────────────────────────\n\n inputGain.gain.setValueAtTime(1, ctx.currentTime);\n outputGain.gain.setValueAtTime(1, ctx.currentTime);\n dryGain.gain.setValueAtTime(1 - this._wet, ctx.currentTime);\n wetGain.gain.setValueAtTime(this._wet, ctx.currentTime);\n sensitivityGain.gain.setValueAtTime(this._sensitivity, ctx.currentTime);\n\n // Wah bandpass filter: base frequency and Q; envelope signal adds on top.\n wahFilter.type = 'bandpass';\n wahFilter.frequency.setValueAtTime(this._baseFrequency, ctx.currentTime);\n wahFilter.Q.setValueAtTime(this._q, ctx.currentTime);\n\n // Rectifier: full-wave |x| curve; 4× oversampling for accuracy.\n rectifier.curve = AutoWahEffect._makeRectifierCurve();\n rectifier.oversample = '4x';\n\n // Smoothing lowpass: cutoff derived from responseMs; low Q for no ringing.\n smoothingLowpass.type = 'lowpass';\n smoothingLowpass.frequency.setValueAtTime(this._smoothingCutoff(), ctx.currentTime);\n smoothingLowpass.Q.setValueAtTime(0.5, ctx.currentTime);\n\n // ── Wiring ───────────────────────────────────────────────────────────────\n\n // Dry path: inputGain → dryGain → outputGain\n inputGain.connect(dryGain);\n dryGain.connect(outputGain);\n\n // Wet (audio) path: inputGain → wahFilter → wetGain → outputGain\n inputGain.connect(wahFilter);\n wahFilter.connect(wetGain);\n wetGain.connect(outputGain);\n\n // Envelope (control) path - parallel off inputGain, drives wahFilter.frequency.\n // The rectified+smoothed signal is scaled by sensitivityGain and summed into\n // the wahFilter frequency AudioParam, sweeping the filter with input loudness.\n inputGain.connect(rectifier);\n rectifier.connect(smoothingLowpass);\n smoothingLowpass.connect(sensitivityGain);\n sensitivityGain.connect(wahFilter.frequency as unknown as AudioNode);\n\n this._setup = { inputGain, outputGain, dryGain, wetGain, sensitivityGain, wahFilter, smoothingLowpass, rectifier };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,IAAa,gBAAb,MAAa,sBAAsB,YAAY;CAC7C,AAAQ,SAAoC;CAC5C,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAiB,wBAAwB,QAA4B;EACnE,oBAAoB,OAAO,KAAK,oBAAoB;EACpD,KAAK,YAAY,GAAG;CACtB;CAEA,AAAO,YAAY,UAAgC,CAAC,GAAG;EACrD,MAAM;EACN,KAA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AQ,UAAU;EAK1B,UAAU,QAAQ,SAAS;EAC3B,UAAU,QAAQ,gBAAgB;EAClC,iBAAiB,QAAQ,eAAe;EACxC,gBAAgB,QAAQ,UAAU,SAAiC;EAEnE,KAAK,SAAS;GAAE;GAAW;GAAY;GAAS;GAAS;GAAiB;GAAW;GAAkB;EAAU;CACnH;AACF"}
1
+ {"version":3,"file":"AutoWahEffect.js","names":[],"sources":["../../../src/effects/AutoWahEffect.ts"],"sourcesContent":["import { AudioEffect } from '@codexo/exojs';\n\n/** Construction options for {@link AutoWahEffect}. */\nexport interface AutoWahEffectOptions {\n /**\n * Centre frequency of the wah bandpass filter in Hz. The envelope control\n * signal sweeps the filter upward from this base. Range 50..2000, default 200.\n */\n baseFrequency?: number;\n /**\n * Envelope sensitivity: Hz of filter-frequency sweep added per unit of\n * rectified envelope amplitude. At full signal amplitude the filter shifts up\n * by this amount above `baseFrequency`. Range 0..6000, default 3000.\n */\n sensitivity?: number;\n /**\n * Q (resonance) of the bandpass wah filter. Higher values produce a narrower,\n * more pronounced peak. Range 0.1..20, default 4.\n */\n q?: number;\n /**\n * Envelope smoothing time constant in milliseconds. Longer values make the\n * wah react slowly (legato); shorter values produce a snappier attack\n * (percussive). Translated to the smoothing lowpass cutoff as\n * `1000 / (2π × responseMs)` Hz. Range 1..500, default 30.\n */\n responseMs?: number;\n /**\n * Dry/wet mix, 0..1. The dry level is automatically `1 - wet`. Default 0.7.\n */\n wet?: number;\n}\n\ninterface AutoWahEffectSetup {\n readonly inputGain: GainNode;\n readonly outputGain: GainNode;\n readonly dryGain: GainNode;\n readonly wetGain: GainNode;\n readonly sensitivityGain: GainNode;\n readonly wahFilter: BiquadFilterNode;\n readonly smoothingLowpass: BiquadFilterNode;\n readonly rectifier: WaveShaperNode;\n}\n\n/**\n * Auto-wah effect that uses an amplitude envelope follower to modulate a\n * bandpass filter, creating the characteristic \"wah\" sweep driven by the\n * loudness of the input signal.\n *\n * The envelope follower is built entirely from native Web Audio nodes - no\n * `ScriptProcessor` or `AudioWorklet` required:\n *\n * 1. A `WaveShaperNode` rectifier approximates `|x|` (full-wave rectification),\n * converting the AC audio signal to a unipolar amplitude proxy.\n * 2. A `BiquadFilterNode` (lowpass) smooths the rectified signal. The cutoff is\n * derived from `responseMs` to control attack/release speed.\n * 3. A `GainNode` scales the smoothed envelope by `sensitivity` (Hz/unit) and\n * connects its output directly to the wah filter's `frequency` `AudioParam`,\n * sweeping the filter centre upward with input loudness.\n *\n * Node graph:\n * ```\n * inputGain ─┬─ dryGain ─────────────────────────────┐\n * │ ├── outputGain\n * └─ wahFilter(bandpass) ─── wetGain ──────┘\n *\n * Envelope (control) path - parallel off inputGain, sums into wahFilter.frequency:\n * inputGain → rectifier(WaveShaper,|x|) → smoothingLowpass(BiquadFilter,lowpass)\n * → sensitivityGain → wahFilter.frequency (AudioParam)\n * ```\n *\n * Gains: `dryGain.gain = 1 - wet`; `wetGain.gain = wet`.\n *\n * @example\n * ```ts\n * const wah = new AutoWahEffect({ baseFrequency: 300, sensitivity: 2500, wet: 0.8 });\n * bus.addEffect(wah);\n * ```\n */\nexport class AutoWahEffect extends AudioEffect {\n private _setup: AutoWahEffectSetup | null = null;\n private _baseFrequency: number;\n private _sensitivity: number;\n private _q: number;\n private _responseMs: number;\n private _wet: number;\n\n public constructor(options: AutoWahEffectOptions = {}) {\n super();\n this._baseFrequency = Math.max(50, Math.min(2000, options.baseFrequency ?? 200));\n this._sensitivity = Math.max(0, Math.min(6000, options.sensitivity ?? 3000));\n this._q = Math.max(0.1, Math.min(20, options.q ?? 4));\n this._responseMs = Math.max(1, Math.min(500, options.responseMs ?? 30));\n this._wet = Math.max(0, Math.min(1, options.wet ?? 0.7));\n this._deferSetup(context => this._setupNodes(context));\n }\n\n /**\n * The node where audio enters this effect. Throws if the audio context is\n * not yet initialized.\n */\n public get inputNode(): AudioNode {\n if (!this._setup) throw new Error('AutoWahEffect not yet initialized.');\n return this._setup.inputGain;\n }\n\n /**\n * The node where audio exits this effect. Throws if the audio context is\n * not yet initialized.\n */\n public get outputNode(): AudioNode {\n if (!this._setup) throw new Error('AutoWahEffect not yet initialized.');\n return this._setup.outputGain;\n }\n\n // ---------------------------------------------------------------------------\n // Getters / setters\n // ---------------------------------------------------------------------------\n\n /**\n * Centre frequency of the wah filter in Hz. Range 50..2000, default 200.\n * Changes are ramped smoothly via `setTargetAtTime`.\n */\n public get baseFrequency(): number {\n return this._baseFrequency;\n }\n\n public set baseFrequency(value: number) {\n this._baseFrequency = Math.max(50, Math.min(2000, value));\n if (this._setup) {\n this._setup.wahFilter.frequency.setTargetAtTime(this._baseFrequency, this._setup.wahFilter.context.currentTime, 0.01);\n }\n }\n\n /**\n * Envelope sensitivity in Hz/unit: the maximum filter sweep above\n * `baseFrequency` when input is at full amplitude. Range 0..6000, default 3000.\n * Changes are ramped smoothly via `setTargetAtTime`.\n */\n public get sensitivity(): number {\n return this._sensitivity;\n }\n\n public set sensitivity(value: number) {\n this._sensitivity = Math.max(0, Math.min(6000, value));\n if (this._setup) {\n this._setup.sensitivityGain.gain.setTargetAtTime(this._sensitivity, this._setup.sensitivityGain.context.currentTime, 0.01);\n }\n }\n\n /**\n * Q (resonance) of the bandpass wah filter. Range 0.1..20, default 4.\n * Changes are ramped smoothly via `setTargetAtTime`.\n */\n public get q(): number {\n return this._q;\n }\n\n public set q(value: number) {\n this._q = Math.max(0.1, Math.min(20, value));\n if (this._setup) {\n this._setup.wahFilter.Q.setTargetAtTime(this._q, this._setup.wahFilter.context.currentTime, 0.01);\n }\n }\n\n /**\n * Envelope smoothing time constant in milliseconds. Range 1..500, default 30.\n * Updating this adjusts the smoothing lowpass cutoff immediately via\n * `setTargetAtTime`.\n */\n public get responseMs(): number {\n return this._responseMs;\n }\n\n public set responseMs(value: number) {\n this._responseMs = Math.max(1, Math.min(500, value));\n if (this._setup) {\n this._setup.smoothingLowpass.frequency.setTargetAtTime(this._smoothingCutoff(), this._setup.smoothingLowpass.context.currentTime, 0.01);\n }\n }\n\n /**\n * Wet (wah-filtered) mix level, 0..1. The dry level is automatically\n * `1 - wet`. Changes are ramped smoothly via `setTargetAtTime`. Default 0.7.\n */\n public get wet(): number {\n return this._wet;\n }\n\n public set wet(value: number) {\n this._wet = Math.max(0, Math.min(1, value));\n if (this._setup) {\n const ctx = this._setup.wetGain.context;\n this._setup.wetGain.gain.setTargetAtTime(this._wet, ctx.currentTime, 0.01);\n this._setup.dryGain.gain.setTargetAtTime(1 - this._wet, ctx.currentTime, 0.01);\n }\n }\n\n // ---------------------------------------------------------------------------\n // Lifecycle\n // ---------------------------------------------------------------------------\n\n public override destroy(): void {\n this._teardown();\n if (this._setup) {\n this._setup.inputGain.disconnect();\n this._setup.dryGain.disconnect();\n this._setup.wetGain.disconnect();\n this._setup.sensitivityGain.disconnect();\n this._setup.wahFilter.disconnect();\n this._setup.smoothingLowpass.disconnect();\n this._setup.rectifier.disconnect();\n this._setup.outputGain.disconnect();\n this._setup = null;\n }\n }\n\n // ---------------------------------------------------------------------------\n // Private\n // ---------------------------------------------------------------------------\n\n /** Converts `responseMs` to a lowpass cutoff frequency using f = 1/(2π×τ). */\n private _smoothingCutoff(): number {\n return 1000 / (2 * Math.PI * this._responseMs);\n }\n\n /**\n * Builds a 256-point `Float32Array` curve approximating the full-wave\n * rectifier `f(x) = |x|` for use with `WaveShaperNode`.\n */\n private static _makeRectifierCurve(): Float32Array<ArrayBuffer> {\n const n = 256;\n const curve = new Float32Array(n);\n for (let i = 0; i < n; i++) {\n const x = (i * 2) / (n - 1) - 1; // maps index to -1..1\n curve[i] = Math.abs(x);\n }\n return curve;\n }\n\n private _setupNodes(ctx: AudioContext): void {\n // Audio-path gain nodes (createGain order: 0=inputGain, 1=outputGain,\n // 2=dryGain, 3=wetGain, 4=sensitivityGain).\n const inputGain = ctx.createGain();\n const outputGain = ctx.createGain();\n const dryGain = ctx.createGain();\n const wetGain = ctx.createGain();\n const sensitivityGain = ctx.createGain();\n\n // Wah filter (audio path) and smoothing filter (envelope control path)\n // (createBiquadFilter order: 0=wahFilter, 1=smoothingLowpass).\n const wahFilter = ctx.createBiquadFilter();\n const smoothingLowpass = ctx.createBiquadFilter();\n\n // Full-wave rectifier for the envelope follower.\n const rectifier = ctx.createWaveShaper();\n\n // ── Initialize values ────────────────────────────────────────────────────\n\n inputGain.gain.setValueAtTime(1, ctx.currentTime);\n outputGain.gain.setValueAtTime(1, ctx.currentTime);\n dryGain.gain.setValueAtTime(1 - this._wet, ctx.currentTime);\n wetGain.gain.setValueAtTime(this._wet, ctx.currentTime);\n sensitivityGain.gain.setValueAtTime(this._sensitivity, ctx.currentTime);\n\n // Wah bandpass filter: base frequency and Q; envelope signal adds on top.\n wahFilter.type = 'bandpass';\n wahFilter.frequency.setValueAtTime(this._baseFrequency, ctx.currentTime);\n wahFilter.Q.setValueAtTime(this._q, ctx.currentTime);\n\n // Rectifier: full-wave |x| curve; 4× oversampling for accuracy.\n rectifier.curve = AutoWahEffect._makeRectifierCurve();\n rectifier.oversample = '4x';\n\n // Smoothing lowpass: cutoff derived from responseMs; low Q for no ringing.\n smoothingLowpass.type = 'lowpass';\n smoothingLowpass.frequency.setValueAtTime(this._smoothingCutoff(), ctx.currentTime);\n smoothingLowpass.Q.setValueAtTime(0.5, ctx.currentTime);\n\n // ── Wiring ───────────────────────────────────────────────────────────────\n\n // Dry path: inputGain → dryGain → outputGain\n inputGain.connect(dryGain);\n dryGain.connect(outputGain);\n\n // Wet (audio) path: inputGain → wahFilter → wetGain → outputGain\n inputGain.connect(wahFilter);\n wahFilter.connect(wetGain);\n wetGain.connect(outputGain);\n\n // Envelope (control) path - parallel off inputGain, drives wahFilter.frequency.\n // The rectified+smoothed signal is scaled by sensitivityGain and summed into\n // the wahFilter frequency AudioParam, sweeping the filter with input loudness.\n inputGain.connect(rectifier);\n rectifier.connect(smoothingLowpass);\n smoothingLowpass.connect(sensitivityGain);\n sensitivityGain.connect(wahFilter.frequency as unknown as AudioNode);\n\n this._setup = { inputGain, outputGain, dryGain, wetGain, sensitiv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