PageSourceSearch

https://www.amaldate.com/app/voice-processor-worklet.js

js amaldate.com collected 2026-10-04 09:10:50 UTC 813 bytes, 30 lines download raw bytes

1// eslint-disable-next-line no-undef
2class VoiceProcessor extends AudioWorkletProcessor {
3    constructor() {
4        super()
5        this.volume = 0
6    }
7
8    process(inputs) {
9        const input = inputs[0]
10        const channelData = input[0]
11
12        if (channelData) {
13            // Calculate volume level
14            let sum = 0
15            for (let i = 0; i < channelData.length; i++) {
16                sum += channelData[i] * channelData[i]
17            }
18            const rms = Math.sqrt(sum / channelData.length)
19            this.volume = rms
20
21            // Send data to the main thread
22            this.port.postMessage({ volume: this.volume })
23        }
24
25        return true // Continue processing
26    }
27}
28
29// eslint-disable-next-line no-undef
30registerProcessor('voice-processor', VoiceProcessor)

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.