@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 +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,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C,UAAU,CAAC;AAC7B,QAAA,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC;AAC3B,QAAA,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;AAE3B,QAAA,IAAI,CAAC,MAAM,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE;IACvE;AACD;;;;"}
1
+ {"version":3,"file":"LimiterEffect.js","names":[],"sources":["../../../src/effects/LimiterEffect.ts"],"sourcesContent":["import { AudioEffect, getAudioContext, isAudioContextReady, onAudioContextReady } from '@codexo/exojs';\n\n/** Construction options for {@link LimiterEffect}. */\nexport interface LimiterEffectOptions {\n /**\n * Threshold in dBFS above which limiting is applied. Range −60..0, default −3.\n */\n threshold?: number;\n /**\n * Time in seconds for the limiter to engage after the signal exceeds the\n * threshold. Range 0..1, default 0.003.\n */\n attack?: number;\n /**\n * Time in seconds for the limiter to release after the signal drops below the\n * threshold. Range 0..1, default 0.25.\n */\n release?: number;\n /**\n * Dry/wet mix, 0..1. The dry level is automatically `1 - wet`. Default 1.0.\n * A limiter is typically used fully wet, but exposing this allows parallel\n * processing workflows.\n */\n wet?: number;\n /**\n * Input-to-output dB ratio above the threshold. Range 1..20, default 20\n * (brick-wall). Lower it for a softer, more compressor-like limiter.\n */\n ratio?: number;\n /**\n * Width in dB of the transition region around the threshold (soft knee).\n * Range 0..40, default 0 (hard knee). Raise it for a gentler transition\n * into limiting.\n */\n knee?: number;\n}\n\ninterface LimiterEffectSetup {\n readonly inputGain: GainNode;\n readonly outputGain: GainNode;\n readonly compressor: DynamicsCompressorNode;\n readonly dryGain: GainNode;\n readonly wetGain: GainNode;\n}\n\n/**\n * Brick-wall limiter backed by a Web Audio `DynamicsCompressorNode` configured\n * for hard limiting: a fixed high ratio (~20), zero knee (hard knee), and a\n * fast attack. Use it as a final-chain safety net to prevent clipping and\n * protect downstream output.\n *\n * The compressor `ratio` and `knee` default to brick-wall values (20 and 0\n * respectively) but remain configurable, unlike a truly fixed limiter,\n * because callers occasionally want a softer, more compressor-like limiting\n * curve (lower ratio) or a gentler transition into limiting (larger knee)\n * without switching to {@link CompressorEffect} and losing the dry/wet mix.\n * The effect also exposes a dry/wet mix for API consistency and parallel\n * processing workflows, though a fully-wet signal (`wet = 1`) is the typical\n * configuration.\n *\n * Node graph:\n * ```\n * input(GainNode) → dryGain → output(GainNode)\n * input → compressor → wetGain → output\n * ```\n * Gains: `dryGain.gain = 1 - wet`; `wetGain.gain = wet`.\n *\n * @example\n * ```ts\n * const limiter = new LimiterEffect({ threshold: -3, release: 0.1 });\n * masterBus.addEffect(limiter);\n * ```\n */\nexport class LimiterEffect extends AudioEffect {\n private _setup: LimiterEffectSetup | null = null;\n private _threshold: number;\n private _attack: number;\n private _release: number;\n private _wet: number;\n private _ratio: number;\n private _knee: number;\n private readonly _onAudioContextReady = (ctx: AudioContext): void => {\n onAudioContextReady.remove(this._onAudioContextReady);\n this._setupNodes(ctx);\n };\n\n public constructor(options: LimiterEffectOptions = {}) {\n super();\n this._threshold = Math.max(-60, Math.min(0, options.threshold ?? -3));\n this._attack = Math.max(0, Math.min(1, options.attack ?? 0.003));\n this._release = Math.max(0, Math.min(1, options.release ?? 0.25));\n this._wet = Math.max(0, Math.min(1, options.wet ?? 1));\n this._ratio = Math.max(1, Math.min(20, options.ratio ?? 20));\n this._knee = Math.max(0, Math.min(40, options.knee ?? 0));\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('LimiterEffect 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('LimiterEffect not yet initialized.');\n return this._setup.outputGain;\n }\n\n /**\n * Threshold in dBFS above which limiting is applied. Range −60..0, default −3.\n * Changes are ramped smoothly via `setTargetAtTime`.\n */\n public get threshold(): number {\n return this._threshold;\n }\n\n public set threshold(value: number) {\n this._threshold = Math.max(-60, Math.min(0, value));\n if (this._setup) {\n this._setup.compressor.threshold.setTargetAtTime(this._threshold, this._setup.compressor.context.currentTime, 0.01);\n }\n }\n\n /**\n * Attack time in seconds for the limiter to engage. Range 0..1, default 0.003.\n * Changes are ramped smoothly via `setTargetAtTime`.\n */\n public get attack(): number {\n return this._attack;\n }\n\n public set attack(value: number) {\n this._attack = Math.max(0, Math.min(1, value));\n if (this._setup) {\n this._setup.compressor.attack.setTargetAtTime(this._attack, this._setup.compressor.context.currentTime, 0.01);\n }\n }\n\n /**\n * Release time in seconds for the limiter to disengage. Range 0..1, default 0.25.\n * Changes are ramped smoothly via `setTargetAtTime`.\n */\n public get release(): number {\n return this._release;\n }\n\n public set release(value: number) {\n this._release = Math.max(0, Math.min(1, value));\n if (this._setup) {\n this._setup.compressor.release.setTargetAtTime(this._release, this._setup.compressor.context.currentTime, 0.01);\n }\n }\n\n /**\n * Input-to-output dB ratio above the threshold. Range 1..20, default 20\n * (brick-wall). Lower for a softer, more compressor-like limiter.\n * Changes are ramped smoothly via `setTargetAtTime`.\n */\n public get ratio(): number {\n return this._ratio;\n }\n\n public set ratio(value: number) {\n this._ratio = Math.max(1, Math.min(20, value));\n if (this._setup) {\n this._setup.compressor.ratio.setTargetAtTime(this._ratio, this._setup.compressor.context.currentTime, 0.01);\n }\n }\n\n /**\n * Width in dB of the transition region around the threshold (soft knee).\n * Range 0..40, default 0 (hard knee). Raise for a gentler transition into\n * limiting. Changes are ramped smoothly via `setTargetAtTime`.\n */\n public get knee(): number {\n return this._knee;\n }\n\n public set knee(value: number) {\n this._knee = Math.max(0, Math.min(40, value));\n if (this._setup) {\n this._setup.compressor.knee.setTargetAtTime(this._knee, this._setup.compressor.context.currentTime, 0.01);\n }\n }\n\n /**\n * Dry/wet 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, ctx.currentTime, 0.01);\n this._setup.dryGain.gain.setTargetAtTime(1 - this._wet, ctx.currentTime, 0.01);\n }\n }\n\n public override destroy(): void {\n onAudioContextReady.remove(this._onAudioContextReady);\n if (this._setup) {\n this._setup.inputGain.disconnect();\n this._setup.compressor.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 _setupNodes(ctx: AudioContext): void {\n const inputGain = ctx.createGain();\n const outputGain = ctx.createGain();\n const compressor = ctx.createDynamicsCompressor();\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, ctx.currentTime);\n\n // Defaults to brick-wall behaviour (high ratio, hard knee) but both remain\n // configurable - see LimiterEffectOptions.ratio / .knee.\n compressor.ratio.setValueAtTime(this._ratio, ctx.currentTime);\n compressor.knee.setValueAtTime(this._knee, ctx.currentTime);\n compressor.threshold.setValueAtTime(this._threshold, ctx.currentTime);\n compressor.attack.setValueAtTime(this._attack, ctx.currentTime);\n compressor.release.setValueAtTime(this._release, ctx.currentTime);\n\n // Dry path: input → dryGain → output\n inputGain.connect(dryGain);\n dryGain.connect(outputGain);\n\n // Wet path: input → compressor → wetGain → output\n inputGain.connect(compressor);\n compressor.connect(wetGain);\n wetGain.connect(outputGain);\n\n this._setup = { inputGain, outputGain, compressor, dryGain, wetGain };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,IAAa,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E1B,KAAK,SAAS;GAAE;GAAW;GAAY;GAAY;GAAS;EAAQ;CACtE;AACF"}
@@ -44,7 +44,7 @@ export interface PhaserEffectOptions {
44
44
  * ```
45
45
  * inputGain ┬── dryGain ───────────────────────────────────────┐
46
46
  * │ ├── outputGain
47
- * └── allpass[0] ─► … ─► allpass[N-1] ── wetGain ───┘
47
+ * └── allpass[0] ─► ... ─► allpass[N-1] ── wetGain ───┘
48
48
  * ▲ │
49
49
  * └── feedbackDelay ◄── feedbackGain ◄─────────┘
50
50
  *
@@ -124,3 +124,4 @@ export declare class PhaserEffect extends AudioEffect {
124
124
  destroy(): void;
125
125
  private _setupNodes;
126
126
  }
127
+ //# sourceMappingURL=PhaserEffect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PhaserEffect.d.ts","sourceRoot":"","sources":["../../../src/effects/PhaserEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA6D,MAAM,eAAe,CAAC;AAEvG,qDAAqD;AACrD,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,qBAAa,YAAa,SAAQ,WAAW;IAC3C,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAGnC;gBAEiB,OAAO,GAAE,mBAAwB;IAgBpD;;;OAGG;IACH,IAAW,SAAS,IAAI,SAAS,CAGhC;IAED;;;OAGG;IACH,IAAW,UAAU,IAAI,SAAS,CAGjC;IAMD;;;OAGG;IACH,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED;;;OAGG;IACH,IAAW,MAAM,IAAI,MAAM,CAE1B;IACD,IAAW,MAAM,CAAC,KAAK,EAAE,MAAM,EAK9B;IAED;;;;OAIG;IACH,IAAW,aAAa,IAAI,MAAM,CAEjC;IACD,IAAW,aAAa,CAAC,KAAK,EAAE,MAAM,EASrC;IAED;;;OAGG;IACH,IAAW,KAAK,IAAI,MAAM,CAEzB;IACD,IAAW,KAAK,CAAC,KAAK,EAAE,MAAM,EAK7B;IAED;;;OAGG;IACH,IAAW,QAAQ,IAAI,MAAM,CAE5B;IACD,IAAW,QAAQ,CAAC,KAAK,EAAE,MAAM,EAKhC;IAED;;;OAGG;IACH,IAAW,GAAG,IAAI,MAAM,CAEvB;IACD,IAAW,GAAG,CAAC,KAAK,EAAE,MAAM,EAO3B;IAMe,OAAO,IAAI,IAAI;IAuB/B,OAAO,CAAC,WAAW;CA4EpB"}
@@ -1,258 +1,218 @@
1
- import { AudioEffect, onAudioContextReady, isAudioContextReady, getAudioContext } from '@codexo/exojs';
1
+ import { AudioEffect, getAudioContext, isAudioContextReady, onAudioContextReady } from "@codexo/exojs";
2
2
 
3
+ //#region src/effects/PhaserEffect.ts
3
4
  /**
4
- * Phaser effect implemented with native Web Audio nodes (no worklet required).
5
- *
6
- * The wet signal passes through a cascade of allpass `BiquadFilterNode`s whose
7
- * centre frequencies are swept synchronously by a sine LFO. The phase shift
8
- * produced by each allpass stage creates sweeping notches when summed with the
9
- * dry signal. An optional feedback path from the last stage back to the first
10
- * adds resonance and sharpens the effect.
11
- *
12
- * Node graph:
13
- * ```
14
- * inputGain ┬── dryGain ───────────────────────────────────────┐
15
- * │ ├── outputGain
16
- * └── allpass[0] ─► … ─► allpass[N-1] ── wetGain ───┘
17
- * ▲ │
18
- * └── feedbackDelay ◄── feedbackGain ◄─────────┘
19
- *
20
- * lfoOscillator ── lfoGain (depth × baseFrequency Hz) ──► each allpass.frequency
21
- * ```
22
- * Note: `feedbackDelay` is a {@link DelayNode} with `delayTime = 0`. Even at
23
- * zero delay the node itself breaks the zero-latency cycle, which spec-compliant
24
- * browsers (Chrome, Edge, Safari) would otherwise mute entirely.
25
- * Gains: `dryGain.gain = 1 - wet`; `wetGain.gain = wet`;
26
- * `feedbackGain.gain = feedback`; `lfoGain.gain = depth × baseFrequency`.
27
- *
28
- * @example
29
- * ```ts
30
- * const phaser = new PhaserEffect({ stages: 6, rateHz: 0.3, depth: 0.8, wet: 0.6 });
31
- * bus.addEffect(phaser);
32
- *
33
- * // Automate the rate at runtime
34
- * phaser.rateHz = 1.2;
35
- * ```
36
- */
37
- class PhaserEffect extends AudioEffect {
38
- _setup = null;
39
- _stages;
40
- _rateHz;
41
- _baseFrequency;
42
- _depth;
43
- _feedback;
44
- _wet;
45
- _onAudioContextReady = (ctx) => {
46
- onAudioContextReady.remove(this._onAudioContextReady);
47
- this._setupNodes(ctx);
48
- };
49
- constructor(options = {}) {
50
- super();
51
- const rawStages = Math.max(2, Math.min(12, Math.round(options.stages ?? 4)));
52
- this._stages = rawStages % 2 !== 0 ? Math.min(12, rawStages + 1) : rawStages;
53
- this._rateHz = Math.max(0, Math.min(20, options.rateHz ?? 0.5));
54
- this._baseFrequency = Math.max(50, Math.min(5000, options.baseFrequency ?? 500));
55
- this._depth = Math.max(0, Math.min(1, options.depth ?? 0.6));
56
- this._feedback = Math.max(0, Math.min(0.9, options.feedback ?? 0.3));
57
- this._wet = Math.max(0, Math.min(1, options.wet ?? 0.5));
58
- if (isAudioContextReady()) {
59
- this._setupNodes(getAudioContext());
60
- }
61
- else {
62
- onAudioContextReady.add(this._onAudioContextReady);
63
- }
64
- }
65
- /**
66
- * The node where audio enters this effect. Throws if the audio context is
67
- * not yet initialized.
68
- */
69
- get inputNode() {
70
- if (!this._setup)
71
- throw new Error('PhaserEffect 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)
80
- throw new Error('PhaserEffect not yet initialized.');
81
- return this._setup.outputGain;
82
- }
83
- // ---------------------------------------------------------------------------
84
- // Getters / setters
85
- // ---------------------------------------------------------------------------
86
- /**
87
- * Number of allpass filter stages (even integer, 2..12). Set at construction
88
- * time only; read-only at runtime.
89
- */
90
- get stages() {
91
- return this._stages;
92
- }
93
- /**
94
- * LFO sweep rate in Hz. Range 0..20, default 0.5. Changes are ramped
95
- * smoothly via `setTargetAtTime`.
96
- */
97
- get rateHz() {
98
- return this._rateHz;
99
- }
100
- set rateHz(value) {
101
- this._rateHz = Math.max(0, Math.min(20, value));
102
- if (this._setup) {
103
- this._setup.lfoOscillator.frequency.setTargetAtTime(this._rateHz, this._setup.inputGain.context.currentTime, 0.01);
104
- }
105
- }
106
- /**
107
- * Centre frequency of all allpass stages in Hz. Range 50..5000, default 500.
108
- * Changes are ramped smoothly and update both the filter frequencies and the
109
- * absolute LFO depth.
110
- */
111
- get baseFrequency() {
112
- return this._baseFrequency;
113
- }
114
- set baseFrequency(value) {
115
- this._baseFrequency = Math.max(50, Math.min(5000, value));
116
- if (this._setup) {
117
- const ctx = this._setup.inputGain.context;
118
- for (const filter of this._setup.allpassFilters) {
119
- filter.frequency.setTargetAtTime(this._baseFrequency, ctx.currentTime, 0.01);
120
- }
121
- this._setup.lfoGain.gain.setTargetAtTime(this._depth * this._baseFrequency, ctx.currentTime, 0.01);
122
- }
123
- }
124
- /**
125
- * LFO modulation depth as a fraction of `baseFrequency`. Range 0..1,
126
- * default 0.6. Changes are ramped smoothly via `setTargetAtTime`.
127
- */
128
- get depth() {
129
- return this._depth;
130
- }
131
- set depth(value) {
132
- this._depth = Math.max(0, Math.min(1, value));
133
- if (this._setup) {
134
- this._setup.lfoGain.gain.setTargetAtTime(this._depth * this._baseFrequency, this._setup.inputGain.context.currentTime, 0.01);
135
- }
136
- }
137
- /**
138
- * Feedback gain from the last stage back to the first. Range 0..0.9,
139
- * default 0.3. Changes are ramped smoothly via `setTargetAtTime`.
140
- */
141
- get feedback() {
142
- return this._feedback;
143
- }
144
- set feedback(value) {
145
- this._feedback = Math.max(0, Math.min(0.9, value));
146
- if (this._setup) {
147
- this._setup.feedbackGain.gain.setTargetAtTime(this._feedback, this._setup.inputGain.context.currentTime, 0.01);
148
- }
149
- }
150
- /**
151
- * Wet (phased) mix level, 0..1. The dry level is automatically `1 - wet`.
152
- * Changes are ramped smoothly via `setTargetAtTime`. Default 0.5.
153
- */
154
- get wet() {
155
- return this._wet;
156
- }
157
- set wet(value) {
158
- this._wet = Math.max(0, Math.min(1, value));
159
- if (this._setup) {
160
- const ctx = this._setup.wetGain.context;
161
- this._setup.wetGain.gain.setTargetAtTime(this._wet, ctx.currentTime, 0.01);
162
- this._setup.dryGain.gain.setTargetAtTime(1 - this._wet, ctx.currentTime, 0.01);
163
- }
164
- }
165
- // ---------------------------------------------------------------------------
166
- // Lifecycle
167
- // ---------------------------------------------------------------------------
168
- destroy() {
169
- onAudioContextReady.remove(this._onAudioContextReady);
170
- if (this._setup) {
171
- this._setup.lfoOscillator.stop();
172
- this._setup.lfoOscillator.disconnect();
173
- this._setup.lfoGain.disconnect();
174
- for (const filter of this._setup.allpassFilters) {
175
- filter.disconnect();
176
- }
177
- this._setup.feedbackGain.disconnect();
178
- this._setup.feedbackDelay.disconnect();
179
- this._setup.dryGain.disconnect();
180
- this._setup.wetGain.disconnect();
181
- this._setup.inputGain.disconnect();
182
- this._setup.outputGain.disconnect();
183
- this._setup = null;
184
- }
185
- }
186
- // ---------------------------------------------------------------------------
187
- // Private
188
- // ---------------------------------------------------------------------------
189
- _setupNodes(ctx) {
190
- const inputGain = ctx.createGain();
191
- const outputGain = ctx.createGain();
192
- const dryGain = ctx.createGain();
193
- const wetGain = ctx.createGain();
194
- const feedbackGain = ctx.createGain();
195
- const lfoGain = ctx.createGain();
196
- // A zero-length DelayNode in the feedback path is required so that
197
- // spec-compliant browsers do not mute the entire allpass chain. Browsers
198
- // are permitted to silence feedback cycles that contain no DelayNode (i.e.
199
- // zero-latency cycles), so even delayTime=0 here is sufficient to make the
200
- // cycle legal — the DelayNode itself introduces at least one render-quantum
201
- // of delay regardless of its delayTime parameter.
202
- const feedbackDelay = ctx.createDelay(1);
203
- feedbackDelay.delayTime.setValueAtTime(0, ctx.currentTime);
204
- inputGain.gain.setValueAtTime(1, ctx.currentTime);
205
- outputGain.gain.setValueAtTime(1, ctx.currentTime);
206
- dryGain.gain.setValueAtTime(1 - this._wet, ctx.currentTime);
207
- wetGain.gain.setValueAtTime(this._wet, ctx.currentTime);
208
- feedbackGain.gain.setValueAtTime(this._feedback, ctx.currentTime);
209
- lfoGain.gain.setValueAtTime(this._depth * this._baseFrequency, ctx.currentTime);
210
- // Allpass filter cascade
211
- const allpassFilters = [];
212
- for (let i = 0; i < this._stages; i++) {
213
- const filter = ctx.createBiquadFilter();
214
- filter.type = 'allpass';
215
- filter.frequency.setValueAtTime(this._baseFrequency, ctx.currentTime);
216
- allpassFilters.push(filter);
217
- }
218
- // LFO oscillator
219
- const lfoOscillator = ctx.createOscillator();
220
- lfoOscillator.type = 'sine';
221
- lfoOscillator.frequency.value = this._rateHz;
222
- // LFO wiring: lfoOscillator → lfoGain → each allpass.frequency (AudioParam)
223
- lfoOscillator.connect(lfoGain);
224
- for (const filter of allpassFilters) {
225
- lfoGain.connect(filter.frequency);
226
- }
227
- // Dry path: inputGain → dryGain → outputGain
228
- inputGain.connect(dryGain);
229
- dryGain.connect(outputGain);
230
- // Wet path: inputGain → allpass[0] → … → allpass[N-1] → wetGain → outputGain
231
- inputGain.connect(allpassFilters[0]);
232
- for (let i = 0; i < allpassFilters.length - 1; i++) {
233
- allpassFilters[i].connect(allpassFilters[i + 1]);
234
- }
235
- allpassFilters[allpassFilters.length - 1].connect(wetGain);
236
- wetGain.connect(outputGain);
237
- // Feedback path: allpass[N-1] → feedbackGain → feedbackDelay → allpass[0]
238
- // feedbackDelay breaks the zero-latency cycle so browsers do not mute the chain.
239
- allpassFilters[allpassFilters.length - 1].connect(feedbackGain);
240
- feedbackGain.connect(feedbackDelay);
241
- feedbackDelay.connect(allpassFilters[0]);
242
- lfoOscillator.start();
243
- this._setup = {
244
- inputGain,
245
- outputGain,
246
- dryGain,
247
- wetGain,
248
- feedbackGain,
249
- feedbackDelay,
250
- lfoGain,
251
- allpassFilters,
252
- lfoOscillator,
253
- };
254
- }
255
- }
5
+ * Phaser effect implemented with native Web Audio nodes (no worklet required).
6
+ *
7
+ * The wet signal passes through a cascade of allpass `BiquadFilterNode`s whose
8
+ * centre frequencies are swept synchronously by a sine LFO. The phase shift
9
+ * produced by each allpass stage creates sweeping notches when summed with the
10
+ * dry signal. An optional feedback path from the last stage back to the first
11
+ * adds resonance and sharpens the effect.
12
+ *
13
+ * Node graph:
14
+ * ```
15
+ * inputGain ┬── dryGain ───────────────────────────────────────┐
16
+ * │ ├── outputGain
17
+ * └── allpass[0] ─► ... ─► allpass[N-1] ── wetGain ───┘
18
+ * ▲ │
19
+ * └── feedbackDelay ◄── feedbackGain ◄─────────┘
20
+ *
21
+ * lfoOscillator ── lfoGain (depth × baseFrequency Hz) ──► each allpass.frequency
22
+ * ```
23
+ * Note: `feedbackDelay` is a {@link DelayNode} with `delayTime = 0`. Even at
24
+ * zero delay the node itself breaks the zero-latency cycle, which spec-compliant
25
+ * browsers (Chrome, Edge, Safari) would otherwise mute entirely.
26
+ * Gains: `dryGain.gain = 1 - wet`; `wetGain.gain = wet`;
27
+ * `feedbackGain.gain = feedback`; `lfoGain.gain = depth × baseFrequency`.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * const phaser = new PhaserEffect({ stages: 6, rateHz: 0.3, depth: 0.8, wet: 0.6 });
32
+ * bus.addEffect(phaser);
33
+ *
34
+ * // Automate the rate at runtime
35
+ * phaser.rateHz = 1.2;
36
+ * ```
37
+ */
38
+ var PhaserEffect = class extends AudioEffect {
39
+ _setup = null;
40
+ _stages;
41
+ _rateHz;
42
+ _baseFrequency;
43
+ _depth;
44
+ _feedback;
45
+ _wet;
46
+ _onAudioContextReady = (ctx) => {
47
+ onAudioContextReady.remove(this._onAudioContextReady);
48
+ this._setupNodes(ctx);
49
+ };
50
+ constructor(options = {}) {
51
+ super();
52
+ const rawStages = Math.max(2, Math.min(12, Math.round(options.stages ?? 4)));
53
+ this._stages = rawStages % 2 !== 0 ? Math.min(12, rawStages + 1) : rawStages;
54
+ this._rateHz = Math.max(0, Math.min(20, options.rateHz ?? .5));
55
+ this._baseFrequency = Math.max(50, Math.min(5e3, options.baseFrequency ?? 500));
56
+ this._depth = Math.max(0, Math.min(1, options.depth ?? .6));
57
+ this._feedback = Math.max(0, Math.min(.9, options.feedback ?? .3));
58
+ this._wet = Math.max(0, Math.min(1, options.wet ?? .5));
59
+ if (isAudioContextReady()) this._setupNodes(getAudioContext());
60
+ else onAudioContextReady.add(this._onAudioContextReady);
61
+ }
62
+ /**
63
+ * The node where audio enters this effect. Throws if the audio context is
64
+ * not yet initialized.
65
+ */
66
+ get inputNode() {
67
+ if (!this._setup) throw new Error("PhaserEffect not yet initialized.");
68
+ return this._setup.inputGain;
69
+ }
70
+ /**
71
+ * The node where audio exits this effect. Throws if the audio context is
72
+ * not yet initialized.
73
+ */
74
+ get outputNode() {
75
+ if (!this._setup) throw new Error("PhaserEffect not yet initialized.");
76
+ return this._setup.outputGain;
77
+ }
78
+ /**
79
+ * Number of allpass filter stages (even integer, 2..12). Set at construction
80
+ * time only; read-only at runtime.
81
+ */
82
+ get stages() {
83
+ return this._stages;
84
+ }
85
+ /**
86
+ * LFO sweep rate in Hz. Range 0..20, default 0.5. Changes are ramped
87
+ * smoothly via `setTargetAtTime`.
88
+ */
89
+ get rateHz() {
90
+ return this._rateHz;
91
+ }
92
+ set rateHz(value) {
93
+ this._rateHz = Math.max(0, Math.min(20, value));
94
+ if (this._setup) this._setup.lfoOscillator.frequency.setTargetAtTime(this._rateHz, this._setup.inputGain.context.currentTime, .01);
95
+ }
96
+ /**
97
+ * Centre frequency of all allpass stages in Hz. Range 50..5000, default 500.
98
+ * Changes are ramped smoothly and update both the filter frequencies and the
99
+ * absolute LFO depth.
100
+ */
101
+ get baseFrequency() {
102
+ return this._baseFrequency;
103
+ }
104
+ set baseFrequency(value) {
105
+ this._baseFrequency = Math.max(50, Math.min(5e3, value));
106
+ if (this._setup) {
107
+ const ctx = this._setup.inputGain.context;
108
+ for (const filter of this._setup.allpassFilters) filter.frequency.setTargetAtTime(this._baseFrequency, ctx.currentTime, .01);
109
+ this._setup.lfoGain.gain.setTargetAtTime(this._depth * this._baseFrequency, ctx.currentTime, .01);
110
+ }
111
+ }
112
+ /**
113
+ * LFO modulation depth as a fraction of `baseFrequency`. Range 0..1,
114
+ * default 0.6. Changes are ramped smoothly via `setTargetAtTime`.
115
+ */
116
+ get depth() {
117
+ return this._depth;
118
+ }
119
+ set depth(value) {
120
+ this._depth = Math.max(0, Math.min(1, value));
121
+ if (this._setup) this._setup.lfoGain.gain.setTargetAtTime(this._depth * this._baseFrequency, this._setup.inputGain.context.currentTime, .01);
122
+ }
123
+ /**
124
+ * Feedback gain from the last stage back to the first. Range 0..0.9,
125
+ * default 0.3. Changes are ramped smoothly via `setTargetAtTime`.
126
+ */
127
+ get feedback() {
128
+ return this._feedback;
129
+ }
130
+ set feedback(value) {
131
+ this._feedback = Math.max(0, Math.min(.9, value));
132
+ if (this._setup) this._setup.feedbackGain.gain.setTargetAtTime(this._feedback, this._setup.inputGain.context.currentTime, .01);
133
+ }
134
+ /**
135
+ * Wet (phased) mix level, 0..1. The dry level is automatically `1 - wet`.
136
+ * Changes are ramped smoothly via `setTargetAtTime`. Default 0.5.
137
+ */
138
+ get wet() {
139
+ return this._wet;
140
+ }
141
+ set wet(value) {
142
+ this._wet = Math.max(0, Math.min(1, value));
143
+ if (this._setup) {
144
+ const ctx = this._setup.wetGain.context;
145
+ this._setup.wetGain.gain.setTargetAtTime(this._wet, ctx.currentTime, .01);
146
+ this._setup.dryGain.gain.setTargetAtTime(1 - this._wet, ctx.currentTime, .01);
147
+ }
148
+ }
149
+ destroy() {
150
+ onAudioContextReady.remove(this._onAudioContextReady);
151
+ if (this._setup) {
152
+ this._setup.lfoOscillator.stop();
153
+ this._setup.lfoOscillator.disconnect();
154
+ this._setup.lfoGain.disconnect();
155
+ for (const filter of this._setup.allpassFilters) filter.disconnect();
156
+ this._setup.feedbackGain.disconnect();
157
+ this._setup.feedbackDelay.disconnect();
158
+ this._setup.dryGain.disconnect();
159
+ this._setup.wetGain.disconnect();
160
+ this._setup.inputGain.disconnect();
161
+ this._setup.outputGain.disconnect();
162
+ this._setup = null;
163
+ }
164
+ }
165
+ _setupNodes(ctx) {
166
+ const inputGain = ctx.createGain();
167
+ const outputGain = ctx.createGain();
168
+ const dryGain = ctx.createGain();
169
+ const wetGain = ctx.createGain();
170
+ const feedbackGain = ctx.createGain();
171
+ const lfoGain = ctx.createGain();
172
+ const feedbackDelay = ctx.createDelay(1);
173
+ feedbackDelay.delayTime.setValueAtTime(0, ctx.currentTime);
174
+ inputGain.gain.setValueAtTime(1, ctx.currentTime);
175
+ outputGain.gain.setValueAtTime(1, ctx.currentTime);
176
+ dryGain.gain.setValueAtTime(1 - this._wet, ctx.currentTime);
177
+ wetGain.gain.setValueAtTime(this._wet, ctx.currentTime);
178
+ feedbackGain.gain.setValueAtTime(this._feedback, ctx.currentTime);
179
+ lfoGain.gain.setValueAtTime(this._depth * this._baseFrequency, ctx.currentTime);
180
+ const allpassFilters = [];
181
+ for (let i = 0; i < this._stages; i++) {
182
+ const filter = ctx.createBiquadFilter();
183
+ filter.type = "allpass";
184
+ filter.frequency.setValueAtTime(this._baseFrequency, ctx.currentTime);
185
+ allpassFilters.push(filter);
186
+ }
187
+ const lfoOscillator = ctx.createOscillator();
188
+ lfoOscillator.type = "sine";
189
+ lfoOscillator.frequency.value = this._rateHz;
190
+ lfoOscillator.connect(lfoGain);
191
+ for (const filter of allpassFilters) lfoGain.connect(filter.frequency);
192
+ inputGain.connect(dryGain);
193
+ dryGain.connect(outputGain);
194
+ inputGain.connect(allpassFilters[0]);
195
+ for (let i = 0; i < allpassFilters.length - 1; i++) allpassFilters[i].connect(allpassFilters[i + 1]);
196
+ allpassFilters[allpassFilters.length - 1].connect(wetGain);
197
+ wetGain.connect(outputGain);
198
+ allpassFilters[allpassFilters.length - 1].connect(feedbackGain);
199
+ feedbackGain.connect(feedbackDelay);
200
+ feedbackDelay.connect(allpassFilters[0]);
201
+ lfoOscillator.start();
202
+ this._setup = {
203
+ inputGain,
204
+ outputGain,
205
+ dryGain,
206
+ wetGain,
207
+ feedbackGain,
208
+ feedbackDelay,
209
+ lfoGain,
210
+ allpassFilters,
211
+ lfoOscillator
212
+ };
213
+ }
214
+ };
256
215
 
216
+ //#endregion
257
217
  export { PhaserEffect };
258
- //# sourceMappingURL=PhaserEffect.js.map
218
+ //# sourceMappingURL=PhaserEffect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PhaserEffect.js","sources":["../../../../src/effects/PhaserEffect.ts"],"sourcesContent":[null],"names":[],"mappings":";;AA+CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCG;AACG,MAAO,YAAa,SAAQ,WAAW,CAAA;IACnC,MAAM,GAA6B,IAAI;AACvC,IAAA,OAAO;AACP,IAAA,OAAO;AACP,IAAA,cAAc;AACd,IAAA,MAAM;AACN,IAAA,SAAS;AACT,IAAA,IAAI;AACK,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,CAA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,CAAE,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,CAAE,CAAC;QACpD;AACA,QAAA,cAAc,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC,OAAO,CAAC,OAAO,CAAC;AAC3D,QAAA,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;;;AAI3B,QAAA,cAAc,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC,OAAO,CAAC,YAAY,CAAC;AAChE,QAAA,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC;QACnC,aAAa,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAE,CAAC;QAEzC,aAAa,CAAC,KAAK,EAAE;QAErB,IAAI,CAAC,MAAM,GAAG;YACZ,SAAS;YACT,UAAU;YACV,OAAO;YACP,OAAO;YACP,YAAY;YACZ,aAAa;YACb,OAAO;YACP,cAAc;YACd,aAAa;SACd;IACH;AACD;;;;"}
1
+ {"version":3,"file":"PhaserEffect.js","names":[],"sources":["../../../src/effects/PhaserEffect.ts"],"sourcesContent":["import { AudioEffect, getAudioContext, isAudioContextReady, onAudioContextReady } from '@codexo/exojs';\n\n/** Construction options for {@link PhaserEffect}. */\nexport interface PhaserEffectOptions {\n /**\n * Number of allpass filter stages. Must be an even integer in the range\n * 2..12. Odd values are rounded up to the next even number. Default 4.\n */\n stages?: number;\n /**\n * LFO sweep rate in Hz. Range 0..20, default 0.5.\n */\n rateHz?: number;\n /**\n * Centre frequency of all allpass stages in Hz. Range 50..5000, default 500.\n */\n baseFrequency?: number;\n /**\n * LFO modulation depth as a fraction of `baseFrequency`. Range 0..1,\n * default 0.6. The LFO peak deviation equals `depth × baseFrequency` Hz,\n * so the filter frequencies sweep between\n * `baseFrequency ± depth × baseFrequency`.\n */\n depth?: number;\n /**\n * Feedback gain from the last stage back to the first stage. Range 0..0.9,\n * default 0.3. Higher values add resonance and sharpen the notch sweep.\n */\n feedback?: number;\n /**\n * Dry/wet mix, 0..1. The dry level is automatically `1 - wet`. Default 0.5.\n */\n wet?: number;\n}\n\ninterface PhaserEffectSetup {\n readonly inputGain: GainNode;\n readonly outputGain: GainNode;\n readonly dryGain: GainNode;\n readonly wetGain: GainNode;\n readonly feedbackGain: GainNode;\n readonly feedbackDelay: DelayNode;\n readonly lfoGain: GainNode;\n readonly allpassFilters: BiquadFilterNode[];\n readonly lfoOscillator: OscillatorNode;\n}\n\n/**\n * Phaser effect implemented with native Web Audio nodes (no worklet required).\n *\n * The wet signal passes through a cascade of allpass `BiquadFilterNode`s whose\n * centre frequencies are swept synchronously by a sine LFO. The phase shift\n * produced by each allpass stage creates sweeping notches when summed with the\n * dry signal. An optional feedback path from the last stage back to the first\n * adds resonance and sharpens the effect.\n *\n * Node graph:\n * ```\n * inputGain ┬── dryGain ───────────────────────────────────────┐\n * │ ├── outputGain\n * └── allpass[0] ─► ... ─► allpass[N-1] ── wetGain ───┘\n * ▲ │\n * └── feedbackDelay ◄── feedbackGain ◄─────────┘\n *\n * lfoOscillator ── lfoGain (depth × baseFrequency Hz) ──► each allpass.frequency\n * ```\n * Note: `feedbackDelay` is a {@link DelayNode} with `delayTime = 0`. Even at\n * zero delay the node itself breaks the zero-latency cycle, which spec-compliant\n * browsers (Chrome, Edge, Safari) would otherwise mute entirely.\n * Gains: `dryGain.gain = 1 - wet`; `wetGain.gain = wet`;\n * `feedbackGain.gain = feedback`; `lfoGain.gain = depth × baseFrequency`.\n *\n * @example\n * ```ts\n * const phaser = new PhaserEffect({ stages: 6, rateHz: 0.3, depth: 0.8, wet: 0.6 });\n * bus.addEffect(phaser);\n *\n * // Automate the rate at runtime\n * phaser.rateHz = 1.2;\n * ```\n */\nexport class PhaserEffect extends AudioEffect {\n private _setup: PhaserEffectSetup | null = null;\n private _stages: number;\n private _rateHz: number;\n private _baseFrequency: number;\n private _depth: number;\n private _feedback: 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: PhaserEffectOptions = {}) {\n super();\n const rawStages = Math.max(2, Math.min(12, Math.round(options.stages ?? 4)));\n this._stages = rawStages % 2 !== 0 ? Math.min(12, rawStages + 1) : rawStages;\n this._rateHz = Math.max(0, Math.min(20, options.rateHz ?? 0.5));\n this._baseFrequency = Math.max(50, Math.min(5000, options.baseFrequency ?? 500));\n this._depth = Math.max(0, Math.min(1, options.depth ?? 0.6));\n this._feedback = Math.max(0, Math.min(0.9, options.feedback ?? 0.3));\n this._wet = Math.max(0, Math.min(1, options.wet ?? 0.5));\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('PhaserEffect 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('PhaserEffect not yet initialized.');\n return this._setup.outputGain;\n }\n\n // ---------------------------------------------------------------------------\n // Getters / setters\n // ---------------------------------------------------------------------------\n\n /**\n * Number of allpass filter stages (even integer, 2..12). Set at construction\n * time only; read-only at runtime.\n */\n public get stages(): number {\n return this._stages;\n }\n\n /**\n * LFO sweep rate in Hz. Range 0..20, default 0.5. Changes are ramped\n * smoothly via `setTargetAtTime`.\n */\n public get rateHz(): number {\n return this._rateHz;\n }\n public set rateHz(value: number) {\n this._rateHz = Math.max(0, Math.min(20, value));\n if (this._setup) {\n this._setup.lfoOscillator.frequency.setTargetAtTime(this._rateHz, this._setup.inputGain.context.currentTime, 0.01);\n }\n }\n\n /**\n * Centre frequency of all allpass stages in Hz. Range 50..5000, default 500.\n * Changes are ramped smoothly and update both the filter frequencies and the\n * absolute LFO depth.\n */\n public get baseFrequency(): number {\n return this._baseFrequency;\n }\n public set baseFrequency(value: number) {\n this._baseFrequency = Math.max(50, Math.min(5000, value));\n if (this._setup) {\n const ctx = this._setup.inputGain.context;\n for (const filter of this._setup.allpassFilters) {\n filter.frequency.setTargetAtTime(this._baseFrequency, ctx.currentTime, 0.01);\n }\n this._setup.lfoGain.gain.setTargetAtTime(this._depth * this._baseFrequency, ctx.currentTime, 0.01);\n }\n }\n\n /**\n * LFO modulation depth as a fraction of `baseFrequency`. Range 0..1,\n * default 0.6. Changes are ramped smoothly via `setTargetAtTime`.\n */\n public get depth(): number {\n return this._depth;\n }\n public set depth(value: number) {\n this._depth = Math.max(0, Math.min(1, value));\n if (this._setup) {\n this._setup.lfoGain.gain.setTargetAtTime(this._depth * this._baseFrequency, this._setup.inputGain.context.currentTime, 0.01);\n }\n }\n\n /**\n * Feedback gain from the last stage back to the first. Range 0..0.9,\n * default 0.3. Changes are ramped smoothly via `setTargetAtTime`.\n */\n public get feedback(): number {\n return this._feedback;\n }\n public set feedback(value: number) {\n this._feedback = Math.max(0, Math.min(0.9, value));\n if (this._setup) {\n this._setup.feedbackGain.gain.setTargetAtTime(this._feedback, this._setup.inputGain.context.currentTime, 0.01);\n }\n }\n\n /**\n * Wet (phased) mix level, 0..1. The dry level is automatically `1 - wet`.\n * Changes are ramped smoothly via `setTargetAtTime`. Default 0.5.\n */\n public get wet(): number {\n return this._wet;\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.lfoOscillator.stop();\n this._setup.lfoOscillator.disconnect();\n this._setup.lfoGain.disconnect();\n for (const filter of this._setup.allpassFilters) {\n filter.disconnect();\n }\n this._setup.feedbackGain.disconnect();\n this._setup.feedbackDelay.disconnect();\n this._setup.dryGain.disconnect();\n this._setup.wetGain.disconnect();\n this._setup.inputGain.disconnect();\n this._setup.outputGain.disconnect();\n this._setup = null;\n }\n }\n\n // ---------------------------------------------------------------------------\n // Private\n // ---------------------------------------------------------------------------\n\n private _setupNodes(ctx: AudioContext): void {\n const inputGain = ctx.createGain();\n const outputGain = ctx.createGain();\n const dryGain = ctx.createGain();\n const wetGain = ctx.createGain();\n const feedbackGain = ctx.createGain();\n const lfoGain = ctx.createGain();\n\n // A zero-length DelayNode in the feedback path is required so that\n // spec-compliant browsers do not mute the entire allpass chain. Browsers\n // are permitted to silence feedback cycles that contain no DelayNode (i.e.\n // zero-latency cycles), so even delayTime=0 here is sufficient to make the\n // cycle legal - the DelayNode itself introduces at least one render-quantum\n // of delay regardless of its delayTime parameter.\n const feedbackDelay = ctx.createDelay(1);\n feedbackDelay.delayTime.setValueAtTime(0, ctx.currentTime);\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 feedbackGain.gain.setValueAtTime(this._feedback, ctx.currentTime);\n lfoGain.gain.setValueAtTime(this._depth * this._baseFrequency, ctx.currentTime);\n\n // Allpass filter cascade\n const allpassFilters: BiquadFilterNode[] = [];\n for (let i = 0; i < this._stages; i++) {\n const filter = ctx.createBiquadFilter();\n filter.type = 'allpass';\n filter.frequency.setValueAtTime(this._baseFrequency, ctx.currentTime);\n allpassFilters.push(filter);\n }\n\n // LFO oscillator\n const lfoOscillator = ctx.createOscillator();\n lfoOscillator.type = 'sine';\n lfoOscillator.frequency.value = this._rateHz;\n\n // LFO wiring: lfoOscillator → lfoGain → each allpass.frequency (AudioParam)\n lfoOscillator.connect(lfoGain);\n for (const filter of allpassFilters) {\n lfoGain.connect(filter.frequency as unknown as AudioNode);\n }\n\n // Dry path: inputGain → dryGain → outputGain\n inputGain.connect(dryGain);\n dryGain.connect(outputGain);\n\n // Wet path: inputGain → allpass[0] → ... → allpass[N-1] → wetGain → outputGain\n inputGain.connect(allpassFilters[0]!);\n for (let i = 0; i < allpassFilters.length - 1; i++) {\n allpassFilters[i]!.connect(allpassFilters[i + 1]!);\n }\n allpassFilters[allpassFilters.length - 1]!.connect(wetGain);\n wetGain.connect(outputGain);\n\n // Feedback path: allpass[N-1] → feedbackGain → feedbackDelay → allpass[0]\n // feedbackDelay breaks the zero-latency cycle so browsers do not mute the chain.\n allpassFilters[allpassFilters.length - 1]!.connect(feedbackGain);\n feedbackGain.connect(feedbackDelay);\n feedbackDelay.connect(allpassFilters[0]!);\n\n lfoOscillator.start();\n\n this._setup = {\n inputGain,\n outputGain,\n dryGain,\n wetGain,\n feedbackGain,\n feedbackDelay,\n lfoGain,\n allpassFilters,\n lfoOscillator,\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiFA,IAAa,eAAb,cAAkC,YAAY;CAC5C,AAAQ,SAAmC;CAC3C,AAAQ;CACR,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,UAA+B,CAAC,GAAG;EACpD,MAAM;EACN,MAAM,YAAY,KAAK,IAAI,GAAG,KAAK,IAAI,IAAI,KAAK,MAAM,QAAQ,UAAU,CAAC,CAAC,CAAC;EAC3E,KAAK,UAAU,YAAY,MAAM,IAAI,KAAK,IAAI,IAAI,YAAY,CAAC,IAAI;EACnE,KAAK,UAAU,KAAK,IAAI,GAAG,KAAK,IAAI,IAAI,QAAQ,UAAU,EAAG,CAAC;EAC9D,KAAK,iBAAiB,KAAK,IAAI,IAAI,KAAK,IAAI,KAAM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IAAI,eAAe,SAAS,GAAG,KAC7C,eAAe,EAAE,CAAE,QAAQ,eAAe,IAAI,EAAG;EAEnD,eAAe,eAAe,SAAS,EAAE,CAAE,QAAQ,OAAO;EAC1D,QAAQ,QAAQ,UAAU;EAI1B,eAAe,eAAe,SAAS,EAAE,CAAE,QAAQ,YAAY;EAC/D,aAAa,QAAQ,aAAa;EAClC,cAAc,QAAQ,eAAe,EAAG;EAExC,cAAc,MAAM;EAEpB,KAAK,SAAS;GACZ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;CACF;AACF"}
@@ -6,7 +6,7 @@ export interface PingPongDelayEffectOptions {
6
6
  */
7
7
  delayTime?: number;
8
8
  /**
9
- * Cross-channel feedback fraction — the portion of each delayed tap routed
9
+ * Cross-channel feedback fraction - the portion of each delayed tap routed
10
10
  * into the opposite channel's delay input. Range 0..0.9, default 0.4.
11
11
  */
12
12
  feedback?: number;
@@ -81,3 +81,4 @@ export declare class PingPongDelayEffect extends AudioEffect {
81
81
  destroy(): void;
82
82
  private _setupNodes;
83
83
  }
84
+ //# sourceMappingURL=PingPongDelayEffect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PingPongDelayEffect.d.ts","sourceRoot":"","sources":["../../../src/effects/PingPongDelayEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA6D,MAAM,eAAe,CAAC;AAEvG,4DAA4D;AAC5D,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAeD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,mBAAoB,SAAQ,WAAW;IAClD,OAAO,CAAC,MAAM,CAAyC;IACvD,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAGnC;gBAEiB,OAAO,GAAE,0BAA+B;IAY3D;;;OAGG;IACH,IAAW,SAAS,IAAI,SAAS,CAGhC;IAED;;;OAGG;IACH,IAAW,UAAU,IAAI,SAAS,CAGjC;IAED;;;;OAIG;IACH,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED,IAAW,SAAS,CAAC,KAAK,EAAE,MAAM,EAOjC;IAED;;;;;OAKG;IACH,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED,IAAW,QAAQ,CAAC,KAAK,EAAE,MAAM,EAOhC;IAED;;;OAGG;IACH,IAAW,GAAG,IAAI,MAAM,CAEvB;IAED,IAAW,GAAG,CAAC,KAAK,EAAE,MAAM,EAO3B;IAEe,OAAO,IAAI,IAAI;IAiB/B,OAAO,CAAC,WAAW;CA+DpB"}