@codexo/exojs-audio-fx 0.14.0-next.0 → 0.15.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 (66) hide show
  1. package/dist/esm/AudioAnalyser.js.map +1 -1
  2. package/dist/esm/BeatDetector.d.ts +55 -9
  3. package/dist/esm/BeatDetector.js +19 -9
  4. package/dist/esm/BeatDetector.js.map +1 -1
  5. package/dist/esm/dsp/mel.js.map +1 -1
  6. package/dist/esm/dsp/tempogram.d.ts +122 -21
  7. package/dist/esm/effects/AutoWahEffect.d.ts +127 -0
  8. package/dist/esm/effects/AutoWahEffect.js +241 -0
  9. package/dist/esm/effects/AutoWahEffect.js.map +1 -0
  10. package/dist/esm/effects/BitCrusherEffect.d.ts +63 -0
  11. package/dist/esm/effects/BitCrusherEffect.js +74 -0
  12. package/dist/esm/effects/BitCrusherEffect.js.map +1 -0
  13. package/dist/esm/effects/ConvolutionEffect.d.ts +114 -0
  14. package/dist/esm/effects/ConvolutionEffect.js +193 -0
  15. package/dist/esm/effects/ConvolutionEffect.js.map +1 -0
  16. package/dist/esm/effects/DistortionEffect.d.ts +119 -0
  17. package/dist/esm/effects/DistortionEffect.js +199 -0
  18. package/dist/esm/effects/DistortionEffect.js.map +1 -0
  19. package/dist/esm/effects/DuckingEffect.js +6 -2
  20. package/dist/esm/effects/DuckingEffect.js.map +1 -1
  21. package/dist/esm/effects/FlangerEffect.d.ts +98 -0
  22. package/dist/esm/effects/FlangerEffect.js +205 -0
  23. package/dist/esm/effects/FlangerEffect.js.map +1 -0
  24. package/dist/esm/effects/GranularEffect.d.ts +8 -4
  25. package/dist/esm/effects/GranularEffect.js +4 -12
  26. package/dist/esm/effects/GranularEffect.js.map +1 -1
  27. package/dist/esm/effects/LimiterEffect.d.ts +124 -0
  28. package/dist/esm/effects/LimiterEffect.js +198 -0
  29. package/dist/esm/effects/LimiterEffect.js.map +1 -0
  30. package/dist/esm/effects/PhaserEffect.d.ts +126 -0
  31. package/dist/esm/effects/PhaserEffect.js +258 -0
  32. package/dist/esm/effects/PhaserEffect.js.map +1 -0
  33. package/dist/esm/effects/PingPongDelayEffect.d.ts +83 -0
  34. package/dist/esm/effects/PingPongDelayEffect.js +189 -0
  35. package/dist/esm/effects/PingPongDelayEffect.js.map +1 -0
  36. package/dist/esm/effects/PitchShiftEffect.d.ts +14 -13
  37. package/dist/esm/effects/PitchShiftEffect.js +16 -18
  38. package/dist/esm/effects/PitchShiftEffect.js.map +1 -1
  39. package/dist/esm/effects/RingModulatorEffect.d.ts +95 -0
  40. package/dist/esm/effects/RingModulatorEffect.js +165 -0
  41. package/dist/esm/effects/RingModulatorEffect.js.map +1 -0
  42. package/dist/esm/effects/TremoloEffect.d.ts +110 -0
  43. package/dist/esm/effects/TremoloEffect.js +205 -0
  44. package/dist/esm/effects/TremoloEffect.js.map +1 -0
  45. package/dist/esm/effects/VocoderEffect.d.ts +0 -4
  46. package/dist/esm/effects/VocoderEffect.js +1 -11
  47. package/dist/esm/effects/VocoderEffect.js.map +1 -1
  48. package/dist/esm/index.d.ts +10 -0
  49. package/dist/esm/index.js +10 -0
  50. package/dist/esm/index.js.map +1 -1
  51. package/dist/esm/worklets/beat-detector.worklet.d.ts +1 -1
  52. package/dist/esm/worklets/beat-detector.worklet.js +628 -112
  53. package/dist/esm/worklets/beat-detector.worklet.js.map +1 -1
  54. package/dist/esm/worklets/bit-crusher.worklet.d.ts +1 -0
  55. package/dist/esm/worklets/bit-crusher.worklet.js +45 -0
  56. package/dist/esm/worklets/bit-crusher.worklet.js.map +1 -0
  57. package/dist/esm/worklets/granular.worklet.d.ts +1 -1
  58. package/dist/esm/worklets/granular.worklet.js +13 -4
  59. package/dist/esm/worklets/granular.worklet.js.map +1 -1
  60. package/dist/esm/worklets/pitch-shift.worklet.d.ts +1 -1
  61. package/dist/esm/worklets/pitch-shift.worklet.js +87 -32
  62. package/dist/esm/worklets/pitch-shift.worklet.js.map +1 -1
  63. package/dist/esm/worklets/vocoder.worklet.d.ts +1 -1
  64. package/dist/esm/worklets/vocoder.worklet.js +5 -3
  65. package/dist/esm/worklets/vocoder.worklet.js.map +1 -1
  66. package/package.json +3 -3
@@ -0,0 +1,205 @@
1
+ import { AudioEffect, onAudioContextReady, isAudioContextReady, getAudioContext } from '@codexo/exojs';
2
+
3
+ /**
4
+ * Flanger effect using native WebAudio nodes (no worklet required).
5
+ *
6
+ * A flanger is a very short LFO-modulated delay (1–10 ms) with a feedback
7
+ * loop. Unlike a chorus — which uses longer delays without feedback to produce
8
+ * thickening — the flanger's feedback reinforces phase cancellation, creating
9
+ * the characteristic sweeping comb-filter "jet-plane" sound as notches and
10
+ * peaks slide up and down the spectrum.
11
+ *
12
+ * Node graph:
13
+ * ```
14
+ * inputGain ┬── dryGain ─────────────────────────┐
15
+ * │ ├── outputGain
16
+ * └──▶ delayNode ──▶ wetGain ───────────┘
17
+ * ↑ │
18
+ * feedbackGain ◀─┘
19
+ *
20
+ * lfoOscillator ── lfoGain (depth in seconds) ──▶ delayNode.delayTime
21
+ * ```
22
+ *
23
+ * Gains: `dryGain.gain = 1 - wet`; `wetGain.gain = wet`;
24
+ * `feedbackGain.gain = feedback`; `lfoGain.gain = depthMs / 1000`.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const flanger = new FlangerEffect({ delayMs: 3, depthMs: 2, rateHz: 0.25, feedback: 0.5, wet: 0.5 });
29
+ * bus.addEffect(flanger);
30
+ * ```
31
+ */
32
+ class FlangerEffect extends AudioEffect {
33
+ _nodes = null;
34
+ _delayMs;
35
+ _depthMs;
36
+ _rateHz;
37
+ _feedback;
38
+ _wet;
39
+ _onAudioContextReady = (ctx) => {
40
+ onAudioContextReady.remove(this._onAudioContextReady);
41
+ this._setupNodes(ctx);
42
+ };
43
+ constructor(options = {}) {
44
+ super();
45
+ this._delayMs = Math.max(0.5, Math.min(20, options.delayMs ?? 3));
46
+ this._depthMs = Math.max(0, Math.min(10, options.depthMs ?? 2));
47
+ this._rateHz = Math.max(0, Math.min(10, options.rateHz ?? 0.25));
48
+ this._feedback = Math.max(0, Math.min(0.95, options.feedback ?? 0.5));
49
+ this._wet = Math.max(0, Math.min(1, options.wet ?? 0.5));
50
+ if (isAudioContextReady()) {
51
+ this._setupNodes(getAudioContext());
52
+ }
53
+ else {
54
+ onAudioContextReady.add(this._onAudioContextReady);
55
+ }
56
+ }
57
+ /**
58
+ * The node where audio enters this effect. Throws if the audio context is
59
+ * not yet initialized.
60
+ */
61
+ get inputNode() {
62
+ if (!this._nodes)
63
+ throw new Error('FlangerEffect not yet initialized.');
64
+ return this._nodes.inputGain;
65
+ }
66
+ /**
67
+ * The node where audio exits this effect. Throws if the audio context is
68
+ * not yet initialized.
69
+ */
70
+ get outputNode() {
71
+ if (!this._nodes)
72
+ throw new Error('FlangerEffect not yet initialized.');
73
+ return this._nodes.outputGain;
74
+ }
75
+ // ---------------------------------------------------------------------------
76
+ // Getters / setters
77
+ // ---------------------------------------------------------------------------
78
+ /** Base delay time in milliseconds. Range 0.5..20, default 3. */
79
+ get delayMs() {
80
+ return this._delayMs;
81
+ }
82
+ set delayMs(value) {
83
+ this._delayMs = Math.max(0.5, Math.min(20, value));
84
+ if (this._nodes) {
85
+ this._nodes.delayNode.delayTime.setTargetAtTime(this._delayMs / 1000, this._nodes.delayNode.context.currentTime, 0.01);
86
+ }
87
+ }
88
+ /** LFO modulation depth in milliseconds (peak deviation from base delay). Range 0..10, default 2. */
89
+ get depthMs() {
90
+ return this._depthMs;
91
+ }
92
+ set depthMs(value) {
93
+ this._depthMs = Math.max(0, Math.min(10, value));
94
+ if (this._nodes) {
95
+ this._nodes.lfoGain.gain.setTargetAtTime(this._depthMs / 1000, this._nodes.lfoGain.context.currentTime, 0.01);
96
+ }
97
+ }
98
+ /** LFO oscillation rate in Hz. Range 0..10, default 0.25. */
99
+ get rateHz() {
100
+ return this._rateHz;
101
+ }
102
+ set rateHz(value) {
103
+ this._rateHz = Math.max(0, Math.min(10, value));
104
+ if (this._nodes) {
105
+ this._nodes.lfoOscillator.frequency.setTargetAtTime(this._rateHz, this._nodes.inputGain.context.currentTime, 0.01);
106
+ }
107
+ }
108
+ /**
109
+ * Feedback amount — fraction of delay output fed back to delay input.
110
+ * Range 0..0.95, default 0.5.
111
+ */
112
+ get feedback() {
113
+ return this._feedback;
114
+ }
115
+ set feedback(value) {
116
+ this._feedback = Math.max(0, Math.min(0.95, value));
117
+ if (this._nodes) {
118
+ this._nodes.feedbackGain.gain.setTargetAtTime(this._feedback, this._nodes.feedbackGain.context.currentTime, 0.01);
119
+ }
120
+ }
121
+ /** Wet (flanged) mix level, 0..1. The dry level is automatically `1 - wet`. Default 0.5. */
122
+ get wet() {
123
+ return this._wet;
124
+ }
125
+ set wet(value) {
126
+ this._wet = Math.max(0, Math.min(1, value));
127
+ if (this._nodes) {
128
+ const ctx = this._nodes.wetGain.context;
129
+ this._nodes.wetGain.gain.setTargetAtTime(this._wet, ctx.currentTime, 0.01);
130
+ this._nodes.dryGain.gain.setTargetAtTime(1 - this._wet, ctx.currentTime, 0.01);
131
+ }
132
+ }
133
+ // ---------------------------------------------------------------------------
134
+ // Lifecycle
135
+ // ---------------------------------------------------------------------------
136
+ destroy() {
137
+ onAudioContextReady.remove(this._onAudioContextReady);
138
+ if (this._nodes) {
139
+ this._nodes.lfoOscillator.stop();
140
+ this._nodes.lfoOscillator.disconnect();
141
+ this._nodes.lfoGain.disconnect();
142
+ this._nodes.feedbackGain.disconnect();
143
+ this._nodes.delayNode.disconnect();
144
+ this._nodes.dryGain.disconnect();
145
+ this._nodes.wetGain.disconnect();
146
+ this._nodes.inputGain.disconnect();
147
+ this._nodes.outputGain.disconnect();
148
+ this._nodes = null;
149
+ }
150
+ }
151
+ // ---------------------------------------------------------------------------
152
+ // Private
153
+ // ---------------------------------------------------------------------------
154
+ _setupNodes(ctx) {
155
+ const inputGain = ctx.createGain();
156
+ const outputGain = ctx.createGain();
157
+ const dryGain = ctx.createGain();
158
+ const wetGain = ctx.createGain();
159
+ const feedbackGain = ctx.createGain();
160
+ const lfoGain = ctx.createGain();
161
+ // maxDelayTime must accommodate base delay plus the full modulation depth,
162
+ // with a safety headroom of 50 ms so the DelayNode never clips.
163
+ const maxDelay = (this._delayMs + this._depthMs) / 1000 + 0.05;
164
+ const delayNode = ctx.createDelay(maxDelay);
165
+ // Initial parameter values
166
+ inputGain.gain.setValueAtTime(1, ctx.currentTime);
167
+ outputGain.gain.setValueAtTime(1, ctx.currentTime);
168
+ dryGain.gain.setValueAtTime(1 - this._wet, ctx.currentTime);
169
+ wetGain.gain.setValueAtTime(this._wet, ctx.currentTime);
170
+ feedbackGain.gain.setValueAtTime(this._feedback, ctx.currentTime);
171
+ lfoGain.gain.setValueAtTime(this._depthMs / 1000, ctx.currentTime);
172
+ delayNode.delayTime.setValueAtTime(this._delayMs / 1000, ctx.currentTime);
173
+ // LFO
174
+ const lfoOscillator = ctx.createOscillator();
175
+ lfoOscillator.type = 'sine';
176
+ lfoOscillator.frequency.value = this._rateHz;
177
+ // LFO path: lfoOscillator → lfoGain → delayNode.delayTime (AudioParam)
178
+ lfoOscillator.connect(lfoGain);
179
+ lfoGain.connect(delayNode.delayTime);
180
+ // Dry path: inputGain → dryGain → outputGain
181
+ inputGain.connect(dryGain);
182
+ dryGain.connect(outputGain);
183
+ // Wet path: inputGain → delayNode → wetGain → outputGain
184
+ inputGain.connect(delayNode);
185
+ delayNode.connect(wetGain);
186
+ wetGain.connect(outputGain);
187
+ // Feedback loop: delayNode → feedbackGain → delayNode
188
+ delayNode.connect(feedbackGain);
189
+ feedbackGain.connect(delayNode);
190
+ lfoOscillator.start();
191
+ this._nodes = {
192
+ inputGain,
193
+ outputGain,
194
+ dryGain,
195
+ wetGain,
196
+ feedbackGain,
197
+ lfoGain,
198
+ delayNode,
199
+ lfoOscillator,
200
+ };
201
+ }
202
+ }
203
+
204
+ export { FlangerEffect };
205
+ //# sourceMappingURL=FlangerEffect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"F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AC;;AAGzE,QAAA,MAAM,aAAa,GAAG,GAAG,CAAC,gBAAgB,EAAE;AAC5C,QAAA,aAAa,CAAC,IAAI,GAAG,MAAM;QAC3B,aAAa,CAAC,SAAS,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO;;AAG5C,QAAA,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC;AAC9B,QAAA,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,SAAiC,CAAC;;AAG5D,QAAA,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;AAC1B,QAAA,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;;AAG3B,QAAA,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC;AAC5B,QAAA,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;AAC1B,QAAA,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;;AAG3B,QAAA,SAAS,CAAC,OAAO,CAAC,YAAY,CAAC;AAC/B,QAAA,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC;QAE/B,aAAa,CAAC,KAAK,EAAE;QAErB,IAAI,CAAC,MAAM,GAAG;YACZ,SAAS;YACT,UAAU;YACV,OAAO;YACP,OAAO;YACP,YAAY;YACZ,OAAO;YACP,SAAS;YACT,aAAa;SACd;IACH;AACD;;;;"}
@@ -14,6 +14,13 @@ export interface GranularEffectOptions {
14
14
  wet?: number;
15
15
  /** Internal circular-buffer length in seconds. Compile-time, not runtime. Default 2. */
16
16
  bufferSeconds?: number;
17
+ /**
18
+ * Compensate the density/grainSize-dependent loudness so the wet level stays
19
+ * roughly constant (near unity) instead of rising with overlap. Compile-time,
20
+ * not runtime. Default `false`, which preserves granular's expressive level
21
+ * dynamics — enable it when you want a predictable, density-independent level.
22
+ */
23
+ normalizeGain?: boolean;
17
24
  }
18
25
  /**
19
26
  * Granular synthesis filter — slices input into small Hann-windowed grains
@@ -34,8 +41,8 @@ export declare class GranularEffect extends WorkletEffect {
34
41
  private _spread;
35
42
  private _pitchMin;
36
43
  private _pitchMax;
37
- private _wet;
38
44
  private readonly _bufferSeconds;
45
+ private readonly _normalizeGain;
39
46
  constructor(options?: GranularEffectOptions);
40
47
  protected get _workletName(): string;
41
48
  protected get _workletSource(): string;
@@ -56,7 +63,4 @@ export declare class GranularEffect extends WorkletEffect {
56
63
  /** Maximum per-grain pitch ratio. Range 0.25..4, default 1.0. */
57
64
  get pitchMax(): number;
58
65
  set pitchMax(value: number);
59
- /** Wet (granular) mix level, 0..1. Default 1.0. */
60
- get wet(): number;
61
- set wet(value: number);
62
66
  }
@@ -20,8 +20,8 @@ class GranularEffect extends WorkletEffect {
20
20
  _spread;
21
21
  _pitchMin;
22
22
  _pitchMax;
23
- _wet;
24
23
  _bufferSeconds;
24
+ _normalizeGain;
25
25
  constructor(options = {}) {
26
26
  super();
27
27
  this._grainSize = Math.max(0.005, Math.min(0.5, options.grainSize ?? 0.05));
@@ -29,8 +29,9 @@ class GranularEffect extends WorkletEffect {
29
29
  this._spread = Math.max(0, Math.min(1, options.spread ?? 0.5));
30
30
  this._pitchMin = Math.max(0.25, Math.min(4, options.pitchMin ?? 1));
31
31
  this._pitchMax = Math.max(0.25, Math.min(4, options.pitchMax ?? 1));
32
- this._wet = Math.max(0, Math.min(1, options.wet ?? 1));
33
32
  this._bufferSeconds = options.bufferSeconds ?? 2;
33
+ this._normalizeGain = options.normalizeGain ?? false;
34
+ this.wet = options.wet ?? 1;
34
35
  }
35
36
  get _workletName() {
36
37
  return 'exojs-granular';
@@ -42,7 +43,7 @@ class GranularEffect extends WorkletEffect {
42
43
  return {
43
44
  numberOfInputs: 1,
44
45
  numberOfOutputs: 1,
45
- processorOptions: { bufferSeconds: this._bufferSeconds },
46
+ processorOptions: { bufferSeconds: this._bufferSeconds, normalizeGain: this._normalizeGain },
46
47
  };
47
48
  }
48
49
  _onWorkletReady() {
@@ -51,7 +52,6 @@ class GranularEffect extends WorkletEffect {
51
52
  this._setAudioParam('spread', this._spread);
52
53
  this._setAudioParam('pitchMin', this._pitchMin);
53
54
  this._setAudioParam('pitchMax', this._pitchMax);
54
- this._setAudioParam('wet', this._wet);
55
55
  }
56
56
  /** Duration of each grain in seconds. Range 0.005..0.5, default 0.05. */
57
57
  get grainSize() {
@@ -93,14 +93,6 @@ class GranularEffect extends WorkletEffect {
93
93
  this._pitchMax = Math.max(0.25, Math.min(4, value));
94
94
  this._setAudioParam('pitchMax', this._pitchMax);
95
95
  }
96
- /** Wet (granular) mix level, 0..1. Default 1.0. */
97
- get wet() {
98
- return this._wet;
99
- }
100
- set wet(value) {
101
- this._wet = Math.max(0, Math.min(1, value));
102
- this._setAudioParam('wet', this._wet);
103
- }
104
96
  }
105
97
 
106
98
  export { GranularEffect };
@@ -1 +1 @@
1
- {"version":3,"file":"GranularEffect.js","sources":["../../../../src/effects/GranularEffect.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAqBA;;;;;;;;;;;;AAYG;AACG,MAAO,cAAe,SAAQ,aAAa,CAAA;AACvC,IAAA,UAAU;AACV,IAAA,QAAQ;AACR,IAAA,OAAO;AACP,IAAA,SAAS;AACT,IAAA,SAAS;AACT,IAAA,IAAI;AACK,IAAA,cAAc;AAE/B,IAAA,WAAA,CAAmB,UAAiC,EAAE,EAAA;AACpD,QAAA,KAAK,EAAE;QACP,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC;QAC3E,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;QACjE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC;QAC9D,IAAI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CAAC;QACnD,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;IACjD;;AAGA,IAAA,IAAW,QAAQ,GAAA;QACjB,OAAO,IAAI,CAAC,SAAS;IACvB;IACA,IAAW,QAAQ,CAAC,KAAa,EAAA;AAC/B,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QACnD,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;IACjD;AACD;;;;"}
@@ -0,0 +1,124 @@
1
+ import { AudioEffect } from '@codexo/exojs';
2
+ /** Construction options for {@link LimiterEffect}. */
3
+ export interface LimiterEffectOptions {
4
+ /**
5
+ * Threshold in dBFS above which limiting is applied. Range −60..0, default −3.
6
+ */
7
+ threshold?: number;
8
+ /**
9
+ * Time in seconds for the limiter to engage after the signal exceeds the
10
+ * threshold. Range 0..1, default 0.003.
11
+ */
12
+ attack?: number;
13
+ /**
14
+ * Time in seconds for the limiter to release after the signal drops below the
15
+ * threshold. Range 0..1, default 0.25.
16
+ */
17
+ release?: number;
18
+ /**
19
+ * Dry/wet mix, 0..1. The dry level is automatically `1 - wet`. Default 1.0.
20
+ * A limiter is typically used fully wet, but exposing this allows parallel
21
+ * processing workflows.
22
+ */
23
+ wet?: number;
24
+ /**
25
+ * Input-to-output dB ratio above the threshold. Range 1..20, default 20
26
+ * (brick-wall). Lower it for a softer, more compressor-like limiter.
27
+ */
28
+ ratio?: number;
29
+ /**
30
+ * Width in dB of the transition region around the threshold (soft knee).
31
+ * Range 0..40, default 0 (hard knee). Raise it for a gentler transition
32
+ * into limiting.
33
+ */
34
+ knee?: number;
35
+ }
36
+ /**
37
+ * Brick-wall limiter backed by a Web Audio `DynamicsCompressorNode` configured
38
+ * for hard limiting: a fixed high ratio (~20), zero knee (hard knee), and a
39
+ * fast attack. Use it as a final-chain safety net to prevent clipping and
40
+ * protect downstream output.
41
+ *
42
+ * The compressor `ratio` and `knee` default to brick-wall values (20 and 0
43
+ * respectively) but remain configurable, unlike a truly fixed limiter,
44
+ * because callers occasionally want a softer, more compressor-like limiting
45
+ * curve (lower ratio) or a gentler transition into limiting (larger knee)
46
+ * without switching to {@link CompressorEffect} and losing the dry/wet mix.
47
+ * The effect also exposes a dry/wet mix for API consistency and parallel
48
+ * processing workflows, though a fully-wet signal (`wet = 1`) is the typical
49
+ * configuration.
50
+ *
51
+ * Node graph:
52
+ * ```
53
+ * input(GainNode) → dryGain → output(GainNode)
54
+ * input → compressor → wetGain → output
55
+ * ```
56
+ * Gains: `dryGain.gain = 1 - wet`; `wetGain.gain = wet`.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const limiter = new LimiterEffect({ threshold: -3, release: 0.1 });
61
+ * masterBus.addEffect(limiter);
62
+ * ```
63
+ */
64
+ export declare class LimiterEffect extends AudioEffect {
65
+ private _setup;
66
+ private _threshold;
67
+ private _attack;
68
+ private _release;
69
+ private _wet;
70
+ private _ratio;
71
+ private _knee;
72
+ private readonly _onAudioContextReady;
73
+ constructor(options?: LimiterEffectOptions);
74
+ /**
75
+ * The node where audio enters this effect. Throws if the audio context is
76
+ * not yet initialized.
77
+ */
78
+ get inputNode(): AudioNode;
79
+ /**
80
+ * The node where audio exits this effect. Throws if the audio context is
81
+ * not yet initialized.
82
+ */
83
+ get outputNode(): AudioNode;
84
+ /**
85
+ * Threshold in dBFS above which limiting is applied. Range −60..0, default −3.
86
+ * Changes are ramped smoothly via `setTargetAtTime`.
87
+ */
88
+ get threshold(): number;
89
+ set threshold(value: number);
90
+ /**
91
+ * Attack time in seconds for the limiter to engage. Range 0..1, default 0.003.
92
+ * Changes are ramped smoothly via `setTargetAtTime`.
93
+ */
94
+ get attack(): number;
95
+ set attack(value: number);
96
+ /**
97
+ * Release time in seconds for the limiter to disengage. Range 0..1, default 0.25.
98
+ * Changes are ramped smoothly via `setTargetAtTime`.
99
+ */
100
+ get release(): number;
101
+ set release(value: number);
102
+ /**
103
+ * Input-to-output dB ratio above the threshold. Range 1..20, default 20
104
+ * (brick-wall). Lower for a softer, more compressor-like limiter.
105
+ * Changes are ramped smoothly via `setTargetAtTime`.
106
+ */
107
+ get ratio(): number;
108
+ set ratio(value: number);
109
+ /**
110
+ * Width in dB of the transition region around the threshold (soft knee).
111
+ * Range 0..40, default 0 (hard knee). Raise for a gentler transition into
112
+ * limiting. Changes are ramped smoothly via `setTargetAtTime`.
113
+ */
114
+ get knee(): number;
115
+ set knee(value: number);
116
+ /**
117
+ * Dry/wet mix level, 0..1. The dry level is automatically `1 - wet`.
118
+ * Changes are ramped smoothly via `setTargetAtTime`. Default 1.0.
119
+ */
120
+ get wet(): number;
121
+ set wet(value: number);
122
+ destroy(): void;
123
+ private _setupNodes;
124
+ }
@@ -0,0 +1,198 @@
1
+ import { AudioEffect, onAudioContextReady, isAudioContextReady, getAudioContext } from '@codexo/exojs';
2
+
3
+ /**
4
+ * Brick-wall limiter backed by a Web Audio `DynamicsCompressorNode` configured
5
+ * for hard limiting: a fixed high ratio (~20), zero knee (hard knee), and a
6
+ * fast attack. Use it as a final-chain safety net to prevent clipping and
7
+ * protect downstream output.
8
+ *
9
+ * The compressor `ratio` and `knee` default to brick-wall values (20 and 0
10
+ * respectively) but remain configurable, unlike a truly fixed limiter,
11
+ * because callers occasionally want a softer, more compressor-like limiting
12
+ * curve (lower ratio) or a gentler transition into limiting (larger knee)
13
+ * without switching to {@link CompressorEffect} and losing the dry/wet mix.
14
+ * The effect also exposes a dry/wet mix for API consistency and parallel
15
+ * processing workflows, though a fully-wet signal (`wet = 1`) is the typical
16
+ * configuration.
17
+ *
18
+ * Node graph:
19
+ * ```
20
+ * input(GainNode) → dryGain → output(GainNode)
21
+ * input → compressor → wetGain → output
22
+ * ```
23
+ * Gains: `dryGain.gain = 1 - wet`; `wetGain.gain = wet`.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * const limiter = new LimiterEffect({ threshold: -3, release: 0.1 });
28
+ * masterBus.addEffect(limiter);
29
+ * ```
30
+ */
31
+ class LimiterEffect extends AudioEffect {
32
+ _setup = null;
33
+ _threshold;
34
+ _attack;
35
+ _release;
36
+ _wet;
37
+ _ratio;
38
+ _knee;
39
+ _onAudioContextReady = (ctx) => {
40
+ onAudioContextReady.remove(this._onAudioContextReady);
41
+ this._setupNodes(ctx);
42
+ };
43
+ constructor(options = {}) {
44
+ super();
45
+ this._threshold = Math.max(-60, Math.min(0, options.threshold ?? -3));
46
+ this._attack = Math.max(0, Math.min(1, options.attack ?? 0.003));
47
+ this._release = Math.max(0, Math.min(1, options.release ?? 0.25));
48
+ this._wet = Math.max(0, Math.min(1, options.wet ?? 1));
49
+ this._ratio = Math.max(1, Math.min(20, options.ratio ?? 20));
50
+ this._knee = Math.max(0, Math.min(40, options.knee ?? 0));
51
+ if (isAudioContextReady()) {
52
+ this._setupNodes(getAudioContext());
53
+ }
54
+ else {
55
+ onAudioContextReady.add(this._onAudioContextReady);
56
+ }
57
+ }
58
+ /**
59
+ * The node where audio enters this effect. Throws if the audio context is
60
+ * not yet initialized.
61
+ */
62
+ get inputNode() {
63
+ if (!this._setup)
64
+ throw new Error('LimiterEffect not yet initialized.');
65
+ return this._setup.inputGain;
66
+ }
67
+ /**
68
+ * The node where audio exits this effect. Throws if the audio context is
69
+ * not yet initialized.
70
+ */
71
+ get outputNode() {
72
+ if (!this._setup)
73
+ throw new Error('LimiterEffect not yet initialized.');
74
+ return this._setup.outputGain;
75
+ }
76
+ /**
77
+ * Threshold in dBFS above which limiting is applied. Range −60..0, default −3.
78
+ * Changes are ramped smoothly via `setTargetAtTime`.
79
+ */
80
+ get threshold() {
81
+ return this._threshold;
82
+ }
83
+ set threshold(value) {
84
+ this._threshold = Math.max(-60, Math.min(0, value));
85
+ if (this._setup) {
86
+ this._setup.compressor.threshold.setTargetAtTime(this._threshold, this._setup.compressor.context.currentTime, 0.01);
87
+ }
88
+ }
89
+ /**
90
+ * Attack time in seconds for the limiter to engage. Range 0..1, default 0.003.
91
+ * Changes are ramped smoothly via `setTargetAtTime`.
92
+ */
93
+ get attack() {
94
+ return this._attack;
95
+ }
96
+ set attack(value) {
97
+ this._attack = Math.max(0, Math.min(1, value));
98
+ if (this._setup) {
99
+ this._setup.compressor.attack.setTargetAtTime(this._attack, this._setup.compressor.context.currentTime, 0.01);
100
+ }
101
+ }
102
+ /**
103
+ * Release time in seconds for the limiter to disengage. Range 0..1, default 0.25.
104
+ * Changes are ramped smoothly via `setTargetAtTime`.
105
+ */
106
+ get release() {
107
+ return this._release;
108
+ }
109
+ set release(value) {
110
+ this._release = Math.max(0, Math.min(1, value));
111
+ if (this._setup) {
112
+ this._setup.compressor.release.setTargetAtTime(this._release, this._setup.compressor.context.currentTime, 0.01);
113
+ }
114
+ }
115
+ /**
116
+ * Input-to-output dB ratio above the threshold. Range 1..20, default 20
117
+ * (brick-wall). Lower for a softer, more compressor-like limiter.
118
+ * Changes are ramped smoothly via `setTargetAtTime`.
119
+ */
120
+ get ratio() {
121
+ return this._ratio;
122
+ }
123
+ set ratio(value) {
124
+ this._ratio = Math.max(1, Math.min(20, value));
125
+ if (this._setup) {
126
+ this._setup.compressor.ratio.setTargetAtTime(this._ratio, this._setup.compressor.context.currentTime, 0.01);
127
+ }
128
+ }
129
+ /**
130
+ * Width in dB of the transition region around the threshold (soft knee).
131
+ * Range 0..40, default 0 (hard knee). Raise for a gentler transition into
132
+ * limiting. Changes are ramped smoothly via `setTargetAtTime`.
133
+ */
134
+ get knee() {
135
+ return this._knee;
136
+ }
137
+ set knee(value) {
138
+ this._knee = Math.max(0, Math.min(40, value));
139
+ if (this._setup) {
140
+ this._setup.compressor.knee.setTargetAtTime(this._knee, this._setup.compressor.context.currentTime, 0.01);
141
+ }
142
+ }
143
+ /**
144
+ * Dry/wet mix level, 0..1. The dry level is automatically `1 - wet`.
145
+ * Changes are ramped smoothly via `setTargetAtTime`. Default 1.0.
146
+ */
147
+ get wet() {
148
+ return this._wet;
149
+ }
150
+ set wet(value) {
151
+ this._wet = Math.max(0, Math.min(1, value));
152
+ if (this._setup) {
153
+ const ctx = this._setup.wetGain.context;
154
+ this._setup.wetGain.gain.setTargetAtTime(this._wet, ctx.currentTime, 0.01);
155
+ this._setup.dryGain.gain.setTargetAtTime(1 - this._wet, ctx.currentTime, 0.01);
156
+ }
157
+ }
158
+ destroy() {
159
+ onAudioContextReady.remove(this._onAudioContextReady);
160
+ if (this._setup) {
161
+ this._setup.inputGain.disconnect();
162
+ this._setup.compressor.disconnect();
163
+ this._setup.dryGain.disconnect();
164
+ this._setup.wetGain.disconnect();
165
+ this._setup.outputGain.disconnect();
166
+ this._setup = null;
167
+ }
168
+ }
169
+ _setupNodes(ctx) {
170
+ const inputGain = ctx.createGain();
171
+ const outputGain = ctx.createGain();
172
+ const compressor = ctx.createDynamicsCompressor();
173
+ const dryGain = ctx.createGain();
174
+ const wetGain = ctx.createGain();
175
+ inputGain.gain.setValueAtTime(1, ctx.currentTime);
176
+ outputGain.gain.setValueAtTime(1, ctx.currentTime);
177
+ dryGain.gain.setValueAtTime(1 - this._wet, ctx.currentTime);
178
+ wetGain.gain.setValueAtTime(this._wet, ctx.currentTime);
179
+ // Defaults to brick-wall behaviour (high ratio, hard knee) but both remain
180
+ // configurable — see LimiterEffectOptions.ratio / .knee.
181
+ compressor.ratio.setValueAtTime(this._ratio, ctx.currentTime);
182
+ compressor.knee.setValueAtTime(this._knee, ctx.currentTime);
183
+ compressor.threshold.setValueAtTime(this._threshold, ctx.currentTime);
184
+ compressor.attack.setValueAtTime(this._attack, ctx.currentTime);
185
+ compressor.release.setValueAtTime(this._release, ctx.currentTime);
186
+ // Dry path: input → dryGain → output
187
+ inputGain.connect(dryGain);
188
+ dryGain.connect(outputGain);
189
+ // Wet path: input → compressor → wetGain → output
190
+ inputGain.connect(compressor);
191
+ compressor.connect(wetGain);
192
+ wetGain.connect(outputGain);
193
+ this._setup = { inputGain, outputGain, compressor, dryGain, wetGain };
194
+ }
195
+ }
196
+
197
+ export { LimiterEffect };
198
+ //# sourceMappingURL=LimiterEffect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LimiterEffect.js","sources":["../../../../src/effects/LimiterEffect.ts"],"sourcesContent":[null],"names":[],"mappings":";;AA6CA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;AACG,MAAO,aAAc,SAAQ,WAAW,CAAA;IACpC,MAAM,GAA8B,IAAI;AACxC,IAAA,UAAU;AACV,IAAA,OAAO;AACP,IAAA,QAAQ;AACR,IAAA,IAAI;AACJ,IAAA,MAAM;AACN,IAAA,KAAK;AACI,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,UAAgC,EAAE,EAAA;AACnD,QAAA,KAAK,EAAE;QACP,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;QACrE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC;QAChE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC;QACjE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QACtD,IAAI,CA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