<commit_before>function Visualizer(){
  var visualizer = {};
  visualizer.container = null;
  visualizer.audioSource = null;
  visualizer.fgCanvas = null;
  visualizer.fgCtx = null;
  visualizer.step = 3;
  visualizer.init = function(opts){
    visualizer.container = window.document.getElementById(opts.container);
    visualizer.audioSource = opts.audioSource;
    visualizer.fgCanvas = window.document.createElement('canvas');
    visualizer.fgCtx = visualizer.fgCanvas.getContext('2d');
    visualizer.container.appendChild(visualizer.fgCanvas);
    visualizer.fgCanvas.width = visualizer.audioSource.streamData.length*2;
    visualizer.fgCanvas.height = '128';
  }
  visualizer.start = function(){
    draw(); 
  }
  var draw = function(){
    visualizer.fgCtx.fillStyle = '#FFFFFF';
    visualizer.fgCtx.fillRect(0,0,256,256);
    visualizer.fgCtx.fillStyle = '#000000';
    var step = visualizer.step;
    for(var i = 0;i<visualizer.audioSource.streamData.length;i++){
      visualizer.fgCtx.fillRect(i*step,Math.floor(62 - 62*(visualizer.audioSource.streamData[i]/256)),step,2);
    }
    requestAnimationFrame(draw);
  };
  return visualizer;
}<commit_msg>added click handler<commit_after>function Visualizer(){
  var timer = null;
  var draw = [drawPeaks];
  var visualizer = {};
  visualizer.container = null;
  visualizer.audioSource = null;
  visualizer.fgCanvas = null;
  visualizer.fgCtx = null;
  visualizer.step = 3;
  visualizer.init = function(opts){
    visualizer.container = window.document.getElementById(opts.container);
    visualizer.audioSource = opts.audioSource;
    visualizer.fgCanvas = window.document.createElement('canvas');
    visualizer.fgCtx = visualizer.fgCanvas.getContext('2d');
    visualizer.container.appendChild(visualizer.fgCanvas);
    visualizer.fgCanvas.width = visualizer.audioSource.streamData.length*2;
    visualizer.fgCanvas.height = '128';
  };
  visualizer.start = function(){
    visualizer.fgCanvas.addEventListener('click', function(){
      visualizer.step += 1;
      if(visualizer.step > 8){
        visualizer.step = 3;
      }
    });
    draw[0](); 
  };
  var drawPeaks = function(){
    visualizer.fgCtx.fillStyle = '#FFFFFF';
    visualizer.fgCtx.fillRect(0,0,256,256);
    visualizer.fgCtx.fillStyle = '#000000';
    var step = visualizer.step;
    for(var i = 0;i<visualizer.audioSource.streamData.length;i++){
      visualizer.fgCtx.fillRect(i*step,Math.floor(62 - 62*(visualizer.audioSource.streamData[i]/256)),step,2);
    }
    timer = requestAnimationFrame(drawPeaks);
  };
  return visualizer;
}
{'fraction_non_alphanumeric': 0.13846752236483859, 'fraction_numerical': 0.024115130299494362, 'mean_word_length': 4.154308617234469, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2594726', 'n_tokens_mistral': 854, 'n_tokens_neox': 818, 'n_words': 119}