@thi.ng/dsp
Version:
Composable signal generators, oscillators, filters, FFT, spectrum, windowing & related DSP utils
25 lines (24 loc) • 468 B
JavaScript
import { clamp01 } from "@thi.ng/math/interval";
import { AProc2 } from "./aproc.js";
import { __ensureGenN } from "./internal/ensure.js";
const mix = (t) => new Mix(t);
class Mix extends AProc2 {
_t;
constructor(t = 0.5) {
super(0);
this.mix = t;
}
get mix() {
return this._t.deref();
}
set mix(t) {
this._t = __ensureGenN(t, clamp01);
}
next(a, b) {
return this._val = a + (b - a) * this._t.next();
}
}
export {
Mix,
mix
};