Slide 40
Slide 40 text
this.node = ctx.createScriptProcessor(bufferSize, 1, 1);
this.node.onaudioprocess = audioProcessingEvent => {
const channel = 0;
const inputBuffer = audioProcessingEvent.inputBuffer;
const input = inputBuffer.getChannelData(channel);
// then we'll read the values for own processing
this.read(input, performance.now());
// copy the input directly across to the output
const outputBuffer = audioProcessingEvent.outputBuffer;
const output = outputBuffer.getChannelData(channel);
inputBuffer.copyFromChannel(output, channel, channel);
};
// constructor continues...