Implementation of a bit-crush effect using the Web Audio API.
Browserify is recommended; alternatively you can grab a UMD module from the
build directory. If using
$ npm install bitcrusher
var bitcrusher = ;var audioContext = window;var bitcrushNode =;var mySource = // ... create audio sourcemySource;bitcrushNode;
Create a new bitcrusher in the Web Audio Context
audioContext configured with the supplied options:
bufferSize: defaults to 4096
channelCount: defaults to 2
bitDepth: output resolution, defaults to 8
frequency: sample-and-hold ratio; used to reduce the perceived output frequency. Defaults to 1 (no change).
ScriptProcessorNode configured with a bitcrush effect.
If you're running OS X, open
Grapher.app to visualise the algorithm.
frequency options would ideally instances of
AudioParam. Unfortunately the Web Audio API does not yet allow standalone instances to be created.