1class AudioRecorderProcessor extends AudioWorkletProcessor { 2 // Maximum value for 16-bit signed integer 3 static INT16_MAX = 32767; 4 5 process(inputs, outputs, parameters) { 6 // Get the first input's first channel 7 const input = inputs[0][0]; 8 9 if (!input) return true; 10 11 // Convert Float32Array to Int16Array 12 const int16Array = new Int16Array(input.length); 13 for (let i = 0; i < input.length; i++) { 14 int16Array[i] = input[i] * AudioRecorderProcessor.INT16_MAX; 15 } 16 17 // Send the audio data to the main thread 18 this.port.postMessage({ 19 audioData: int16Array 20 }); 21 22 return true; 23 } 24} 25 26registerProcessor('audio-recorder-processor', AudioRecorderProcessor);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.