This is webpage plots how harmonic a group frequency is.
It is finding best intervals smaller than a semitone, preparing for making microtonal music.
operation
Change parameters in the next page and click on "apply" to see changes.
It might need time to calculate a harminic graph.
algorithm
harmony and rationals
The reason that a pair of tone is harmonic is because of their ratio is "more rational". C4 and G4 sounds harmonic, because their frequencies are almost 2/3. C4 and F4 are less harmonic, but still good, because of their frequencies are almost 3/4. C4 and C5, of course, are very harmonic, since their frequencies are 1/2. However, if the ratio is "less rational", like 13/21, or 41/113 then it will be less harmonic.
I decide to consider all positive rational numbers and give each number a "harmonic score". In my program, for a rational a/b, the score is sqrt(ab). It is also reasonable to use other monotonically increasing function.
tolerable errors
In fact, C and G sounds harmonic, but in morden music, they are not strict 2/3. It is about 2/2.99661. Because common person cannot feel the difference of 2/3 and 2/2.99661, they still feel C and G are harmonic. That means small errors are tolerable.
To simulate this, for each rational number with its harmonic score, I made a normal distribution for it. Then the total harmonic score will be the sum of these normal distribution sqrt(ab)*normal(a/b, sigma).
You can change sigma when you play with my plotter.
harmony with more than one tone
To find a harmonic score of more than one tone, I simply move the score horizontally, then multiply it with the original one. Because the combined score is too extreme, it is powered by 1/n where n is the number of tones. It is still reasonable because that power is a monotonically increasing function.
For example, to find the harmonic score of C and G, I move the harmonic score of C to the left by 1/2 so that the center of the new score is 3/2, then multiply it with the original one, then power by (1/2).
general knowledge
why 12?
A lot of culture creates their own music. Almost all cultures decided to divide an octive into 12 halfsteps, without any communication. Why 12, but not other number?
As I mentioned above, a pair of tones are harmonic because of their frequencies are more "rational". G and C are harmonic because of their frequencies are almost 3/2. If we want to find a tone which is very harmonic with G, but it is not C, then we can use 9/4. If we continue to do this, we will find (3/2)^7 is about 129.74633789, which is almost 2^7. That means, multiply 3/2 by 12 times, we can end up with a tone which is fairly harmonic with our original tone C.
5 is also a fair division, since (3/2)^5=7.59375, which is close to 8. However, it is not close enough, and music will be boring if there are only 5 tones between an octive.
The number after 12 is 53. It is even more harmonic then the 12 division, but this means between an octive, there will be another 52 tones. This is not acceptable.