Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | type AudioChannel = Float32Array; type AudioInputs = Array<AudioChannel>; type AudioOutputs = Array<AudioChannel> type AudioParameters = Record<string, Float32Array>; class WhiteNoiseProcessor extends AudioWorkletProcessor { constructor(_options: any) { super(); } process(inputs: Array<AudioInputs>, outputs: Array<AudioOutputs>, parameters: AudioParameters) { const output = outputs[0]; output.forEach(channel => { for (let i = 0; i < channel.length; i++) { channel[i] = Math.random() * 2 - 1 } }); // The the browser handle destruction // Chrome currently requires true :( return true; } } // registerProcessor('white-noise-processor', (options: any) => new WhiteNoiseProcessor(options)); // @ts-ignore registerProcessor('white-noise-processor', WhiteNoiseProcessor); |