Hand cranked mono/legato issue..
-
Ok so I want to play my instrument polyphonically or monophonically., and if mono then set some start offset....sort of half-way to legato...
but I clearly dont understand how the event ID system works because this code doesnt work:
function onNoteOn() { if (PolyphonicOnOff.getValue() == 0) { // mono phonic processing... //is there a held note? Console.print(Globals.lastNoteNum); if (Globals.lastNoteNum > -1){ // yes there is...so we should have the id of the last event in lastNoteId... Synth.noteOffByEventId(Globals.lastNoteId); Message.ignoreEvent(true); Globals.lastNoteId = Synth.playNoteWithStartOffset(Message.getChannel(), Message.getNoteNumber(),Message.getVelocity(), 10000); }else{ // no there isnt we are "first event" Globals.lastNoteNum = Message.getNoteNumber(); Globals.lastNoteId = Message.getEventId(); }; }; Console.print(Globals.lastNoteNum); Console.print(Globals.lastNoteId); };
its failing at the noteOffByEventId, where its telling me it cant find the note ID...held in Globals.lastNoteId
What am i doing wrong?
-
Last note ID needs to be artificial
-
@d-healey Thanks Dave. So I did this:
function onNoteOn() { if (PolyphonicOnOff.getValue() == 0) { // mono phonic processing... //is there a held note? Console.print(Globals.lastNoteNum); if (Globals.lastNoteNum > -1){ // yes there is...so we should have the id of the last event in lastNoteId... Synth.noteOffByEventId(Globals.lastNoteId); Message.ignoreEvent(true); Globals.lastNoteId = Synth.playNoteWithStartOffset(Message.getChannel(), Message.getNoteNumber(),Message.getVelocity(), 10000); Globals.lastNoteNum = Message.getNoteNumber(); }else{ // no there isnt we are "first event" Message.makeArtificial(); Globals.lastNoteNum = Message.getNoteNumber(); Globals.lastNoteId = Message.getEventId(); }; }; Console.print(Globals.lastNoteNum); Console.print(Globals.lastNoteId); };
Which with the required jiggery-pokery in the note off makes it work....I am assuming that
Globals.lastNoteId = Synth.playNoteWithStartOffset(.....
makes that event Artificial anyway...
-
@Lindon Looks good. I think
makeArtificial
returns an ID so you can skip a line of code here.Message.makeArtificial();
Globals.lastNoteNum = Message.getNoteNumber();
Globals.lastNoteId = Message.getEventId();Globals.lastNoteId = Message.makeArtificial();
-
@d-healey oh yes that seems logical, thanks Dave.