I was thinking about this last night and I think I have an approach that will work. I thought I’d try to put something together today using 5-limit tuning but the actual ratios could easily be changed. After thinking about it, I decided that using a 1 per octave scale would be simpler. As you may recall from high school math log(a*b) = log(a) + log(b) so to obtain a fifth for a note you would add log2(3/2). For our purposes it might be better to eventually precalculate the log values to reduce CPU usage.
Once you have determined which ratios to use for each note, you will need to program a quantizer with the desired intervals. I thought I would use first 12 steps of the 40 step microtonal unit I built since the intervals are arbitrary. I’m assuming that the octave ratio remains constant (a 13th is equivalent to an octave plus a 5th). By keeping the octave ratio constant we only have to quantize 12 intervals at most.
Now you need to capture the incoming note and use it to set the root of the quantizer. I think a change detector and S&H node will suffice. One problem that occurred to me was how to deal with the first note. The simplest approach would be to pre-select a starting root. For simplicities’s sake I thought I would use A but it could be any value. You quantize the first note using the quantizer with no offset and capture the result. Once you have captured the note and separated the octave and note values using a fract() and floor() expression, you can transpose the quantizer by subtracting the note value prior to quantization and adding it back to the output. You then add the octave value back in and you have your output note.
So the basic idea is to quantize the first note, use it to transpose the quantizer, quantize the next note, use it to transpose the quantizer, etc. There will need to be a delay between quantizing a note and shifting the quantizer for the next note. I’m hoping a one frame delay will be sufficient.
That’s the plan anyway Often these things have some unexpected twists and turns.