AudioWorkerShim
AudioWorker compatibility shim for legacy Web Audio API
Installation
$ npm install audio-worker-shim
downloads:
-
with AudioWorkerCompiler
- audio-worker-shim.js (554.78kB)
- audio-worker-shim.min.js (299.78kB)
-
without AudioWorkerCompiler
- audio-worker-shim-light.js (69.11kB)
- audio-worker-shim-light.min.js (30.81kB)
Demo
API
AudioWorkerShim
polyfill(): void
Example
Main file javascript
; var audioContext = ; audioContext;
bitcrusher_worker.js
// Custom parameter - number of bits to crush down to - default 8this; // Custom parameter - frequency reduction, 0-1, default 0.5this; { enodephaser = 0; enodelastDataValue = 0;}; { for var channel = 0; channel < einputs0length; channel++ var inputBuffer = einputs0channel; var outputBuffer = eoutputs0channel; var bufferLength = inputBufferlength; var bitsArray = eparametersbits; var frequencyReductionArray = eparametersfrequencyReduction; for var i = 0; i < bufferLength; i++ var bits = bitsArray ? bitsArrayi : 8; var frequencyReduction = frequencyReductionArray ? frequencyReductionArrayi : 05; var step = Math; enodephaser += frequencyReduction; if enodephaser >= 10 enodephaser -= 10; enodelastDataValue = step * Math; outputBufferi = enodelastDataValue; };
SEE ALSO
License
MIT