API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classPitchShiftEffect

@codexo/exojs-audio-fx / audio / stable

Real-time pitch shifter (WorkletEffect) using SOLA - synchronized overlap-add. Each synthesis grain is realigned by waveform cross-correlation, so grain restarts stay phase coherent and the output pitch tracks the `pitch` ratio exactly across the whole 0.25x-4.0x range (a naive granular delay drifts the pitch instead). Quality: clean, in-tune shifting for tonal material. As with any time-domain method, sharp transients can smear or double slightly; for those a phase vocoder would do better at the cost of much more CPU and latency. Latency: ~one frame + search ≈ 30ms at the default 1024-sample grain (at 48kHz). Not suitable for live monitoring; fine for games / playback. Use cases: - Sound variation: random ±200 cent pitch on each footstep / bullet - Voice effects: chipmunk (1.5x) or demon (0.7x) for game NPCs - Detune layering: stack 0.99x and 1.01x for thick chorused sound

5
props
3
methods
0
events
Import
import { PitchShiftEffect } from '@codexo/exojs-audio-fx'

Real-time pitch shifter (WorkletEffect) using SOLA - synchronized overlap-add. Each synthesis grain is realigned by waveform cross-correlation, so grain restarts stay phase coherent and the output pitch tracks the `pitch` ratio exactly across the whole 0.25x-4.0x range (a naive granular delay drifts the pitch instead).

Quality: clean, in-tune shifting for tonal material. As with any time-domain method, sharp transients can smear or double slightly; for those a phase vocoder would do better at the cost of much more CPU and latency.

Latency: ~one frame + search ≈ 30ms at the default 1024-sample grain (at 48kHz). Not suitable for live monitoring; fine for games / playback.

Use cases: - Sound variation: random ±200 cent pitch on each footstep / bullet - Voice effects: chipmunk (1.5x) or demon (0.7x) for game NPCs - Detune layering: stack 0.99x and 1.01x for thick chorused sound

Constructors1
new(options: PitchShiftEffectOptions): PitchShiftEffect
Methods3
_onWorkletReady(): void
Subclass hook - called once the worklet is loaded and inserted into the wet path. Use for additional wiring (e.g. a sidechain input).
_setAudioParam(name: string, value: number): void
Ramps an AudioParam on the underlying AudioWorkletNode to value using a short exponential ramp. No-ops if the worklet is not yet loaded. Part of the effect SDK contract for extension audio effects.
destroy(): void
Disconnects all nodes, cancels any pending worklet load, and releases resources.
Properties5
inputNode: AudioNode
The node where audio enters this effect.
outputNode: AudioNode
The node where audio exits this effect.
pitch: number
Pitch ratio relative to the original. 1.0 = no change, 0.5 = one octave down, 2.0 = one octave up. Range 0.25..4.0, default 1.0.
ready: Promise<void>
Resolves once the worklet is loaded and inserted into the wet path. Also resolves when the load fails - the effect then stays the clean passthrough it is until the worklet arrives, and the failure is reported through the engine log rather than by rejecting.
wet: number
Wet (processed) mix level, 0..1. The dry level is automatically 1 - wet. Ramped smoothly.
Source