Skip to content

NoiseGenerator

Overview

white noise generator with optional low- and high-pass filters

@author John Blanco

Class NoiseGenerator

import { NoiseGenerator } from 'scenerystack/tambo';

Constructor

new NoiseGenerator( providedOptions? : NoiseGeneratorOptions )

Instance Methods

start( delay )

Start the noise source. @param [delay] - optional delay for when to start the noise source, in seconds

stop( time )

Stop the noise source. @param [time] - optional audio context time at which this should be stopped

setLfoFrequency( frequency : number )

Set the frequency of the low frequency amplitude modulator (LFO).

setLfoDepth( depth : number )

Set the depth of the LFO modulator. @param depth - depth value from 0 (no modulation) to 1 (max modulation)

setLfoEnabled( enabled : boolean )

Turn the low frequency amplitude modulation on/off.

setBandpassFilterCenterFrequency( frequency : number, timeConstant )

set the Q value for the band pass filter, assumes that noise generator was created with this filter enabled

Type NoiseGeneratorOptions

import type { NoiseGeneratorOptions } from 'scenerystack/tambo';
  • noiseType?: "pink" | "white" | "brown"
  • lowPassCutoffFrequency?: number | null
    low pass value in Hz, null (or any falsey value including zero) means no low pass filter is added
  • highPassCutoffFrequency?: number | null
    high pass value in Hz, null (or any falsey value including zero) means no high pass filter is added
  • centerFrequency?: number | null
    center frequency for band pass filter value in Hz, null (or any falsey value including zero) means no band pass filter is added
  • qFactor?: number
    Q factor, aka quality factor, for bandpass filter if present, see Web Audio BiquadFilterNode for more information
  • lfoInitiallyEnabled?: boolean
    parameters that control the behavior of the low frequency oscillator (LFO), which does amplitude modulation on the noise
  • lfoInitialFrequency?: number
  • lfoInitialDepth?: number
  • lfoType?: OscillatorType
  • & SoundGeneratorOptions

Source Code

See the source for NoiseGenerator.ts in the tambo repository.