// Mozaic does not automatically pass all MIDI events through. // you'll have to manage what you want to send through // in your script. @OnLoad MIDI_CHANNEL = 9 // in fact 10 CC_TARGET = 2 TIMER_INTERVAL = 200 MIN_VALUE = 20 MAX_VALUE_DIFF = 2 currentValue = 0 lastProcessed = -1 processed = -1 runTimer = -1 @End @OnMidiNote //Log MIDINote , { }, MIDIByte2 , { }, MIDIByte3 SendMIDIThru @End @OnMidiCC //Log MIDIByte1, { }, MIDIByte2, { } ,MIDIByte3 if (MIDIChannel = MIDI_CHANNEL) and (MIDIByte2 = CC_TARGET) and (MIDIByte3 <> lastProcessed) currentValue = MIDIByte3 if (currentValue < MIN_VALUE) currentValue = MIN_VALUE endif if ((lastProcessed + 20) < currentValue) and (lastProcessed > MIN_VALUE) currentValue = lastProcessed + 20 endif if (runTimer = -1) SetTimerInterval TIMER_INTERVAL Log {*** TIMER ***} StartTimer runTimer = 0 endif if (currentValue > lastProcessed) lastProcessed = currentValue processed = -1 runTimer = 0 //Log {INC }, currentValue SendMIDICC MIDI_CHANNEL, CC_TARGET, currentValue else lastProcessed = currentValue //Log {DEC }, currentValue if (runTimer = 0) processed = currentValue runTimer = 1 endif endif endif @End @OnTimer //Log {TIMER START }, processed if (runTimer = 2) or ((runTimer = 1) and (processed > MIN_VALUE)) runTimer = 2 processed = processed - MAX_VALUE_DIFF if (processed < MIN_VALUE) processed = MIN_VALUE //Log {TIMER OFF }, processed runTimer = 0 endif //Log {TIMER Processed }, processed SendMIDICC MIDI_CHANNEL, CC_TARGET, processed endif @End