Skip to content

Instantly share code, notes, and snippets.

@hsitz
Last active April 16, 2020 04:02
Show Gist options
  • Save hsitz/a2871cd77779906b6c0920685198fa9c to your computer and use it in GitHub Desktop.
Save hsitz/a2871cd77779906b6c0920685198fa9c to your computer and use it in GitHub Desktop.
normcurve = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
normcurve = [ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 ]
normcurve = [ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 ]
normcurve = [ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 ]
normcurve = [ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 ]
normcurve = [ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 ]
normcurve = [ 60, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
normcurve = [ 70, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
normcurve = [ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 ]
10, 11]
n2 = [ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 ]
n2 = [ 24, 25, 26, 27, 2822, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 ]
n3
//Streambyter in Midiflow can do it. Get the modulus of the note value divided by 12. If it’s 1,3,6,8 or 10, send it back out with the velocity value scaled to taste.
//new vel = ( sqrt(vel) / sqrt (127) ) * vel
//will give full velocity range up to 127 but biased to lower values.
//new vel = ( vel / 127 ) * vel
//will do the same but more so.
//new vel = sqrt(vel) * sqrt(127)
//will give full range up to 127 but biased to higher values.
//Note this is my pseudo syntax for illustration only.
@OnLoad
fillarray curve1, 0
fillarray curve2, 0
fillarray curve3, 0
fillarray curve4, 0
labelpad 0, {. adfkjadf}
showLayout 0
labelknob 0, { Amount }
setknobvalue 0, 64
labelknob 1, { Type }
setknobvalue 1, 0
labelpad 0, { Amount of curve change: }, 2
k1 = 1
k2 = 2
call @createcurves
@END
@OnKnobChange
if lastknob = 0
kval = getknobvalue, 0
k1 = kval/64
k2 = kval/32
call @createcurves
endif
@END
@createcurves
for vel = 0 to 127
curve1[vel] = rounddown ((pow (vel/127),k1)*127)
curve2[vel] = rounddown (pow (sqrt(vel)) / (sqrt(127)), k2) * 127
//if curve1[vel] <> vel
// log {curve1 vel: }, vel, {. curve vel: }, curve1[vel]
//endif
endfor
for vel = 0 to 127
curve3[127-vel] = 127-curve1[vel]
curve4[127-vel] = 127 - curve2[vel]
if curve3[vel] <> vel
log {curve3 vel: }, 127-vel, {. curve vel: }, curve3[127-vel]
endif
endfor
@END
@OnMidiNoteOn
//if (m=1) or (m=3) or (m=6) or (m=8) or (m=10)
// blacknote = 1
//else
// blacknote = 0
//endif
//if blacknote = 1
sendmidinoteon midibyte1, midibyte2, curve1[midibyte3]
log {on. }, midibyte1, {. }, midibyte2, {. }, midibyte3
log curve4[midibyte3]
@END
@onmidinoteoff
//log {off }, midibyte1, {. }, midibyte2, { }, midibyte3
sendmidithru
@end
ljglkhgljkhfgljgkhjglkjh
//Streambyter in Midiflow can do it. Get the modulus of the note value divided by 12. If it’s 1,3,6,8 or 10, send it back out with the velocity value scaled to taste.
//new vel = ( sqrt(vel) / sqrt (127) ) * vel
//will give full velocity range up to 127 but biased to lower values.
//new vel = ( vel / 127 ) * vel
//will do the same but more so.
//new vel = sqrt(vel) * sqrt(127)
//will give full range up to 127 but biased to higher values.
//Note this is my pseudo syntax for illustration only.
@OnLoad
fillarray curve1, 0
fillarray curve2, 0
fillarray curve3, 0
fillarray curve4, 0
for vel = 0 to 127
curve1[vel] = ( sqrt(vel) / sqrt (127) ) * vel
curve2[vel] = ( vel / 127 ) * vel
curve3[vel] = sqrt(vel) * sqrt(127)
curve4[vel] = vel
endfor
log { curve1: }, curve1
log { curve2: }, curve2
log { curve3: }, curve3
log { curve4: }, curve4
@END
@OnMidiNoteOn
//if (m=1) or (m=3) or (m=6) or (m=8) or (m=10)
// blacknote = 1
//else
// blacknote = 0
//endif
//if blacknote = 1
sendmidiout midibyte1, midibyte2, curve1[vel]
@END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment