Created
April 19, 2020 05:41
-
-
Save hsitz/4d931e51791d94b7739f773447400230 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// script that implements | |
// something like geoshred's | |
// autooctave. | |
// this will currently not | |
// do anything unless you're | |
// playing "legato", defined | |
// as pressing next key | |
// before previous key is | |
// released. If playing | |
// legato, the octave | |
// adjustment will be "ON" | |
// (would probably make more | |
// sense as a footswitch toggle) | |
@OnLoad | |
fillarray notes, 0, 128 | |
lastnote = 0 | |
counter = 0 | |
@End | |
@OnMidiNoteOn | |
inc counter | |
if counter = 1 | |
sendmidithru | |
exit | |
endif | |
if lastnote = 0 | |
lastnote = midinote | |
endif | |
offset = 0 | |
if midinote - lastnote > 6 | |
offset = (midinote - lastnote) % 12 | |
if offset = 0 | |
offset = 12 | |
endif | |
newnote = midinote - (12 - offset) | |
elseif lastnote - midinote > 6 | |
offset = (lastnote - midinote) % 12 | |
if offset = 0 | |
offset = 12 | |
endif | |
newnote = midinote + (12 - offset) | |
else | |
newnote = midinote | |
endif | |
sendmidinoteon midibyte1, newnote, midibyte3 | |
lastnote = newnote | |
notes[midinote] = newnote | |
@END | |
@OnMidiNoteOff | |
dec counter | |
offnote = notes[midinote] | |
sendmidinoteoff midibyte1, offnote, midibyte3 | |
@END | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment