<commit_before>
  var context;
  init();

  function freq (key_index) {
    return 440 * Math.pow(2, (key_index - 49) / 12.0)
  }

  function init() {
    try {
      window.AudioContext = window.AudioContext || window.webkitAudioContext;
      context = new AudioContext();
    }
    catch(e) {
      alert('Web Audio API is not supported in this browser');
    }

    var height = $('#keys').height();
    $('#visualization-container').height(height - 30);
    $('.btn').on('click', function () {
      var frequency = $(this).data('frequency');
      var duration = $(this).data('duration');
      var startTime = context.currentTime;
      sequence(frequency, duration, 4, 10, startTime);
    });

    $('#sequence').on('click', function () {
      var startTime = context.currentTime;
      for (var i=0; i<12; i++) {
        var frequency = freq(40 + i);
        sequence(frequency, 1/8, (i+1)/8, 10, startTime);
        startTime = startTime + 1;
      }
    });
  }

  function sequence (frequency, duration, period, count, startTime) {
    var offset = startTime;
    for (var i=0; i<count; i++) {
      new Note(frequency, duration, offset);
      offset = offset + period;
    }
  }

  var Note = function (frequency, duration, startTime) {
    this.oscillator = context.createOscillator();
    this.oscillator.frequency.value = frequency;
    this.oscillator.connect(context.destination);
    this.oscillator.start(startTime);
    this.oscillator.stop(startTime + duration);
  };
<commit_msg>need to figure out how to generate scales<commit_after>(function () {

  var context;
  var scales = {
    c_major: [
      freq(40),
      freq(42),
      freq(44),
      freq(45),
      freq(47),
      freq(49),
      freq(51),
      freq(52)
    ]
  };

  init();

  function init() {
    try {
      window.AudioContext = window.AudioContext || window.webkitAudioContext;
      context = new AudioContext();
    }
    catch(e) {
      alert('Web Audio API is not supported in this browser');
    }

    var height = $('#keys').height();
    $('#visualization-container').height(height);
    $('.btn').on('click', function () {
      var frequency = $(this).data('frequency');
      var duration = $(this).data('duration');
      var startTime = context.currentTime;
      sequence(frequency, duration, 4, 10, startTime);
    });

    $('#sequence').on('click', function () {
      var startTime = context.currentTime;
      for (var i=0; i<scales.c_major.length; i++) {
        var frequency = scales.c_major[i];
        sequence(frequency, 1/16, 1, 2, startTime);
        startTime = startTime + 1/16;
      }
    });
  }

  function freq (key_index) {
    return 440 * Math.pow(2, (key_index - 49) / 12.0)
  }

  function sequence (frequency, duration, period, count, startTime) {
    var offset = startTime;
    for (var i=0; i<count; i++) {
      new Note(frequency, duration, offset);
      offset = offset + period;
    }
  }

  var Note = function (frequency, duration, startTime) {
    this.oscillator = context.createOscillator();
    this.oscillator.frequency.value = frequency;
    this.oscillator.connect(context.destination);
    this.oscillator.start(startTime);
    this.oscillator.stop(startTime + duration);
  };

})();
{'fraction_non_alphanumeric': 0.1538224414303329, 'fraction_numerical': 0.020036991368680642, 'mean_word_length': 2.777648428405122, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7449830', 'n_tokens_mistral': 1064, 'n_tokens_neox': 996, 'n_words': 238}