Tue Jun 9 20:38:33 CEST 2009

Music and almost integers

An almost integer[1] is a number that is very close to an integer, but
isn't an integer.  These can be found in great number by applying
trigoniometric functions to integers, ending up close to integers.  

(cos 22) -> -0.9999608263946371 != -1

This particular one is related to the approximation of PI as a ratio
22/7.  Similar things can happen with exponentials of ratios ending up
close to other simpler ratios.  This phenomenon is very much related
to tonal music, which is built on rational approximations to
irrational numbers.

Simultaneously sounding pure tones produce harmony, wich can be
described as regular beat patterns.  This happens when frequency
ratios are ratios of small integers.  This is then tied into melody by
employing the ratios that make sense for simultaneously sounding tones
to space out frequencies of tones intended to be played sequentially,
creating scales.  Melody is evolution of tone frequency over time,
where repetition and proximity play an important role.  This makes
melody and harmony combine nicely yielding tonal music.

However, this picture only works approximately.  Somehow the human
brain likes the kind of non-exactness.  Some intervals just aren't
that pure as others, and this can be used as an expressive device.

I.e. a perfect fifth[2] has a ratio of 3/2.  In an equal tempered
scale this is approximated by 2^(7/12).  Applying this ratio 12 times
produces the circle of fifths[3] and ends up exactly 7 octaves higher.

However, in just intonation this isn't quite so:

(define (pow n x) (if (zero? n) 1 (* x (pow (sub1 n) x))))

(pow 3/2 12) 
-> 531441/4096 = 129.746337890625 
!= 2^7 = 128

This is solved by making some of the fifths that construct the scale
less exact, favouring the fourth[4] (4/3) major third[5] (5/3) and
minor third[6] (6/5) to build harmonicly sounding chords.

[1] http://mathworld.wolfram.com/AlmostInteger.html
[2] http://en.wikipedia.org/wiki/Perfect_fifth
[3] http://en.wikipedia.org/wiki/Circle_of_fifths
[4] http://en.wikipedia.org/wiki/Perfect_fourth
[5] http://en.wikipedia.org/wiki/Major_third
[6] http://en.wikipedia.org/wiki/Minor_third