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! )
For a test case what about the most conservative values?
Perhaps the pythagorean pentatonic scale.
A - 1:1
C - 32:27
D - 4:3
E - 3:2
G - 16:9
A - 2:1 …
What would be the next step?
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
I noticed that the (free!) AudioKit Synth One has a wide range of alternate tuning systems built in, with a nice very way of visualizing the systems (in terms of cents/hertz/ratios etc.) as well.
In today’s update they also provide support for importing custom tunings created with the Wilsonic app – also free on the iOS App Store – which is a wonderful resource in itself.
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.
That’s some pretty impressive work for overnight~ ♪♫♬
I like the inner workings, as that seems pretty versatile.
I have also been checking out what acreil, a musician who works in Pd with microtonal aleatoric music has to say about microtonality.
edit: Here is a patch I made with the asymmetric 5-limit dev quantizer.
just intonations and harmonics.audulus (800.8 KB)
I like the patch! Nice harmonies.
I got the final version working this morning and discovered that it has some interesting quirks. Because it is possible to play a series of intervals that result in the quantizer getting progressively farther from the starting pitch, eventually you reach the point where two keyboard notes quantize to the same output value. In order to resolve this I think it will be necessary to change approaches. The current model captures the quantizer output and uses it to transpose the input, but I think it will be necessary to determine the required interval first and then modify the current output accordingly. Back to the drawing board. Just for grins here’s what I have currently:
Sliding quantizer dev.audulus (202.2 KB)
So I have been in communication with a couple of redditors who work primarily with microtonal music, acriel (mentioned above) and FlyNap (who works exclusively in JI)
I asked them both about how they navigate JI
I take many approaches to JI. For example I might find a set of small 5-limit intervals I like the sound of, and the use an algorithm to find all the different sets of them that fit in a span. Then take that span and repeat it up and down using the harmonic/subharmonic series.
The things that make my approach different:
- Forget octave repeating
- liberal use of harmonic series
- keyboard maps that might not be linear in pitch
- commas are cool, just go with it
- discard western musical system of named notes entirely.
A scale you might be interested in that is sorta like 31 EDO, but is actually just is 22 Shruti. It’s octave-repeating, but it’s a wide octave. The component intervals are explained on that site. I find it really elegant. As for finding nice harmonies - just use your ear. You’ll find consonances unavailable in ET.
I do both. For just intonation scales I find it’s easiest to use the harmonic and/or subharmonic series. If you want a 12 note scale you can pick a range of harmonics from 16 to 31, or 24 to 47 or whatever and omit the ones you don’t want (typically the really high prime numbers). So you could do 16, 17, 18, 20, 21, 22, 24, 25, 26, 27, 28, 30 and see how that sounds.
Here’s a version that works a bit better. It still has a few issues but at least the interval changes work properly. Set an initial note using the knob and reset the unit (A = 0, A# = 1, B =2 etc.) It will calculate the interval and modify the output accordingly. Like the earlier unit the actual pitch generated by an input note will change depending on the notes played before.
Sliding Quantizer Mark II.audulus (285.7 KB)
Maybe I should call its the NTSNT quantizer (Never The Same Note Twice)!
Each note has a unique existence!
Harmonic Quantizer Demo.audulus (142.3 KB)
Here is a fun one, a quantizer that snaps to the harmonic series of a root note. It’s a fun way to be microtonal (high order harmonics played against each other can sound pretty dissonant while low order harmonics are very familiar intervals) while preserving just intonation.
It’s interesting how attempting to keep the intervals “just” leads to dissonance eventually. I’ve learned a lot about alternative approaches to tuning during my sojourn with Audulus. Who knew there were so many scales? As lovely as a perfect fifth sounds, I think I’ll stick to well-tempered for the most part. Still, it’s wonderful to have the tools to explore the alternatives without investing a fortune.
My crazy hunch is that only phenomena that have (no idea what the proper term is) certain properties like those of automata, properties that make their shape incomplete, only systems that have this spiral-like subsistence allow for a peculiar kind of novel expression. Along with this aspect comes another which is present as an idea incompleteness. Various parts vanish into the dark while other parts are in focus. But this allows for a non-symmetrical landscape in between any two points. Analog has it. It may be an ingredient in life, which is why Conway’s work is useful for making predictions about complex weather patterns by constructing models.
- You can now use Synth One to send micro-tunings to AudioKit Digital D1. Press the new “TuneUp” button on the “Tune” panel. Now, you can use your favorite Synth One tunings in Digital D1. It’s blowing our minds!!!
- This “TuneUp” tuning sharing can be thought of kind of like Ableton Link, but, for Tunings instead of Tempo. This technology is open-source. If you are an app developer and would like to share tunings with Synth One or Wilsonic to your app, please get in touch firstname.lastname@example.org and we’ll help you get it integrated.
Many people don’t realize that MIDI also has a way to implement tunings other than well-tempered. It’s not widely supported but the standard (MTS) exists:
There is a pretty happening thread over on the lines forum about microtonality. Thought I would link to it in case anyone browsing this years in the future needed to go further down a rabbit hole.
This is definitely a valuable tool for exploring Just intonation, TY @PianoManDan