LowPassFilterWorklet

AudioFilterWorkletceramic.LowPassFilterWorklet (Class)

The audio processing worklet for the low-pass filter. Implements a second-order biquad low-pass filter with per-channel processing.

Instance Members

process(buffer: AudioFilterBuffer, samples: Int, channels: Int, sampleRate: Float, time: Float): Void

Process audio buffer in place. Override this method to implement custom filtering. CAUTION: this may be called from a background thread

Name Type Description
buffer AudioFilterBuffer The audio buffer to process (modify in place, planar layout: one channel after another, not interleaved)
samples Int Number of samples per channel
channels Int Number of audio channels (1 = mono, 2 = stereo)
sampleRate Float Sample rate in Hz
time Float Current playback time in seconds

new(filterId: Int, bus: Int): Void
Name Type
filterId Int
bus Int

Private Members

cutoffFrequency: Float

Cutoff frequency in Hz. Frequencies above this value will be attenuated. Range: 1 Hz to half the sample rate (Nyquist frequency). Default: 1000 Hz


gain: Float

Filter gain/amplitude multiplier. Adjusts the overall output level after filtering. Range: 0.0 to any positive value (1.0 = unity gain). Default: 1.0


resonance: Float

Filter resonance/Q factor. Controls the sharpness of the filter and frequency emphasis at the cutoff.

  • 0.707: No resonance (Butterworth response, flat passband)
  • < 0.707: Gentler rolloff
  • > 0.707: Sharper rolloff with peak at cutoff
  • High values (5-30): Creates strong resonant peak (self-oscillation) Range: 0.1 to 30.0 (higher values = more resonance) Default: 0.707





a0: Float

a1: Float

a2: Float

b1: Float

b2: Float

lastCutoff: Float

lastQ: Float

lastSampleRate: Float

calculateCoefficients(cutoff: Float, q: Float, sampleRate: Float): Void

Calculates biquad filter coefficients for the low-pass response. Uses the standard audio EQ cookbook formulas for a second-order low-pass filter.

Name Type Description
cutoff Float Cutoff frequency in Hz
q Float Quality factor (resonance)
sampleRate Float Sample rate in Hz