Author Topic: The Vile-Tempered Clavier  (Read 3676 times)

0 Members and 1 Guest are viewing this topic.

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
The Vile-Tempered Clavier
« on: November 03, 2019, 11:23:47 am »
There are 12 notes in an octave, each a semitone apart.  And there are 8 notes in a scale, inclusive of the lower and upper Doh.

Harmony (in Occidental music) for notes in the scale was defined by ratios in the length of organ pipes (half, third and fifth, I believe).  And these were used to set the notes.

This meant, however, that good tonality only occurred within one Key.

At around the time of JS Bach (I may be incorrect in my musicology), it was realised that a near-universal scale could be produced if the ratio in frequencies between each semitone was a constant.  As the frequency doubles for each octave, and there are 12 semitones, the step in frequency is the twelfth root of 2.

This is the Well-Tempered Scale.  Aficionados will know that JS Bach went off and wrote 48 pieces, two in each of the 24 keys (12 major, 12 minor).

It has always struck me: "Why 12?", "What is special about the twelfth root of 2?".  There appears to be nothing fundamental in 12 - maybe it's that 12 is divisible by lots of numbers (but not 5)??

So, out of daftness, I thought that I'd see what a 13-note octave would sound like.

The program uses the SOUND command to play notes on the computer sound card.  I have used Richard Rogers's Do-Re-Mi melody, first with the standard 12-note octave, and then the same thing with a 13-note octave.  You will not be surprised that the second version sounds odd.  Some of the atonality may be to do with the difficulty of fitting the note intervals into the thirteen spaces: in this configuration D# is not the same as Eb.  If the 13-note version is played by itself several times, it becomes more tolerable, so maybe there is nothing particularly special about 12.  But note that no chords are played here.
Code: QB64: [Select]
  1. CONST NoNotes% = 66, A4% = 440, Tempo% = 100, Twelfth! = 2 ^ (1 / 12), Thirteenth! = 2 ^ (1 / 13), P! = 18 * 60 / Tempo%
  2. DIM Tonic!(7), Notonic!(7)
  3. Tonic!(1) = 1
  4. FOR N%% = 1 TO 6
  5.     READ M%
  6.     Tonic!(N%% + 1) = Tonic!(N%%)
  7.     FOR K%% = 1 TO M%
  8.         Tonic!(N%% + 1) = Tonic!(N%% + 1) * Twelfth!
  9.     NEXT K%%
  10. NEXT N%%
  11. Notonic!(1) = 1
  12. FOR N%% = 1 TO 6
  13.     READ M%
  14.     Notonic!(N%% + 1) = Notonic!(N%%)
  15.     FOR K%% = 1 TO M%
  16.         Notonic!(N%% + 1) = Notonic!(N%% + 1) * Thirteenth!
  17.     NEXT K%%
  18. NEXT N%%
  19.  
  20. FOR M% = 1 TO NoNotes%
  21.     READ Dum$, Period!
  22.     Note% = ASC(LEFT$(Dum$, 1)) - 64
  23.     SolFa! = A4% * Tonic!(Note%) * 2 ^ (VAL(RIGHT$(Dum$, 1)) - 4)
  24.     IF MID$(Dum$, 2, 1) = "#" THEN
  25.         SolFa! = SolFa! * Twelfth!
  26.     ELSEIF MID$(Dum$, 2, 1) = "b" THEN
  27.         SolFa! = SolFa! / Twelfth!
  28.     END IF
  29.     SOUND SolFa!, (Period! * P!) - 1
  30.     SOUND 0, 1
  31. NEXT M%
  32.  
  33. SOUND 0, 18
  34.  
  35. RESTORE Rodgers
  36. FOR M% = 1 TO NoNotes%
  37.     READ Dum$, Period!
  38.     Note% = ASC(LEFT$(Dum$, 1)) - 64
  39.     SolFa! = A4% * Notonic!(Note%) * 2 ^ (VAL(RIGHT$(Dum$, 1)) - 4)
  40.     IF MID$(Dum$, 2, 1) = "#" THEN
  41.         SolFa! = SolFa! * Thirteenth!
  42.     ELSEIF MID$(Dum$, 2, 1) = "b" THEN
  43.         SolFa! = SolFa! / Thirteenth!
  44.     END IF
  45.     SOUND SolFa!, (Period! * P!) - 1
  46.     SOUND 0, 1
  47. NEXT M%
  48.  
  49.  
  50. DATA 2,1,2,2,1,2
  51. DATA 2,1,2,3,1,2
  52.  
  53. Rodgers:
  54. DATA C3,1.5,D3,0.5,E3,1.5,C3,0.5,E3,1,C3,1,E3,2
  55. DATA D3,1.5,E3,0.5,F3,0.5,F3,0.5,E3,0.5,D3,0.5,F3,4
  56. DATA E3,1.5,F3,0.5,G3,1.5,E3,0.5,G3,1,E3,1,G3,2
  57. DATA F3,1.5,G3,0.5,A4,0.5,A4,0.5,G3,0.5,F3,0.5,A4,4
  58. DATA G3,1.5,C3,0.5,D3,0.5,E3,0.5,F3,0.5,G3,0.5,A4,4
  59. DATA A4,1.5,D3,0.5,E3,0.5,F#3,0.5,G3,0.5,A4,0.5,B4,4
  60. DATA B4,1.5,E3,0.5,F#3,0.5,G#3,0.5,A4,0.5,B4,0.5,C4,3,B4,0.5,Bb4,0.5
  61. DATA A4,1,F3,1,B4,1,G3,1,C4,4.5
  62. DATA C3,0.5,D3,0.5,E3,0.5,F3,0.5,G3,0.5,A4,0.5,B4,0.5,C4,1,G3,1,C4,1
  63.  
« Last Edit: November 04, 2019, 06:12:22 am by Qwerkey »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: The Vile-Tempered Clavier
« Reply #1 on: November 03, 2019, 01:27:50 pm »
This sounds a bit odd maybe because such a familiar tune but there are no particular sour notes.