constaudioElement = document.getElementById('audio');constviewElement = document.getElementById('div-analyzer');consta = newAmplitudeAnalyzer(audioElement, viewElement, { colorClip:'#f00' });// We can start only after user starts interact with our page.// This is because of HTML Web Audio API restriction.document.body.onclick = () => {audioElement.play();a.start();}
Amplitude analyzer widget.
Example:
See more options at interface definition: IAmplitudeAnalyzerOptions