@thi.ng/dsp
Version:
Composable signal generators, oscillators, filters, FFT, spectrum, windowing & related DSP utils
21 lines (20 loc) • 421 B
JavaScript
import { SYSTEM } from "@thi.ng/random/system";
import { AGen } from "./agen.js";
const whiteNoise = (gain, rnd) => new WhiteNoise(gain, rnd);
class WhiteNoise extends AGen {
constructor(_gain = 1, _rnd = SYSTEM) {
super(0);
this._gain = _gain;
this._rnd = _rnd;
}
reset() {
return this;
}
next() {
return this._val = this._rnd.norm(this._gain);
}
}
export {
WhiteNoise,
whiteNoise
};