This project is part of the @thi.ng/umbrella monorepo.
Composable signal generators, oscillators, filters, FFT, spectrum, windowing & related DSP utils.
Partially ported from other thi.ng projects (e.g. thi.ng/synstack, thi.ng/vexed-generation, toxiclibs).
STABLE - used in production
yarn add @thi.ng/dsp
Several demos in this repo's /examples directory are using this package.
A selection:
Interactive inverse FFT toy synth
- add - adder
- alt - alternating values
- constant - constant value
- cosP - trig-free cosine osc
- exp - time-based exponential gain/decay (factory for
mul
) - impulse - impulse gen
- line - line gen (factory for
add
) - madd - multiply-adder
- mul - multiplier (exponential gain/decay)
- reciprocal - fractional sequence (1, 1/2, 1/3, 1/4 etc.)
- trigger - cyclic impulse
- comp -
IGen
composition (1-4 inputs) - addG - higher-order adder
- product - product of input gens
- sum - sum of input gens
- wrapAroundG - folds input gen into given interval
comb()
mix()
(HOF)rect()
saw()
sin()
tri()
wavetable()
(HOF)
Band-limited:
additive()
(HOF)squareAdditive()
sawAdditive()
Trigonometry free sin/cos oscillator / iterator based on a state-variable filter. Only useable for freq < ~2Hz.
The following diagrams show various combinations of oscillator signals and their filtered responses (with different cutoff/center frequencies). The red waveform is the original generated 1kHz signal.
All diagrams were generated with this script.
TODO
The bandwidth of each filter is set to 1/2 of its center frequency.
Ringbuffer / delay line for arbitrary values and support for tapping at any relative position.
DelayLine
class
fft()
ifft()
normalizeFFT()
denormalizeFFT()
scaleFFT()
complexArray()
conjugate()
spectrumMag()
spectrumPow()
(optionally as dBFS)spectrumPhase()
binFreq()
freqBin()
fftFreq()
window()
windowRect()
windowSin()
windowSinPow()
windowLanczos()
windowHann()
windowHamming()
windowBlackman()
windowBlackmanHarris()
windowNuttal()
windowBlackmanNuttal()
windowGauss()
Karsten Schmidt
© 2015 - 2020 Karsten Schmidt // Apache Software License 2.0