A great tool for making microtonal music that uses even divisions of the octave (EDO) is the STS mictrotonal quantizer by @stschoen, which can divide the octave into up to 40 steps and cleverly provides a note mask for each note.
By the request of @biminiroad I have made a 31-EDO adaptation of the quantizer that emulates the scale used by the Fokker Organ.
Just intonation implies small integer ratios for the interval between any pair of notes. For example a perfect fifth is 3:2. With static values for each note and an octave ratio of 2:1, it isn’t possible to make a 12 note scale just. You can get close as long as you are willing to restrict yourself to a single key and there are a number of tuning schemes that attempt to get as close as possible.
In order to make every interval just, it would be necessary to change each note’s value based on the previous note. Once you decide which ratios to use for each interval, you would use the desired interval and the current note value to calculate the next note value. Assuming a 12 note scale, you could implement this using a 12 way mux. The consequence of this approach is that note values are not constant, but change based on the series of notes played. There is also the question of notes played simultaneously as a chord. Which intervals do you make just? The problems associated with just scales and in particular the inability to play in an arbitrary key, led to the introduction of the well-tempered scale common in modern western music. By intentionally making each interval equal, you move slightly away from low number ratios, so the primary intervals are no longer “perfect” but since all intervals are equal, you can choose any note as the root note of your key. The 31-et and 34-et tunings are an attempt to introduce an equally tempered scale closer to just, but they add considerable complexity to the traditional 12 note scale.
I’m sorry, but at this point I have to say that this Audulus community is fully at the forefront of contemporary synthesis ideas. The speed at which people are working through things in a common open language is remarkable. Even just the amount of understanding that is growing out of the various techniques people are sharing, to my mind, surpasses just sitting on a muffwiggler thread. It is sort of like being able to provide logical proofs – very little arguing here, maybe because the ideas are concrete patches.
I have been wondering if it is because it has a hobby feel – like racing RC cars. It is in it’s own little world and seems to benefit from that protection. But then the fact that you can drive analog gear with it is just nuts. As a long time member of art galleries, lover of architecture, cultural history, I am totally blown away.
The primary issue is deciding what ratios you would like to include. It’s probably easier to implement with raw frequencies. For example if the current note is fcn, the perfect fourth is (4/3)*fcn, the fifth is (3/2)*fcn. You run into more trouble with the thirds. Pythagorian tuning has them at 9:8 and 256:243 whereas 5 limit tuning has two values for the major 3rd at 10:9 or 9:8 and the minor 3rd is at 16:15. There are two other enharmonic pairs with double values. Usually you pick one of each pair of ratios for a 12 note scale. There are other approaches possible depending on what you consider a “just” ratio. As I pointed out chords introduce an additional complexity. Consider a C major chord. The G is a perfect fifth from the C but it is also a minor third from the E. In this case you would probably prefer to use the perfect 5th but with more complex chords the answer isn’t so clear. What if you play the E then the G then the C. If the G is held when the C is played should you move the pitch of the G to match the fifth up from the C? Musicians have been struggling with this for several centuries now and although the ability to dynamically change tuning makes it possible to produce just intervals under more circumstances it also introduce a new set of problems. The well tempered scale has it’s problems, but I find it’s simplicity compelling. (Besides I’m used to it! )
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.
Here’s what I have so far. This is the basic 12 note quantizer programmed with the asymmetric 5 limit scale Shifting quantizer dev.audulus (199.5 KB)
It’s static at the moment but I thought I’d save you some time by sharing the quantizer unit
The quantizer in the last post can be programmed for any static 12 note octave based tuning. The values can be entered in cents or ratios depending on the octave value chosen. Use 1200 for the octave if you would like to enter the values in cents and 1 for ratios. Note that the ratios must be wrapped in a log2() function, so for a fifth you could have log2(3/2). Of course you could enter the decimal value of the expression as well.
As I kind of expected, timing issues in the feedback loop are causing some unexpected behavior in the retuning algorithm. I’m sure they can be worked out as soon as I can get my head around them. The challenge is to grab the first output from the quantizer, then transpose the quantizer for the next note without disturbing the output of the first one, etc.