melonJS
    Preparing search index...

    Interface NoiseOptions

    Options for noise.

    interface NoiseOptions {
        attack?: number;
        duration: number;
        filter?: NoiseFilter;
        filterSweep?: number;
        gain?: number;
        pan?: number;
        type?: "white" | "brown" | "pink";
    }
    Index

    Properties

    attack?: number

    Attack time in seconds — linear ramp from 0 up to gain. Clamped to [0.001, duration / 2]. For very short durations (< 2 ms) the upper bound wins so the envelope still fits inside the playback window. Defaults to 0.005.

    duration: number

    Total burst length in seconds (envelope decays over this window).

    filter?: NoiseFilter

    Optional NoiseFilter applied to the noise source before the master gain. Use this to colour the noise — a lowpass on brown noise gives "explosion thump", a highpass on white gives "hi-hat tick", a bandpass gives "swoosh".

    filterSweep?: number

    Frequency multiplier applied to NoiseFilter.frequency over duration as an exponential ramp. 1 = no sweep (default); >1 = filter opens upward (rising swoosh, laser pew); <1 = filter closes downward (descending thunk, explosion settle). Has no effect when filter is unset.

    gain?: number

    Peak gain at attack end, 0..1. Defaults to 0.1.

    pan?: number

    Stereo pan, -1 (full left) to 1 (full right). Defaults to 0.

    type?: "white" | "brown" | "pink"

    Spectral colour of the noise source:

    • "white" — flat, all frequencies equal (default).
    • "pink" — −3 dB / octave roll-off, perceptually balanced — classic for breath, wind, and acoustic-sounding ambient texture.
    • "brown" (red) — −6 dB / octave roll-off, low and rumbly — classic for distant thunder, ocean, low-fi rumble.