Skip to content

Instantly share code, notes, and snippets.

@cho45
Created June 28, 2019 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cho45/0808821469a8a84c2231dd54eac67798 to your computer and use it in GitHub Desktop.
Save cho45/0808821469a8a84c2231dd54eac67798 to your computer and use it in GitHub Desktop.
class SignalProcessor extends AudioWorkletProcessor {
constructor() {
super();
this.buffers = [];
this.port.onmessage = (e) => {
console.log(e, this.buffers);
this.port.postMessage(this.buffers);
// this.buffers.length = 0;
};
}
process(inputs, outputs, parameters) {
this.buffers.push(inputs);
return true;
}
}
registerProcessor('signal-processor', SignalProcessor);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment