mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-30 00:50:47 +03:00
16 lines
352 B
JavaScript
16 lines
352 B
JavaScript
class WhiteNoiseProcessor extends AudioWorkletProcessor {
|
|
process(inputs, outputs) {
|
|
const output = outputs[0];
|
|
|
|
for (const channel of output) {
|
|
for (let i = 0; i < channel.length; i++) {
|
|
channel[i] = Math.random() * 2 - 1;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
|
|
registerProcessor('white-noise-processor', WhiteNoiseProcessor);
|