Aubert-Antoine / loudness-visualizer

💁This repository is a personal project, open to the community🚀. This Chrome extension allows to display the volume of the audio stream (I/O) of the Chrome page. The display is composed of vu metre in db (rms and peak) + LUFS (integrate, momentary and short term) 🔉.
GNU General Public License v3.0
1 stars 1 forks source link

Function emulation input #3

Open Aubert-Antoine opened 1 year ago

Aubert-Antoine commented 1 year ago

Function emulation input :

vu meter source code from jsfiddle.

  // Let the music play
  function(chart) {
    setInterval(function() {
      if (chart.series) { // the chart may be destroyed
        var left = chart.series[0].points[0],
          right = chart.series[1].points[0],
          leftVal,
          rightVal,
          inc = (Math.random() - 0.5) * 3;

        leftVal = left.y + inc;
        rightVal = leftVal + inc / 3;
        if (leftVal < -20 || leftVal > 6) {
          leftVal = left.y - inc;
        }
        if (rightVal < -20 || rightVal > 6) {
          rightVal = leftVal;
        }

        left.update(leftVal, false);
        right.update(rightVal, false);
        chart.redraw();
      }
    }, 500);