<commit_before><!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8" />
<script src="Tone.js"></script>
<script src="AVL.js"></script>
<script src="../build/rhombus.js"></script>
<script>
var constraints = {max_notes: 2};
var rhomb = new Rhombus(constraints);
rhomb.setSampleResolver(function(sampleSetName, callback) {
  var infoReq = new XMLHttpRequest();
  var dirPath = "./samples/" + encodeURIComponent(sampleSetName) + "/";
  infoReq.open("GET", dirPath + "samples.json", true);
  infoReq.responseType = "json";

  infoReq.onload = function() {
    var infoMap = infoReq.response;
    var sampleCount = Object.keys(infoMap).length;

    var finalMap = {};
    for (var pitch in infoMap) {
      function getSample(pitch, file) {
        var sampleReq = new XMLHttpRequest();
        sampleReq.open("GET", dirPath + encodeURIComponent(file), true);
        sampleReq.responseType = "arraybuffer";

        sampleReq.onload = function() {
          rhomb._ctx.decodeAudioData(sampleReq.response, function(buff) {
            finalMap[+pitch] = [buff, file];
            if (Object.keys(finalMap).length == sampleCount) {
              callback(finalMap);
            }
          });
        };

        sampleReq.send();
      }

      getSample(pitch, infoMap[pitch]);
    }
  };

  infoReq.send();
});

var interval = 240;
var last = 960 - interval;

var patId = rhomb._song.addPattern();
function ins(a, b, c) {
  rhomb.Edit.insertNote(new rhomb.Note(a, b, c, 1.0), patId);
}
var pat = rhomb.getSong().getPatterns()[patId];
var aeSuccess = rhomb.Edit.insertAutomationEvent(1, 1, patId);
var aeId = pat.getAutomationEventsInRange(0, 10)[0]._id;
var aeRSuccess = rhomb.Edit.deleteAutomationEventById(aeId, patId);

var instrId = rhomb.addInstrument("mono");
var instr = rhomb.getSong().getInstruments().getObjById(instrId);
instr.normalizedSetByName("volume", 0.6);
instr.graphDisconnect(0, rhomb.getMaster(), 0);

var effId = rhomb.addEffect("revb");
var eff = rhomb.graphLookup(effId);
instr.graphConnect(0, eff, 0);
eff.graphConnect(0, rhomb.getMaster(), 0);

var trackId = rhomb._song.addTrack();
var track = rhomb.getSong().getTracks().getObjById(trackId);
track.graphConnect(0, instr, 0);
track.addToPlaylist(patId, 0, 3840);

ins(60, 0, 240);
ins(63, 240, 240);
ins(67, 480, 240);
ins(63, 720, 240);

ins(60, 960, 240);
ins(63, 1200, 240);
ins(67, 1440, 240);
ins(63, 1680, 240);

ins(60, 1920, 240);
ins(63, 2160, 240);
ins(68, 2400, 240);
ins(63, 2640, 240);

ins(60, 2880, 240);
ins(63, 3120, 240);<commit_msg>Added automation code to timebase-demo<commit_after><!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8" />
<script src="Tone.js"></script>
<script src="AVL.js"></script>
<script src="../build/rhombus.js"></script>
<script>
var constraints = {max_notes: 100};
var rhomb = new Rhombus(constraints);
rhomb.setSampleResolver(function(sampleSetName, callback) {
  var infoReq = new XMLHttpRequest();
  var dirPath = "./samples/" + encodeURIComponent(sampleSetName) + "/";
  infoReq.open("GET", dirPath + "samples.json", true);
  infoReq.responseType = "json";

  infoReq.onload = function() {
    var infoMap = infoReq.response;
    var sampleCount = Object.keys(infoMap).length;

    var finalMap = {};
    for (var pitch in infoMap) {
      function getSample(pitch, file) {
        var sampleReq = new XMLHttpRequest();
        sampleReq.open("GET", dirPath + encodeURIComponent(file), true);
        sampleReq.responseType = "arraybuffer";

        sampleReq.onload = function() {
          rhomb._ctx.decodeAudioData(sampleReq.response, function(buff) {
            finalMap[+pitch] = [buff, file];
            if (Object.keys(finalMap).length == sampleCount) {
              callback(finalMap);
            }
          });
        };

        sampleReq.send();
      }

      getSample(pitch, infoMap[pitch]);
    }
  };

  infoReq.send();
});

var interval = 240;
var last = 960 - interval;

var patId = rhomb._song.addPattern();
function ins(a, b, c) {
  rhomb.Edit.insertNote(new rhomb.Note(a, b, c, 1.0), patId);
}
var pat = rhomb.getSong().getPatterns()[patId];

for (var i = 0; i < 1000; i++) {
  var time = Math.round(i/999.0 * 3600);
  rhomb.Edit.insertAutomationEvent(time, i/999.0, patId);
}

var instrId = rhomb.addInstrument("mono");
var instr = rhomb.getSong().getInstruments().getObjById(instrId);
instr.normalizedSetByName("volume", 0.6);
instr.graphDisconnect(0, rhomb.getMaster(), 0);

var effId = rhomb.addEffect("revb");
var eff = rhomb.graphLookup(effId);
instr.graphConnect(0, eff, 0);
eff.graphConnect(0, rhomb.getMaster(), 0);

var trackId = rhomb._song.addTrack();
var track = rhomb.getSong().getTracks().getObjById(trackId);
track.graphConnect(0, instr, 0);
track.addToPlaylist(patId, 0, 3840);
track.graphConnect(0, rhomb.getMaster(), 1);

ins(60, 0, 240);
ins(63, 240, 240);
ins(67, 480, 240);
ins(63, 720, 240);

ins(60, 960, 240);
ins(63, 1200, 240);
ins(67, 1440, 240);
ins(63, 1680, 240);

ins(60, 1920, 240);
ins(63, 2160, 240);
ins(68, 2400, 240);
ins(63, 2640, 240);

ins(60, 2880, 240);
ins(63, 3120, 240);
{'fraction_non_alphanumeric': 0.17229129662522202, 'fraction_numerical': 0.06216696269982238, 'mean_word_length': 3.9637610186092065, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 25, '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': '3273439', 'n_tokens_mistral': 2069, 'n_tokens_neox': 1796, 'n_words': 393}