Arpeggiator
// main.js
// Arpeggiator
//
// Created by Jacob Sologub on 15 Jun 2020.
// Copyright © 2020 Jacob Sologub. All rights reserved.
const sampler = new sattern.Sampler();
sattern.graph.add (sampler);
const sound = new sattern.Sound ("./mcg_mp_064.wav", {
lowKey: 0, highKey: 127, rootKey: 64
});
sampler.add (sound);
const reverb = new sattern.SOULPatch ("./Reverb.soulpatch");
sattern.graph.add (reverb);
sattern.graph.connect (sampler.output, reverb.input);
const pattern = new sattern.Pattern();
sattern.add (pattern);
pattern.onSequence = function (context) {
// Intentionally empty.
};
const triggerKey = new sattern.Note ("C4").key;
const currentlyHeldKeys = new Array (127);
sattern.onNoteOn = function (note) {
if (note.key != triggerKey) {
currentlyHeldKeys [note.key] = true;
}
};
sattern.onNoteOff = function (note) {
currentlyHeldKeys [note.key] = false;
};Last updated