I couldn’t see this already posted so here goes. I wanted to make a quantiser for Just Type for which you could define the scale. I started off with @Galapagoose script way up this page but it needed some altering to make it account for various octaves. It was easier to sort this for a CV output as you could make use of CV.OFF but there is no equivalent in Just Type that doesn’t affect all 6 oscillators.
You can input your scale as N numbers in the first 7 slots of pattern 0. No need to repeat them up the scale.
CV input to IN
Trigger scrpit 1
Y DIV V 1 7 // Splits the incoming CV into 7 tones per octave (volt)
X DIV QT IN Y Y // Gives the ‘tone number’ within the scale. Above 7 will be higher octaves
Z PN 0 MOD X 7 // Defines which note within the scale it’s on (1-7) and looks it up in the pattern
JF.NOTE N + Z * / X 7 12 V 8 // Combines the above - the note (1-7) and the offset in octaves (12)
The maths in that last line was really hard to get right! Need to get used to the ordering…
I wonder if there is another way which doesn’t use the 3 variables X Y & Z …?