<commit_before>var video = document.getElementById('vid');
video.loop = true;

var graphs_element = document.getElementById("graphs");

document.getElementById("media_button").addEventListener("click",usemedia);
document.getElementById("video_button").addEventListener("click",usevideo);
document.getElementById("mic_button").addEventListener("click",usemic);

var game = new VowelWorm.Game({element: graphs_element});

function usemedia() {
  var worms = [];
  var audio_els = document.getElementsByClassName('media');

  for(var i = 0; i<audio_els.length; i++) {
    var audio = audio_els[i];
    audio.style.display = 'block';
    audio.loop = true;
    audio.play();
    var worm = new VowelWorm.instance(audio);
    worms.push(worm);
    game.addWorm(worm);
  }
}

function usevideo() {
  video.style.display = 'block';
  var worm = new VowelWorm.instance(video);
};

function usemic() {
  audio.pause();
  audio.style.display = 'none';
  getUserMedia({audio: true}, micSuccess, micFailure);
};

function getUserMedia() {
  (navigator.getUserMedia || navigator.mozGetUserMedia || navigator.webkitGetUserMedia
          || function(){alert('getUserMedia missing')}).apply(navigator, arguments);
}

function micSuccess(stream) {
  var worm = new VowelWorm.instance(stream);
};

function micFailure() {
  alert("Could not capture microphone input");
};<commit_msg>Fixes issue with not being able to use microphone.<commit_after>var video = document.getElementById('vid');
video.loop = true;

var graphs_element = document.getElementById("graphs");

document.getElementById("media_button").addEventListener("click",usemedia);
document.getElementById("video_button").addEventListener("click",usevideo);
document.getElementById("mic_button").addEventListener("click",usemic);

var game = new VowelWorm.Game({element: graphs_element});

function usemedia() {
  var worms = [];
  var audio_els = document.getElementsByClassName('media');

  for(var i = 0; i<audio_els.length; i++) {
    var audio = audio_els[i];
    audio.style.display = 'block';
    audio.loop = true;
    audio.play();
    var worm = new VowelWorm.instance(audio);
    worms.push(worm);
    game.addWorm(worm);
  }
}

function usevideo() {
  video.style.display = 'block';
  var worm = new VowelWorm.instance(video);
};

function usemic() {
  getUserMedia({audio: true}, micSuccess, micFailure);
};

function getUserMedia() {
  (navigator.getUserMedia || navigator.mozGetUserMedia || navigator.webkitGetUserMedia
          || function(){alert('getUserMedia missing')}).apply(navigator, arguments);
}

function micSuccess(stream) {
  var worm = new VowelWorm.instance(stream);
};

function micFailure() {
  alert("Could not capture microphone input");
};
{'fraction_non_alphanumeric': 0.1488970588235294, 'fraction_numerical': 0.0007352941176470588, 'mean_word_length': 5.3723653395784545, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '5570027', 'n_tokens_mistral': 830, 'n_tokens_neox': 820, 'n_words': 165}