Ok, to answer my own question :winking_face_with_tongue:
// onInit
const timerInterval = 0.05;
Synth.startTimer(timerInterval);
const sampleLength = (60 / 110) * 16;
var keyDown = Engine.createMidiList();
var legatoPlayPos = 0;
function onNoteOn()
{
keyDown.setValue(Message.getNoteNumber(), 1);
if (keyDown.getValueAmount(1) == 1) {
Console.print("first note played");
legatoPlayPos = 0;
};
};
function onNoteOff()
{
keyDown.setValue(Message.getNoteNumber(), 0);
};
function onTimer()
{
if (keyDown.getValueAmount(1) >= 1) {
normalizedIntensity = (legatoPlayPos * timerInterval) / sampleLength;
// set the intensity of sample start constants here
legatoPlayPos++;
};
};