A real-time loudness meter for Web Audio API
based on the ITU-R BS.1770-5 standard, implemented as an AudioWorkletProcessor
.
Download pre-built file loudness.worklet.js
-
Register the processor in your audio context:
audioContext.audioWorklet.addModule('loudness.worklet.js').then(() => { const loudnessNode = new AudioWorkletNode(audioContext, 'loudness-processor'); audioSource.connect(loudnessNode).connect(audioContext.destination); loudnessNode.port.onmessage = (event) => { console.log('Loudness Data:', event.data); }; });
-
The processor outputs the following via the
port
:{ "currentFrame": 2048, "currentTime": 3.42, "currentMetrics": [ { "momentaryLoudness": -18.2, "shortTermLoudness": -17.5, "integratedLoudness": -20.0, "loudnessRange": 6.2, "maximumTruePeakLevel": -0.8 } ] }
This project is a learning experiment aimed at exploring audio signal processing and ITU-R BS.1770 loudness measurement standards. I am not an expert in audio engineering or signal processing, and this project was developed as a way to better understand the concepts of audio loudness and implementation techniques. Thanks to the ITU-R BS.1770 standards for providing the theoretical basis for loudness measurement.
This project is licensed under the MIT License.