sapf> clear 11 [0 3 6 9 12] keydeg
0
or
sapf> clear 32 40 to [0 4 7 10 12] keydeg
[10 11 11 8 12 12 12 13 13]
More specifically, when the key is closer to the last value in the scale, but still below it, the result is the lower root note.
This is technically correct because 0 and 12 are the same in this case, but it would be nice if it was consistent because it makes it hard in certain circumstances, for example when making something like a pitch quantizer.
A workaround I found is to expand the scale enough to cover all notes:
sapf> \list [list list 1 skip list last + $] = expandl
sapf> [0 4 7 10 12] expandl expandl expandl = scale
sapf> scale
[0 4 7 10 12 16 19 22 24 28 31 34 36 40 43 46 48 52 55 58 ...]
sapf> clear 32 40 to scale keydeg
[10 11 11 11 12 12 12 13 13]
or
More specifically, when the key is closer to the last value in the scale, but still below it, the result is the lower root note.
This is technically correct because 0 and 12 are the same in this case, but it would be nice if it was consistent because it makes it hard in certain circumstances, for example when making something like a pitch quantizer.
A workaround I found is to expand the scale enough to cover all notes: