A digital signal processing library in Javascript
Switch branches/tags
Nothing to show
Clone or download
Latest commit fea1c79 May 9, 2017



A digital signal processing library in Javascript

Build Status Code Climate js-standard-style license

This is my journey to study dsp. This library is not intended to be used.. There are excellent dsp js libraries out there, for example:

Since I usually learn by coding, this is my code learning result. I'm building while trying to understand the main concepts of dsp targeting audio applications.

Work in progress. Experimental (API). Not sure if it will be published, currently is just a playground to understand DSP concepts.

const dsp = require('dsp-kit')
const signal = dsp.fill(1024, (x) => Math.sin(x))
const { magnitudes, phases } = dsp.spectrum(dsp.fft(1024, signal))
// generate a signal adding two sines
const oscillator = dsp.fill(1024, dsp.add(dsp.sine(440), dsp.sine(880)))

This is a multimodule repository, each functionallity wrapped in its own package:

  • dsp: a facade module that exposes some modules as a coherent package. Probably you just need to install and use that one (unless you are concerned with code size or some esoteric features)
  • array: array utilities
  • dft: discrete fourier implementation (very slow, but easy to understand)
  • elastica: timestretch for web audio api (it will be extracted it is own repo when ready).
  • fft: the default fast fourier algorithm
  • fft-radix2: fast forward fourier algorithm using a Cooley-Tukey radix-2 algorithm
  • fft-asm: a high performance fft implementation based on asm.js (work in progress)
  • fftshift: rotate arrays to perform zero-phasing windowing
  • ola: overlap and add algorithm for time strething
  • oscillator: work in progress
  • noise: functions to generate noise
  • signal: generate and manipulate signals
  • phase-vocoder: phase vocoder algorithm to perform time strething and other signal transformations
  • rfft: real split radix FFT (work in progress)
  • spectrum: spectrum manipulation utilities
  • waa: web audio api interop utilities (wip)
  • window: windowing functions


-npm install dsp-kit

But currently is not updated to latests version. You can install from this repository:

npm i git@github.com:oramics/dsp-kit.git


Read the generated API documentation


Clone the repo and install dependencies: npm install and init lerna: lerna bootstrap

Then you can list all the npm tasks with npm run:

  • run tests: npm test
  • run benchmarks: npm run benchmark
  • generate documentation: npm run docs


Large part of the code is based on the now unmantained dsp.js library by @corbanbrook, that in turn was based on code samples by Almer Thie.

Also, this library takes (steal) inspiration from:

## References