iconEuler Examples

Musical Pitch and Temperament

by R. Grothmann

This notebook tests pure versus equal tempered or approximated
harmonics.

Create the time values for 4 seconds of sound.
>t=soundsec(4);
Let 440 Hz be our basic frequency.
>f=440;
New listen to a 220 Hz sound.
>s=sin(f*t/2);
>playwave(s);
The following is a pure quint.
>s=sin(f*t)+sin(f*3/2*t);
>playwave(s);
Now we add the lower octave and vary the quint in pitch. First
the pure quint.
>s=sin(f*t)+sin(f*3/2*t)+sin(f*t/2);
>playwave(s);
Now the equal tempered quint. The difference is small. But with sine
curves the beat (oscillating amplitude) is audible.
>s=sin(f*t)+sin(f*2^(7/12)*t)+sin(f*t/2);
>playwave(s);
Now a quint wich is too much off.
>s=sin(f*t)+sin(f*1.49*t)+sin(f*t/2);
>playwave(s);
Here are the corresponing numbers
>3/2, 2^(7/12), 1.49
1.5
1.49830707688
1.49
Difference in tones is measured in cents, where 100 cents is a
halftone, and the scale is logarithmic.

Here is the error in cents. First the tempered quint.
>1200*logbase(2^(7/12)/(3/2),2)
-1.95500086539
The error is -2 cents. The error for the 1.49 approximation is already
-11 cents. This is too much to be OK.
>1200*logbase(1.49/(3/2),2)
-11.5802040405
The difference in frequency explains the oscillation, since

Temperament in Musical Pitch

Since the pure quint has no beat, we can hear a beat with a following
frequency of 4.4 Hz.
>f*(3/2-2^(7/12)), f*(3/2-1.49)
0.74488617426
4.4
Repeat the same with the major terz.
>s=sin(f*t)+sin(f*5/4*t)+sin(f*t/4);
>playwave(s); // pure
>s=sin(f*t)+sin(f*2^(4/12)*t)+sin(f*t/4);
>playwave(s); // tempered
>s=sin(f*t)+sin(f*1.27*t)+sin(f*t/4);
>playwave(s); // way off
>5/4, 2^(4/12), 1.24
1.25
1.25992104989
1.24

Examples Homepage