An octave. Original image taken from http://www.psrtutorial.com/music/articles/cp33.html. |
Given a tone X, this post will show you how to approximate another tone Y such that f(Y) = f(X) * n for positive integers n other than 2.
For some integer k, Y is k half steps to the right of X on a piano. This means roughly f(Y) = f(X) * 2 ^ (k / 12) because of how pianos are tuned. We now have two expressions for f(Y), which we may equate:
$$f(X) * n = f(X) * 2 ^ {k / 12}\\
n = 2 ^ {k / 12}\\
\ln{n} = \ln{2 ^ {k / 12}} = \frac{k\ln{2}}{12}\\
k = \frac{12\ln{n}}{\ln{2}}$$
Let's try it! If n = 2 then the combination of the tones will be an octave, so we expect k to be the distance in half tones between for example A3 and A4, which is 12. As it turns out, the expression above does predict that k = 12.
We may delve further into the problem by letting n = 3. This gives us the somewhat unexpected result k = 19.02. We want k to be an integer so we have to round it. Our new general approximation is:
$$k = round(\frac{12\ln{n}}{\ln{2}})$$
I think we are ready to let the computer handle the rest. Python code:
from math import log for i in xrange(1, 20): print int(round(12 * log(i) / log(2))),
Output: 0 12 19 24 28 31 34 36 38 40 42 43 44 46 47 48 49 50 51
I have marked these tones in the picture below. The funny thing is, the first six tones are the chord A major.
No comments:
Post a Comment