@codexo/exojs-audio-fx 0.15.2 → 0.16.0

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 (114) hide show
  1. package/dist/esm/AudioAnalyser.d.ts +4 -3
  2. package/dist/esm/AudioAnalyser.d.ts.map +1 -0
  3. package/dist/esm/AudioAnalyser.js +365 -468
  4. package/dist/esm/AudioAnalyser.js.map +1 -1
  5. package/dist/esm/BeatDetector.d.ts +16 -15
  6. package/dist/esm/BeatDetector.d.ts.map +1 -0
  7. package/dist/esm/BeatDetector.js +370 -428
  8. package/dist/esm/BeatDetector.js.map +1 -1
  9. package/dist/esm/dsp/fft.d.ts +5 -5
  10. package/dist/esm/dsp/fft.d.ts.map +1 -0
  11. package/dist/esm/dsp/mel.d.ts +6 -6
  12. package/dist/esm/dsp/mel.d.ts.map +1 -0
  13. package/dist/esm/dsp/mel.js +55 -64
  14. package/dist/esm/dsp/mel.js.map +1 -1
  15. package/dist/esm/dsp/tempogram.d.ts +60 -20
  16. package/dist/esm/dsp/tempogram.d.ts.map +1 -0
  17. package/dist/esm/effects/AutoWahEffect.d.ts +3 -2
  18. package/dist/esm/effects/AutoWahEffect.d.ts.map +1 -0
  19. package/dist/esm/effects/AutoWahEffect.js +210 -237
  20. package/dist/esm/effects/AutoWahEffect.js.map +1 -1
  21. package/dist/esm/effects/BitCrusherEffect.d.ts +3 -2
  22. package/dist/esm/effects/BitCrusherEffect.d.ts.map +1 -0
  23. package/dist/esm/effects/BitCrusherEffect.js +72 -70
  24. package/dist/esm/effects/BitCrusherEffect.js.map +1 -1
  25. package/dist/esm/effects/ChorusEffect.d.ts +2 -1
  26. package/dist/esm/effects/ChorusEffect.d.ts.map +1 -0
  27. package/dist/esm/effects/ChorusEffect.js +132 -150
  28. package/dist/esm/effects/ChorusEffect.js.map +1 -1
  29. package/dist/esm/effects/CompressorEffect.d.ts +2 -1
  30. package/dist/esm/effects/CompressorEffect.d.ts.map +1 -0
  31. package/dist/esm/effects/CompressorEffect.js +104 -118
  32. package/dist/esm/effects/CompressorEffect.js.map +1 -1
  33. package/dist/esm/effects/ConvolutionEffect.d.ts +10 -5
  34. package/dist/esm/effects/ConvolutionEffect.d.ts.map +1 -0
  35. package/dist/esm/effects/ConvolutionEffect.js +208 -189
  36. package/dist/esm/effects/ConvolutionEffect.js.map +1 -1
  37. package/dist/esm/effects/DelayEffect.d.ts +1 -0
  38. package/dist/esm/effects/DelayEffect.d.ts.map +1 -0
  39. package/dist/esm/effects/DelayEffect.js +105 -109
  40. package/dist/esm/effects/DelayEffect.js.map +1 -1
  41. package/dist/esm/effects/DistortionEffect.d.ts +4 -3
  42. package/dist/esm/effects/DistortionEffect.d.ts.map +1 -0
  43. package/dist/esm/effects/DistortionEffect.js +190 -195
  44. package/dist/esm/effects/DistortionEffect.js.map +1 -1
  45. package/dist/esm/effects/DuckingEffect.d.ts +3 -2
  46. package/dist/esm/effects/DuckingEffect.d.ts.map +1 -0
  47. package/dist/esm/effects/DuckingEffect.js +91 -172
  48. package/dist/esm/effects/DuckingEffect.js.map +1 -1
  49. package/dist/esm/effects/EqualizerEffect.d.ts +1 -0
  50. package/dist/esm/effects/EqualizerEffect.d.ts.map +1 -0
  51. package/dist/esm/effects/EqualizerEffect.js +120 -133
  52. package/dist/esm/effects/EqualizerEffect.js.map +1 -1
  53. package/dist/esm/effects/FlangerEffect.d.ts +7 -6
  54. package/dist/esm/effects/FlangerEffect.d.ts.map +1 -0
  55. package/dist/esm/effects/FlangerEffect.js +172 -201
  56. package/dist/esm/effects/FlangerEffect.js.map +1 -1
  57. package/dist/esm/effects/GranularEffect.d.ts +3 -2
  58. package/dist/esm/effects/GranularEffect.d.ts.map +1 -0
  59. package/dist/esm/effects/GranularEffect.js +100 -95
  60. package/dist/esm/effects/GranularEffect.js.map +1 -1
  61. package/dist/esm/effects/LimiterEffect.d.ts +1 -0
  62. package/dist/esm/effects/LimiterEffect.d.ts.map +1 -0
  63. package/dist/esm/effects/LimiterEffect.js +182 -194
  64. package/dist/esm/effects/LimiterEffect.js.map +1 -1
  65. package/dist/esm/effects/PhaserEffect.d.ts +2 -1
  66. package/dist/esm/effects/PhaserEffect.d.ts.map +1 -0
  67. package/dist/esm/effects/PhaserEffect.js +214 -254
  68. package/dist/esm/effects/PhaserEffect.js.map +1 -1
  69. package/dist/esm/effects/PingPongDelayEffect.d.ts +2 -1
  70. package/dist/esm/effects/PingPongDelayEffect.d.ts.map +1 -0
  71. package/dist/esm/effects/PingPongDelayEffect.js +172 -185
  72. package/dist/esm/effects/PingPongDelayEffect.js.map +1 -1
  73. package/dist/esm/effects/PitchShiftEffect.d.ts +3 -2
  74. package/dist/esm/effects/PitchShiftEffect.d.ts.map +1 -0
  75. package/dist/esm/effects/PitchShiftEffect.js +60 -60
  76. package/dist/esm/effects/PitchShiftEffect.js.map +1 -1
  77. package/dist/esm/effects/ReverbEffect.d.ts +2 -1
  78. package/dist/esm/effects/ReverbEffect.d.ts.map +1 -0
  79. package/dist/esm/effects/ReverbEffect.js +113 -117
  80. package/dist/esm/effects/ReverbEffect.js.map +1 -1
  81. package/dist/esm/effects/RingModulatorEffect.d.ts +4 -3
  82. package/dist/esm/effects/RingModulatorEffect.d.ts.map +1 -0
  83. package/dist/esm/effects/RingModulatorEffect.js +153 -161
  84. package/dist/esm/effects/RingModulatorEffect.js.map +1 -1
  85. package/dist/esm/effects/TremoloEffect.d.ts +1 -0
  86. package/dist/esm/effects/TremoloEffect.d.ts.map +1 -0
  87. package/dist/esm/effects/TremoloEffect.js +193 -201
  88. package/dist/esm/effects/TremoloEffect.js.map +1 -1
  89. package/dist/esm/effects/VocoderEffect.d.ts +2 -1
  90. package/dist/esm/effects/VocoderEffect.d.ts.map +1 -0
  91. package/dist/esm/effects/VocoderEffect.js +69 -80
  92. package/dist/esm/effects/VocoderEffect.js.map +1 -1
  93. package/dist/esm/index.d.ts +2 -1
  94. package/dist/esm/index.d.ts.map +1 -0
  95. package/dist/esm/index.js +23 -22
  96. package/dist/esm/worklets/beat-detector.worklet.js +5 -1162
  97. package/dist/esm/worklets/beat-detector.worklet.js.map +1 -1
  98. package/dist/esm/worklets/bit-crusher.worklet.js +5 -44
  99. package/dist/esm/worklets/bit-crusher.worklet.js.map +1 -1
  100. package/dist/esm/worklets/ducking.worklet.js +6 -0
  101. package/dist/esm/worklets/ducking.worklet.js.map +1 -0
  102. package/dist/esm/worklets/granular.worklet.js +5 -97
  103. package/dist/esm/worklets/granular.worklet.js.map +1 -1
  104. package/dist/esm/worklets/pitch-shift.worklet.js +5 -128
  105. package/dist/esm/worklets/pitch-shift.worklet.js.map +1 -1
  106. package/dist/esm/worklets/vocoder.worklet.js +5 -93
  107. package/dist/esm/worklets/vocoder.worklet.js.map +1 -1
  108. package/package.json +7 -7
  109. package/dist/esm/index.js.map +0 -1
  110. package/dist/esm/worklets/beat-detector.worklet.d.ts +0 -1
  111. package/dist/esm/worklets/bit-crusher.worklet.d.ts +0 -1
  112. package/dist/esm/worklets/granular.worklet.d.ts +0 -1
  113. package/dist/esm/worklets/pitch-shift.worklet.d.ts +0 -1
  114. package/dist/esm/worklets/vocoder.worklet.d.ts +0 -1
@@ -1,193 +1,212 @@
1
- import { AudioEffect, onAudioContextReady, isAudioContextReady, getAudioContext, Sound } from '@codexo/exojs';
1
+ import { AudioEffect, Sound, getAudioContext, isAudioContextReady, onAudioContextReady } from "@codexo/exojs";
2
2
 
3
+ //#region src/effects/ConvolutionEffect.ts
3
4
  /**
4
- * Convolution effect that convolves the input signal with a user-supplied
5
- * impulse response (IR). Unlike {@link ReverbEffect}, which generates a
6
- * procedural noise-based IR, `ConvolutionEffect` accepts a *real* decoded IR —
7
- * enabling convolution reverb from acoustic-space captures, cabinet/speaker
8
- * simulations, telephone/pipe character filtering, and any other linear
9
- * time-invariant transformation.
10
- *
11
- * Pass the IR as an `AudioBuffer` (typically decoded via
12
- * `AudioContext.decodeAudioData`) or as a `Sound` (its `audioBuffer` is used).
13
- * Omitting the IR leaves `convolver.buffer` as `null`, making the wet path
14
- * silent and the effect act as a passthrough until {@link setImpulse} is
15
- * called — safe to add to a bus before an IR is available.
16
- *
17
- * Node graph:
18
- * ```
19
- * input(GainNode) → dryGain → output(GainNode)
20
- * input → convolver → wetGain → output
21
- * ```
22
- * Gains: `dryGain.gain = 1 - wet`; `wetGain.gain = wet × gain`.
23
- *
24
- * @example
25
- * ```ts
26
- * await loader.load(Sound, { hall: 'hall.wav' });
27
- * const reverb = new ConvolutionEffect({ impulse: loader.get(Sound, 'hall'), wet: 0.6 });
28
- * bus.addEffect(reverb);
29
- * ```
30
- */
31
- class ConvolutionEffect extends AudioEffect {
32
- _setup = null;
33
- _wet;
34
- _normalize;
35
- _gain;
36
- _pendingImpulse;
37
- _onAudioContextReady = (ctx) => {
38
- onAudioContextReady.remove(this._onAudioContextReady);
39
- this._setupNodes(ctx);
40
- };
41
- constructor(options = {}) {
42
- super();
43
- this._wet = Math.max(0, Math.min(1, options.wet ?? 1));
44
- this._normalize = options.normalize ?? true;
45
- this._gain = Math.max(0, Math.min(4, options.gain ?? 1));
46
- this._pendingImpulse = options.impulse ?? null;
47
- if (isAudioContextReady()) {
48
- this._setupNodes(getAudioContext());
49
- }
50
- else {
51
- onAudioContextReady.add(this._onAudioContextReady);
52
- }
53
- }
54
- /**
55
- * The node where audio enters this effect. Throws if the audio context is
56
- * not yet initialized.
57
- */
58
- get inputNode() {
59
- if (!this._setup)
60
- throw new Error('ConvolutionEffect not yet initialized.');
61
- return this._setup.inputGain;
62
- }
63
- /**
64
- * The node where audio exits this effect. Throws if the audio context is
65
- * not yet initialized.
66
- */
67
- get outputNode() {
68
- if (!this._setup)
69
- throw new Error('ConvolutionEffect not yet initialized.');
70
- return this._setup.outputGain;
71
- }
72
- /**
73
- * Wet (convolved) mix level, 0..1. The dry level is automatically `1 - wet`.
74
- * Changes are ramped smoothly via `setTargetAtTime`. Default 1.0.
75
- */
76
- get wet() {
77
- return this._wet;
78
- }
79
- set wet(value) {
80
- this._wet = Math.max(0, Math.min(1, value));
81
- if (this._setup) {
82
- const ctx = this._setup.wetGain.context;
83
- this._setup.wetGain.gain.setTargetAtTime(this._wet * this._gain, ctx.currentTime, 0.01);
84
- this._setup.dryGain.gain.setTargetAtTime(1 - this._wet, ctx.currentTime, 0.01);
85
- }
86
- }
87
- /**
88
- * Whether the browser normalizes the IR for equal-power loudness. Mirrors
89
- * `ConvolverNode.normalize`. Default `true`.
90
- *
91
- * Changing this at runtime re-assigns the current buffer so the new value
92
- * takes effect (a Web Audio requirement: `normalize` is only applied on
93
- * buffer assignment).
94
- */
95
- get normalize() {
96
- return this._normalize;
97
- }
98
- set normalize(value) {
99
- this._normalize = value;
100
- if (this._setup) {
101
- const { convolver } = this._setup;
102
- convolver.normalize = this._normalize;
103
- if (convolver.buffer !== null) {
104
- // Re-assign so the new normalize value takes effect immediately.
105
- // (The Web Audio spec only applies normalize on buffer assignment.)
106
- const current = convolver.buffer;
107
- convolver.buffer = current;
108
- }
109
- }
110
- }
111
- /**
112
- * Makeup gain multiplier applied to the wet path. Range 0..4, default 1.
113
- * Adjusting this changes the wet-path amplitude without altering the
114
- * dry/wet balance ratio.
115
- */
116
- get gain() {
117
- return this._gain;
118
- }
119
- set gain(value) {
120
- this._gain = Math.max(0, Math.min(4, value));
121
- if (this._setup) {
122
- const ctx = this._setup.wetGain.context;
123
- this._setup.wetGain.gain.setTargetAtTime(this._wet * this._gain, ctx.currentTime, 0.01);
124
- }
125
- }
126
- /**
127
- * Set or replace the impulse response. Accepts a decoded `AudioBuffer`, a
128
- * `Sound` (its `audioBuffer` is used), or `null` to clear the IR (wet path
129
- * goes silent). Safe to call before the audio context is ready — the impulse
130
- * is stored and applied once nodes are created.
131
- *
132
- * **Web Audio note:** `normalize` is written to the convolver *before*
133
- * `buffer` is assigned, as required by the spec for the value to take effect.
134
- */
135
- setImpulse(ir) {
136
- const resolved = this._resolveBuffer(ir);
137
- if (this._setup) {
138
- const { convolver } = this._setup;
139
- convolver.normalize = this._normalize;
140
- convolver.buffer = resolved;
141
- }
142
- else {
143
- // Store for application in _setupNodes once the context is ready.
144
- this._pendingImpulse = ir;
145
- }
146
- }
147
- destroy() {
148
- onAudioContextReady.remove(this._onAudioContextReady);
149
- if (this._setup) {
150
- this._setup.inputGain.disconnect();
151
- this._setup.convolver.disconnect();
152
- this._setup.dryGain.disconnect();
153
- this._setup.wetGain.disconnect();
154
- this._setup.outputGain.disconnect();
155
- this._setup = null;
156
- }
157
- }
158
- _resolveBuffer(ir) {
159
- if (ir === null)
160
- return null;
161
- if (ir instanceof Sound)
162
- return ir.audioBuffer;
163
- return ir;
164
- }
165
- _setupNodes(ctx) {
166
- const inputGain = ctx.createGain();
167
- const outputGain = ctx.createGain();
168
- const convolver = ctx.createConvolver();
169
- const dryGain = ctx.createGain();
170
- const wetGain = ctx.createGain();
171
- inputGain.gain.setValueAtTime(1, ctx.currentTime);
172
- outputGain.gain.setValueAtTime(1, ctx.currentTime);
173
- dryGain.gain.setValueAtTime(1 - this._wet, ctx.currentTime);
174
- wetGain.gain.setValueAtTime(this._wet * this._gain, ctx.currentTime);
175
- // Web Audio requirement: set normalize BEFORE assigning buffer.
176
- convolver.normalize = this._normalize;
177
- if (this._pendingImpulse !== null) {
178
- convolver.buffer = this._resolveBuffer(this._pendingImpulse);
179
- this._pendingImpulse = null;
180
- }
181
- // Dry path: input → dryGain → output
182
- inputGain.connect(dryGain);
183
- dryGain.connect(outputGain);
184
- // Wet path: input → convolver → wetGain → output
185
- inputGain.connect(convolver);
186
- convolver.connect(wetGain);
187
- wetGain.connect(outputGain);
188
- this._setup = { inputGain, outputGain, convolver, dryGain, wetGain };
189
- }
190
- }
5
+ * Render `buffer` at `sampleRate`. Used for impulse responses, which a
6
+ * `ConvolverNode` only accepts at its own context's rate.
7
+ */
8
+ const resampleBuffer = async (buffer, sampleRate) => {
9
+ const frames = Math.max(1, Math.ceil(buffer.length / buffer.sampleRate * sampleRate));
10
+ const offline = new OfflineAudioContext(buffer.numberOfChannels, frames, sampleRate);
11
+ const source = offline.createBufferSource();
12
+ source.buffer = buffer;
13
+ source.connect(offline.destination);
14
+ source.start();
15
+ return offline.startRendering();
16
+ };
17
+ /**
18
+ * Convolution effect that convolves the input signal with a user-supplied
19
+ * impulse response (IR). Unlike {@link ReverbEffect}, which generates a
20
+ * procedural noise-based IR, `ConvolutionEffect` accepts a *real* decoded IR -
21
+ * enabling convolution reverb from acoustic-space captures, cabinet/speaker
22
+ * simulations, telephone/pipe character filtering, and any other linear
23
+ * time-invariant transformation.
24
+ *
25
+ * Pass the IR as an `AudioBuffer` (typically decoded via
26
+ * `AudioContext.decodeAudioData`) or as a `Sound` (its `audioBuffer` is used).
27
+ * Omitting the IR leaves `convolver.buffer` as `null`, making the wet path
28
+ * silent and the effect act as a passthrough until {@link setImpulse} is
29
+ * called - safe to add to a bus before an IR is available.
30
+ *
31
+ * Node graph:
32
+ * ```
33
+ * input(GainNode) → dryGain → output(GainNode)
34
+ * input → convolver → wetGain → output
35
+ * ```
36
+ * Gains: `dryGain.gain = 1 - wet`; `wetGain.gain = wet × gain`.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const hall = await loader.load(Asset.type('sound', 'hall.wav'));
41
+ * const reverb = new ConvolutionEffect({ impulse: hall, wet: 0.6 });
42
+ * bus.addEffect(reverb);
43
+ * ```
44
+ */
45
+ var ConvolutionEffect = class extends AudioEffect {
46
+ _setup = null;
47
+ _wet;
48
+ _normalize;
49
+ _gain;
50
+ _pendingImpulse;
51
+ /** Bumped per impulse request so a slow resample cannot overwrite a newer IR. */
52
+ _impulseGeneration = 0;
53
+ _onAudioContextReady = (ctx) => {
54
+ onAudioContextReady.remove(this._onAudioContextReady);
55
+ this._setupNodes(ctx);
56
+ };
57
+ constructor(options = {}) {
58
+ super();
59
+ this._wet = Math.max(0, Math.min(1, options.wet ?? 1));
60
+ this._normalize = options.normalize ?? true;
61
+ this._gain = Math.max(0, Math.min(4, options.gain ?? 1));
62
+ this._pendingImpulse = options.impulse ?? null;
63
+ if (isAudioContextReady()) this._setupNodes(getAudioContext());
64
+ else onAudioContextReady.add(this._onAudioContextReady);
65
+ }
66
+ /**
67
+ * The node where audio enters this effect. Throws if the audio context is
68
+ * not yet initialized.
69
+ */
70
+ get inputNode() {
71
+ if (!this._setup) throw new Error("ConvolutionEffect not yet initialized.");
72
+ return this._setup.inputGain;
73
+ }
74
+ /**
75
+ * The node where audio exits this effect. Throws if the audio context is
76
+ * not yet initialized.
77
+ */
78
+ get outputNode() {
79
+ if (!this._setup) throw new Error("ConvolutionEffect not yet initialized.");
80
+ return this._setup.outputGain;
81
+ }
82
+ /**
83
+ * Wet (convolved) mix level, 0..1. The dry level is automatically `1 - wet`.
84
+ * Changes are ramped smoothly via `setTargetAtTime`. Default 1.0.
85
+ */
86
+ get wet() {
87
+ return this._wet;
88
+ }
89
+ set wet(value) {
90
+ this._wet = Math.max(0, Math.min(1, value));
91
+ if (this._setup) {
92
+ const ctx = this._setup.wetGain.context;
93
+ this._setup.wetGain.gain.setTargetAtTime(this._wet * this._gain, ctx.currentTime, .01);
94
+ this._setup.dryGain.gain.setTargetAtTime(1 - this._wet, ctx.currentTime, .01);
95
+ }
96
+ }
97
+ /**
98
+ * Whether the browser normalizes the IR for equal-power loudness. Mirrors
99
+ * `ConvolverNode.normalize`. Default `true`.
100
+ *
101
+ * Changing this at runtime re-assigns the current buffer so the new value
102
+ * takes effect (a Web Audio requirement: `normalize` is only applied on
103
+ * buffer assignment).
104
+ */
105
+ get normalize() {
106
+ return this._normalize;
107
+ }
108
+ set normalize(value) {
109
+ this._normalize = value;
110
+ if (this._setup) {
111
+ const { convolver } = this._setup;
112
+ convolver.normalize = this._normalize;
113
+ if (convolver.buffer !== null) convolver.buffer = convolver.buffer;
114
+ }
115
+ }
116
+ /**
117
+ * Makeup gain multiplier applied to the wet path. Range 0..4, default 1.
118
+ * Adjusting this changes the wet-path amplitude without altering the
119
+ * dry/wet balance ratio.
120
+ */
121
+ get gain() {
122
+ return this._gain;
123
+ }
124
+ set gain(value) {
125
+ this._gain = Math.max(0, Math.min(4, value));
126
+ if (this._setup) {
127
+ const ctx = this._setup.wetGain.context;
128
+ this._setup.wetGain.gain.setTargetAtTime(this._wet * this._gain, ctx.currentTime, .01);
129
+ }
130
+ }
131
+ /**
132
+ * Set or replace the impulse response. Accepts a decoded `AudioBuffer`, a
133
+ * `Sound` (its `audioBuffer` is used), or `null` to clear the IR (wet path
134
+ * goes silent). Safe to call before the audio context is ready - the impulse
135
+ * is stored and applied once nodes are created.
136
+ *
137
+ * **Web Audio note:** `normalize` is written to the convolver *before*
138
+ * `buffer` is assigned, as required by the spec for the value to take effect.
139
+ */
140
+ setImpulse(ir) {
141
+ const generation = ++this._impulseGeneration;
142
+ if (!this._setup) {
143
+ this._pendingImpulse = ir;
144
+ return;
145
+ }
146
+ const resolved = this._resolveBuffer(ir);
147
+ const rate = this._setup.convolver.context.sampleRate;
148
+ if (resolved === null || resolved.sampleRate === rate) {
149
+ this._applyImpulse(resolved);
150
+ return;
151
+ }
152
+ resampleBuffer(resolved, rate).then((converted) => {
153
+ if (this._impulseGeneration === generation && this._setup) this._applyImpulse(converted);
154
+ });
155
+ }
156
+ /** Assign an IR that is known to match the context rate. */
157
+ _applyImpulse(buffer) {
158
+ if (!this._setup) return;
159
+ const { convolver } = this._setup;
160
+ convolver.normalize = this._normalize;
161
+ convolver.buffer = buffer;
162
+ }
163
+ destroy() {
164
+ onAudioContextReady.remove(this._onAudioContextReady);
165
+ if (this._setup) {
166
+ this._setup.inputGain.disconnect();
167
+ this._setup.convolver.disconnect();
168
+ this._setup.dryGain.disconnect();
169
+ this._setup.wetGain.disconnect();
170
+ this._setup.outputGain.disconnect();
171
+ this._setup = null;
172
+ }
173
+ }
174
+ _resolveBuffer(ir) {
175
+ if (ir === null) return null;
176
+ if (ir instanceof Sound) return ir.audioBuffer;
177
+ return ir;
178
+ }
179
+ _setupNodes(ctx) {
180
+ const inputGain = ctx.createGain();
181
+ const outputGain = ctx.createGain();
182
+ const convolver = ctx.createConvolver();
183
+ const dryGain = ctx.createGain();
184
+ const wetGain = ctx.createGain();
185
+ inputGain.gain.setValueAtTime(1, ctx.currentTime);
186
+ outputGain.gain.setValueAtTime(1, ctx.currentTime);
187
+ dryGain.gain.setValueAtTime(1 - this._wet, ctx.currentTime);
188
+ wetGain.gain.setValueAtTime(this._wet * this._gain, ctx.currentTime);
189
+ convolver.normalize = this._normalize;
190
+ inputGain.connect(dryGain);
191
+ dryGain.connect(outputGain);
192
+ inputGain.connect(convolver);
193
+ convolver.connect(wetGain);
194
+ wetGain.connect(outputGain);
195
+ this._setup = {
196
+ inputGain,
197
+ outputGain,
198
+ convolver,
199
+ dryGain,
200
+ wetGain
201
+ };
202
+ if (this._pendingImpulse !== null) {
203
+ const pending = this._pendingImpulse;
204
+ this._pendingImpulse = null;
205
+ this.setImpulse(pending);
206
+ }
207
+ }
208
+ };
191
209
 
210
+ //#endregion
192
211
  export { ConvolutionEffect };
193
- //# sourceMappingURL=ConvolutionEffect.js.map
212
+ //# sourceMappingURL=ConvolutionEffect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConvolutionEffect.js","sources":["../../../../src/effects/ConvolutionEffect.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAyCA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;AACG,MAAO,iBAAkB,SAAQ,WAAW,CAAA;IACxC,MAAM,GAAkC,IAAI;AAC5C,IAAA,IAAI;AACJ,IAAA,UAAU;AACV,IAAA,KAAK;AACL,IAAA,eAAe;AACN,IAAA,oBAAoB,GAAG,CAAC,GAAiB,KAAU;AAClE,QAAA,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC;AACrD,QAAA,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;AACvB,IAAA,CAAC;AAED,IAAA,WAAA,CAAmB,UAAoC,EAAE,EAAA;AACvD,QAAA,KAAK,EAAE;QACP,IAAI,CAAC,IAAI,GAAG,IAAI,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 {"version":3,"file":"ConvolutionEffect.js","names":[],"sources":["../../../src/effects/ConvolutionEffect.ts"],"sourcesContent":["import { AudioEffect, getAudioContext, isAudioContextReady, onAudioContextReady, Sound } from '@codexo/exojs';\n\n/** Construction options for {@link ConvolutionEffect}. */\nexport interface ConvolutionEffectOptions {\n /**\n * Impulse response. Accepts a decoded `AudioBuffer` or a `Sound` (its\n * `audioBuffer` is used). If omitted the effect runs dry (passthrough) until\n * {@link ConvolutionEffect.setImpulse} is called.\n */\n impulse?: AudioBuffer | Sound;\n /**\n * Dry/wet mix, 0..1. The dry level is automatically `1 - wet`. Default 1.0.\n */\n wet?: number;\n /**\n * Maps to `ConvolverNode.normalize`. When `true` the browser applies an\n * equal-power normalization pass on the IR so different IRs play at a\n * consistent perceived loudness. Default `true` (the Web Audio spec default).\n *\n * **Note:** the Web Audio spec only respects `normalize` if it is set\n * *before* `buffer` is assigned. This class always writes `normalize` first.\n * Changing `normalize` at runtime while an IR is loaded re-assigns the\n * buffer so the new value takes effect.\n */\n normalize?: boolean;\n /**\n * Optional makeup gain multiplier applied to the wet path. Useful when the\n * IR is very quiet or very loud and `normalize` is off. Range 0..4,\n * default 1.\n */\n gain?: number;\n}\n\n/**\n * Render `buffer` at `sampleRate`. Used for impulse responses, which a\n * `ConvolverNode` only accepts at its own context's rate.\n */\nconst resampleBuffer = async (buffer: AudioBuffer, sampleRate: number): Promise<AudioBuffer> => {\n const frames = Math.max(1, Math.ceil((buffer.length / buffer.sampleRate) * sampleRate));\n const offline = new OfflineAudioContext(buffer.numberOfChannels, frames, sampleRate);\n const source = offline.createBufferSource();\n\n source.buffer = buffer;\n source.connect(offline.destination);\n source.start();\n\n return offline.startRendering();\n};\n\ninterface ConvolutionEffectSetup {\n readonly inputGain: GainNode;\n readonly outputGain: GainNode;\n readonly convolver: ConvolverNode;\n readonly dryGain: GainNode;\n readonly wetGain: GainNode;\n}\n\n/**\n * Convolution effect that convolves the input signal with a user-supplied\n * impulse response (IR). Unlike {@link ReverbEffect}, which generates a\n * procedural noise-based IR, `ConvolutionEffect` accepts a *real* decoded IR -\n * enabling convolution reverb from acoustic-space captures, cabinet/speaker\n * simulations, telephone/pipe character filtering, and any other linear\n * time-invariant transformation.\n *\n * Pass the IR as an `AudioBuffer` (typically decoded via\n * `AudioContext.decodeAudioData`) or as a `Sound` (its `audioBuffer` is used).\n * Omitting the IR leaves `convolver.buffer` as `null`, making the wet path\n * silent and the effect act as a passthrough until {@link setImpulse} is\n * called - safe to add to a bus before an IR is available.\n *\n * Node graph:\n * ```\n * input(GainNode) → dryGain → output(GainNode)\n * input → convolver → wetGain → output\n * ```\n * Gains: `dryGain.gain = 1 - wet`; `wetGain.gain = wet × gain`.\n *\n * @example\n * ```ts\n * const hall = await loader.load(Asset.type('sound', 'hall.wav'));\n * const reverb = new ConvolutionEffect({ impulse: hall, wet: 0.6 });\n * bus.addEffect(reverb);\n * ```\n */\nexport class ConvolutionEffect extends AudioEffect {\n private _setup: ConvolutionEffectSetup | null = null;\n private _wet: number;\n private _normalize: boolean;\n private _gain: number;\n private _pendingImpulse: AudioBuffer | Sound | null;\n\n /** Bumped per impulse request so a slow resample cannot overwrite a newer IR. */\n private _impulseGeneration = 0;\n private readonly _onAudioContextReady = (ctx: AudioContext): void => {\n onAudioContextReady.remove(this._onAudioContextReady);\n this._setupNodes(ctx);\n };\n\n public constructor(options: ConvolutionEffectOptions = {}) {\n super();\n this._wet = Math.max(0, Math.min(1, options.wet ?? 1));\n this._normalize = options.normalize ?? true;\n this._gain = Math.max(0, Math.min(4, options.gain ?? 1));\n this._pendingImpulse = options.impulse ?? null;\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('ConvolutionEffect 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('ConvolutionEffect not yet initialized.');\n return this._setup.outputGain;\n }\n\n /**\n * Wet (convolved) mix level, 0..1. The dry level is automatically `1 - wet`.\n * Changes are ramped smoothly via `setTargetAtTime`. Default 1.0.\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 * this._gain, ctx.currentTime, 0.01);\n this._setup.dryGain.gain.setTargetAtTime(1 - this._wet, ctx.currentTime, 0.01);\n }\n }\n\n /**\n * Whether the browser normalizes the IR for equal-power loudness. Mirrors\n * `ConvolverNode.normalize`. Default `true`.\n *\n * Changing this at runtime re-assigns the current buffer so the new value\n * takes effect (a Web Audio requirement: `normalize` is only applied on\n * buffer assignment).\n */\n public get normalize(): boolean {\n return this._normalize;\n }\n\n public set normalize(value: boolean) {\n this._normalize = value;\n if (this._setup) {\n const { convolver } = this._setup;\n convolver.normalize = this._normalize;\n if (convolver.buffer !== null) {\n // Re-assign so the new normalize value takes effect immediately.\n // (The Web Audio spec only applies normalize on buffer assignment.)\n const current = convolver.buffer;\n convolver.buffer = current;\n }\n }\n }\n\n /**\n * Makeup gain multiplier applied to the wet path. Range 0..4, default 1.\n * Adjusting this changes the wet-path amplitude without altering the\n * dry/wet balance ratio.\n */\n public get gain(): number {\n return this._gain;\n }\n\n public set gain(value: number) {\n this._gain = Math.max(0, Math.min(4, value));\n if (this._setup) {\n const ctx = this._setup.wetGain.context;\n this._setup.wetGain.gain.setTargetAtTime(this._wet * this._gain, ctx.currentTime, 0.01);\n }\n }\n\n /**\n * Set or replace the impulse response. Accepts a decoded `AudioBuffer`, a\n * `Sound` (its `audioBuffer` is used), or `null` to clear the IR (wet path\n * goes silent). Safe to call before the audio context is ready - the impulse\n * is stored and applied once nodes are created.\n *\n * **Web Audio note:** `normalize` is written to the convolver *before*\n * `buffer` is assigned, as required by the spec for the value to take effect.\n */\n public setImpulse(ir: AudioBuffer | Sound | null): void {\n const generation = ++this._impulseGeneration;\n\n if (!this._setup) {\n // Store for application in _setupNodes once the context is ready.\n this._pendingImpulse = ir;\n return;\n }\n\n const resolved = this._resolveBuffer(ir);\n const rate = this._setup.convolver.context.sampleRate;\n\n if (resolved === null || resolved.sampleRate === rate) {\n this._applyImpulse(resolved);\n return;\n }\n\n // A `ConvolverNode` rejects any buffer that is not already at the\n // context's sample rate - unlike an `AudioBufferSourceNode`, which\n // resamples as it plays. Assets decoded before a live context exists land\n // at the default rate, so an IR routinely needs a conversion pass first.\n // The wet path keeps the previous IR until the new one is converted.\n void resampleBuffer(resolved, rate).then(converted => {\n // A newer impulse may have been requested while this one converted.\n if (this._impulseGeneration === generation && this._setup) {\n this._applyImpulse(converted);\n }\n });\n }\n\n /** Assign an IR that is known to match the context rate. */\n private _applyImpulse(buffer: AudioBuffer | null): void {\n if (!this._setup) return;\n\n const { convolver } = this._setup;\n\n // Web Audio requirement: set normalize BEFORE assigning buffer.\n convolver.normalize = this._normalize;\n convolver.buffer = buffer;\n }\n\n public override destroy(): void {\n onAudioContextReady.remove(this._onAudioContextReady);\n if (this._setup) {\n this._setup.inputGain.disconnect();\n this._setup.convolver.disconnect();\n this._setup.dryGain.disconnect();\n this._setup.wetGain.disconnect();\n this._setup.outputGain.disconnect();\n this._setup = null;\n }\n }\n\n private _resolveBuffer(ir: AudioBuffer | Sound | null): AudioBuffer | null {\n if (ir === null) return null;\n if (ir instanceof Sound) return ir.audioBuffer;\n return ir;\n }\n\n private _setupNodes(ctx: AudioContext): void {\n const inputGain = ctx.createGain();\n const outputGain = ctx.createGain();\n const convolver = ctx.createConvolver();\n const dryGain = ctx.createGain();\n const wetGain = ctx.createGain();\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 * this._gain, ctx.currentTime);\n\n // Web Audio requirement: set normalize BEFORE assigning buffer.\n convolver.normalize = this._normalize;\n\n // Dry path: input → dryGain → output\n inputGain.connect(dryGain);\n dryGain.connect(outputGain);\n\n // Wet path: input → convolver → wetGain → output\n inputGain.connect(convolver);\n convolver.connect(wetGain);\n wetGain.connect(outputGain);\n\n this._setup = { inputGain, outputGain, convolver, dryGain, wetGain };\n\n // Now that a context exists, route any IR supplied earlier through the\n // same path as a runtime change - including the resample it may need.\n if (this._pendingImpulse !== null) {\n const pending = this._pendingImpulse;\n this._pendingImpulse = null;\n this.setImpulse(pending);\n }\n }\n}\n"],"mappings":";;;;;;;AAqCA,MAAM,iBAAiB,OAAO,QAAqB,eAA6C;CAC9F,MAAM,SAAS,KAAK,IAAI,GAAG,KAAK,KAAM,OAAO,SAAS,OAAO,aAAc,UAAU,CAAC;CACtF,MAAM,UAAU,IAAI,oBAAoB,OAAO,kBAAkB,QAAQ,UAAU;CACnF,MAAM,SAAS,QAAQ,mBAAmB;CAE1C,OAAO,SAAS;CAChB,OAAO,QAAQ,QAAQ,WAAW;CAClC,OAAO,MAAM;CAEb,OAAO,QAAQ,eAAe;AAChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,IAAa,oBAAb,cAAuC,YAAY;CACjD,AAAQ,SAAwC;CAChD,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;;CAGR,AAAQ,qBAAqB;CAC7B,AAAiB,wBAAwB,QAA4B;EACnE,oBAAoB,OAAO,KAAK,oBAAoB;EACpD,KAAK,YAAY,GAAG;CACtB;CAEA,AAAO,YAAY,UAAoC,CAAC,GAAG;EACzD,MAAM;EACN,KAAK,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,QAAQ,OAAO,CAAC,CAAC;EACrD,KAAK,aAAa,QAAQ,aAAa;EACvC,KAAK,QAAQ,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG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AAK,eAAe,GAAG,IAAI,WAAW;EACjD,QAAQ,KAAK,eAAe,IAAI,KAAK,MAAM,IAAI,WAAW;EAC1D,QAAQ,KAAK,eAAe,KAAK,OAAO,KAAK,OAAO,IAAI,WAAW;EAGnE,UAAU,YAAY,KAAK;EAG3B,UAAU,QAAQ,OAAO;EACzB,QAAQ,QAAQ,UAAU;EAG1B,UAAU,QAAQ,SAAS;EAC3B,UAAU,QAAQ,OAAO;EACzB,QAAQ,QAAQ,UAAU;EAE1B,KAAK,SAAS;GAAE;GAAW;GAAY;GAAW;GAAS;EAAQ;EAInE,IAAI,KAAK,oBAAoB,MAAM;GACjC,MAAM,UAAU,KAAK;GACrB,KAAK,kBAAkB;GACvB,KAAK,WAAW,OAAO;EACzB;CACF;AACF"}
@@ -33,3 +33,4 @@ export declare class DelayEffect extends AudioEffect {
33
33
  destroy(): void;
34
34
  private _setupNodes;
35
35
  }
36
+ //# sourceMappingURL=DelayEffect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DelayEffect.d.ts","sourceRoot":"","sources":["../../../src/effects/DelayEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA6D,MAAM,eAAe,CAAC;AAEvG,oDAAoD;AACpD,MAAM,WAAW,kBAAkB;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAWD;;;;;;GAMG;AACH,qBAAa,WAAY,SAAQ,WAAW;IAC1C,OAAO,CAAC,MAAM,CAAiC;IAC/C,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAGnC;IACF,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,IAAI,CAAS;gBAEF,OAAO,GAAE,kBAAuB;IAYnD,IAAW,SAAS,IAAI,SAAS,CAGhC;IAED,IAAW,UAAU,IAAI,SAAS,CAGjC;IAED,sDAAsD;IACtD,IAAW,YAAY,IAAI,MAAM,CAEhC;IAED,IAAW,YAAY,CAAC,KAAK,EAAE,MAAM,EAKpC;IAED,gGAAgG;IAChG,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED,IAAW,QAAQ,CAAC,KAAK,EAAE,MAAM,EAKhC;IAED,4FAA4F;IAC5F,IAAW,GAAG,IAAI,MAAM,CAEvB;IAED,IAAW,GAAG,CAAC,KAAK,EAAE,MAAM,EAO3B;IAEe,OAAO,IAAI,IAAI;IAa/B,OAAO,CAAC,WAAW;CA8BpB"}