Midi Script Processor Help
-
I'd like my c3 and c4 octaves to play the c2 octave (if that makes sense, so you get the same notes in those 3 octaves).
Is there an easier way than writing out multiple if statements like the below?
function onNoteOn() { if (Message.getNoteNumber() == 60) { Message.setNoteNumber(48); } }
-
Is there an easier way than writing out multiple if statements like the below?
There's always an easier way than multiple if statements - a switch statement :p But in this case I don't think you need to do that.
Why not just put something like
local n = Message.getNoteNumber(); if (n >= 60) { Message.setNoteNumber(n - 24); }
-
@danh Something like this might be a good begining
function onNoteOn() { if (Message.getNoteNumber() >= 60) { if (Message.getNoteNumber() < 72) Message.setNoteNumber(Message.getNoteNumber()-12); else Message.setNoteNumber(Message.getNoteNumber()-24); } }
As @d-healey said, instead of multiple if, a function that recognizes the octave and applies a down factor would be much better
-
@ustk Are you crazy... this is Dan, don't give him examples without curly braces, he's not ready for that! :p
-
@d-healey poor Dan!
-