UNPKG

@thi.ng/dsp

Version:

Composable signal generators, oscillators, filters, FFT, spectrum, windowing & related DSP utils

24 lines (23 loc) 401 B
import { AGen } from "./agen.js"; const reciprocal = (step) => new Reciprocal(step); class Reciprocal extends AGen { constructor(_step = 1) { super(1); this._step = _step; this.reset(); } _step; _n; reset() { this._n = 1 - this._step; return this; } next() { this._n += this._step; return this._val = 1 / this._n; } } export { Reciprocal, reciprocal };