Jump to content

antiabed

Member
  • Posts

    2
  • Joined

  • Last visited

antiabed's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Perfect! Thank you so much for the smart solution
  2. Hi everybody! I've seen a bunch of scripts creating a last note priority, but I'm trying to make one that does the opposite, Play the first note you played, and not let any other note through until that first note is released. I modified one of the last note priority scripts I found, and it kinda works. But fast notes are sometimes ignored and sometimes it let's a new note through while another is still playing. Can someone help me make this more solid? Here is what I have now: var hold = []; function HandleMIDI(e) { var a = e instanceof NoteOn && e.velocity !=0; var b = e instanceof NoteOff; var c = e instanceof NoteOn && e.velocity ==0; if (a) { switch (hold.length) { case 0: hold.push(e.pitch); e.send(), e.trace(); break; case 1: if (hold[0] != e.pitch) { hold.pop(); hold.push(e.pitch); break; } } } if (b || c) { if (e.pitch != hold[0]) { e.send(), e.trace(); hold.pop(); } } if (!a && !b && !c) { e.send(), e.trace(); } }
×
×
  • Create New...