@thi.ng/dsp
Version:
Composable signal generators, oscillators, filters, FFT, spectrum, windowing & related DSP utils
38 lines • 1.31 kB
TypeScript
import type { StatelessOscillator } from "./api.js";
/**
* Oscillator using Discrete Summation Formula:
*
* `y(t) = (1-a^2) * sin(2πt) / (1 + a^2 - 2a * cos(b * 2πt))`
*
* @remarks
* `alpha` should be in `[0,1)` interval, `beta` is used as factor for the base
* `freq` and used for the cosine modulation term. The default config for both
* params is 0.5, 1.0 respectively, creating a waveform similar to a bandlimited
* sawtooth. If both params are zero, the result is a pure sine.
*
* Note: Higher `alpha` values cause an increasing number (and amplitude) of
* spikes in the waveform. Therefore, the higher the `alpha`, the lower `amp`
* should be to avoid excessive out-of-range values.
*
* References:
*
* - [Interactive graph](https://www.desmos.com/calculator/klvl9oszfm)
* - https://ccrma.stanford.edu/files/papers/stanm5.pdf
*
* @param phase -
* @param freq -
* @param amp -
* @param dc -
* @param alpha -
* @param beta -
*/
export declare const dsf: StatelessOscillator;
/**
* Higher order version of {@link dsf} oscillator with pre-configured
* params. Slightly faster, but not dynamically changeable waveform.
*
* @param alpha -
* @param beta -
*/
export declare const dsfHOF: (alpha?: number, beta?: number) => StatelessOscillator;
//# sourceMappingURL=osc-dsf.d.ts.map