Jump to content

alienbeatpoet

Member
  • Posts

    1
  • Joined

  • Last visited

alienbeatpoet's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. i'm trying to write a midi effects script in the scripture that would latch any notes pressed and hold it until i press the respective note is pressed again. simply: hit the key once = note on. hit it again = note off. i can latch the first note fine, but subsequent notes i want to latch as well have to hit twice for it to sound and latch. then when unlatching the first note to be unlatched comes off fine. but the subsequent notes to unlatch have to be hit twice (again) and the first hit actually sounds the note again. not at all desired. i'm probably very close, but i just can't seem to make it work. can anyone help me out? /* NoteLatcher */ var isActive = false; function HandleMIDI(event) { if (event instanceof NoteOn){ //latch note on if (isActive == false) { var on = new NoteOn; on.pitch = event.pitch; on.send(); isActive = true; } //latch note off else if (isActive == true) { var off = new NoteOff; off.pitch = event.pitch; off.send(); isActive = false; } } event.trace(); }
×
×
  • Create New...