MIDI microtonality

 

This page is a demo of the handling of microtonality in the real-time MIDI and MIDI file environments of the Bol Processor BP3  (version 3.0.7 and higher). Install BP3 by following the instructions for  MacOS, Linux and Windows on the page Install the Bol Processor.

All examples here are from the "-da.tryMPE" project, which is part of the ctests folder (download here). The syntactic model for microtonality is explained here. For details on working with real-time MIDI, read the Real-time MIDI page. Some Csound scores are shown for the sake of clarity, as the handling of microtonality in the Csound environment of BP3 produces the same results as MIDI.

The following is a comprehensive but detailed presentation of all aspects of the use of microtonality in BP3. It is not necessary to understand the details when starting with microtonality! The explanation is only intended to assist musicians who wish to create new material by combining several tuning schemes in the same musical work. To try the microtonal process on real musical works, listen for instance to the comparison of temperaments, or play François Couperin's Les Ombres Errantes (in the ctests/Imported_MusicXML folder) on a MIDI instrument using its optimal tuning scheme rameau_en_sib:

Couperin's Les Ombres Errantes, Csound rendering with scale rameau_en_sib ➡ Image
Couperin's Les Ombres Errantes, PianoTeq rendering with scale rameau_en_sib ➡ Image

For geeks: Microtonality in real-time MIDI and MIDI files mimics the MIDI Polyphonic Expression (MPE) method of modifying pitchbend values on notes distributed on separate channels (up to 15 simultaneous notes). However, it works on devices that are not MPE-compliant.

Check pitchbender sensitivity

Make sure that your output MIDI device is sensitive to pitchbend messages. Try the following:

_chan(2) C4 _pitchrange(200) _pitchbend(+100) E4 _pitchbend(+200) C4 _pitchbend(-200) C4 _pitchbend(0) C4

You should hear C4 F4 D4 Bb3 C4 instead of C4 C4 C4 C4 C4. This shows that the MIDI device accepts pitchbend messages and that its range is ± 200 cents, or ± 2 semitones. This is the range we use for microtonality.

For geeks: The actual values are in the range 0 - 16383, but thanks to the "_pitchrange(200)" instruction, the actual cent values can be used.

The "_pitchbend()" commands will be taken care of, and their values will be added to the pitchbend commands that adjust the pitches to the microtonal scale. If this combination exceeds the range of ± 200 cents, an error message will be displayed.

MIDI channels

In the previous example, MIDI events (notes and pitchbender commands) were sent on channel 2. This is to ensure that your MIDI output device is receiving and mixing all channels, technically MIDI mode 4 (omni off, mono).

It was possible to send messages on channel 2 because the Microtonality mode was not set. This mode is set on as a "_scale()" command is found. In this case, the "_chan()" commands are ignored, as all channel assignments are made by the microtonality process.

Diapason tuning

Since note frequencies are displayed when the Trace microtonality mode is activated in "-se.tryMPE", the tuning of the diapason (note A4/la 3 on a conventional keyboard) is important.

By default (in Bol Processor settings and on MIDI devices) this setting is 440 Hz. If you change the value in the settings, the note frequencies will change accordingly. The BP3 will send a message to the MIDI device to tune the diapason, but many devices do not understand this command. (This is the case with PianoTeq Stage.) In this case, tune the device independently.

Microtonal scales

On top of project "-da.tryMPE" you can see the line:

-to.tryMPE

This refers to a tonality resource stored in the "tonality_resources" folder. This resource has been downloaded to your computer when running an installer (or a Linux script) as explained on pages Quick install MacOS, Quick install Windows, or Quick install Linux.

At the bottom of the project page there is a button called EDIT '-to.tryMPE'. This will take you to this resource:

Here are the scales stored in "-to.tryMPE":

Most of these are "exotic" in the sense that they won't produce interesting music. They have been designed to highlight technical features:

  • The grama scale is an interpretation of the Indian system that divides the octave into "twenty-two shrutis", see The two-vina experiment for details. We use one particular (probably incorrect) solution, which sets the pramana shruti at 21 cents. Technically speaking — the reason for this choice — this scale has 23 grades which count as 22 notes. Click the EDIT button to see its structure.
  • The just intonation scale is a standard scale with 12 grades and 12 notes, probably suitable for use in some harmonic contexts. Click the EDIT button and display the image to see that it has a wolf's fifth between D and A.
  • The meantone_try scale is purely technical. It has 12 grades and 7 notes. The grades are approximately semitones and the notes suggest the white keys of a piano keyboard. Another feature is that it has an extended octave of 1219 cents instead of 1200. Notes are labelled by key numbers.
  • The meantone_try2 scale is identical to meantone_try except that its base key is #64 instead of #60. This may be necessary to use specific key numbers of the keyboard of the MIDI output device.
  • The piano scale has 12 grades and 12 notes. It is an equal-tempered scale with an extended octave of 1204 cents. An interesting point is that all its fifths are perfect (see picture).
  • The zest24-supergoya17plus3_Db scale was created by importing its SCALA definition (from this archive). It covers a conventional octave (ratio 2/1) with 20 grades, but the SCALA file did not contain any note names. So, 12 notes were chosen at random, with key numbers as their names.
  • The Bohlen-Pierce scale which has a "tritave" interval of ratio 3/1 instead of 2/1 in the octave. The tritave is divided into 13 grades and 13 notes (see Wikipedia and picture).

These scales cover all the cases necessary to check the technical operation of microtonality handling in real-time MIDI, MIDI files, and Csound environments. Don't expect to hear interesting music in the following examples! Only make sure that Trace microtonality is checked in "-se_tryMPE", so that you can read cent corrections in the trace.

Listening to scales

The following are examples of 12-note scales:

_scale(piano,0) C4 C#4 D4 D#4 E4 F4 F#4 G4 G#4 A4 A#4 B4 C5
_velcont _scale(just intonation,0) _vel(120) C4 C#4 D4 D#4 E4 F4 F#4 G4 G#4 A4 A#4 B4 C5 _vel(60)

The second argument to the "_scale()" command is called the block key. It is the key whose frequency should remain equal to that of a conventional 12-grade equal-tempered scale (a standard tuning of electronic instruments). If it is set to 0 or 60, this means that the block key is the 60th key on a piano keyboard, usually called "middle C" or C4/do3. If the A4/la3 is 440 Hz, key #60 should be 261.63 Hz, which we call the base frequency, following the practice in Csound..

See for example the top of settings of the piano scale in the tonality resource "-to.tryMPE":

For geeks: The Csound GEN51 line at the top is purely informative. It could be placed on top of Csound scores, but the Bol Processor uses note frequencies instead when unconventional positions are required — see Csound tuning in BP3.

Looking at the trace of the process when playing the "_scale(piano,0)" sequence yields the following:

§ key 60: "C4" chan 2 scale #5, block key 60, corr 0 cents, freq 261.630 Hz
§ key 61: "C#4" chan 2 scale #5, block key 60, corr 0 cents, freq 277.187 Hz
§ key 62: "D4" chan 2 scale #5, block key 60, corr 0 cents, freq 293.670 Hz
§ key 63: "D#4" chan 2 scale #5, block key 60, corr 1 cents, freq 311.312 Hz
§ key 64: "E4" chan 2 scale #5, block key 60, corr 1 cents, freq 329.824 Hz
§ key 65: "F4" chan 2 scale #5, block key 60, corr 1 cents, freq 349.436 Hz
§ key 66: "F#4" chan 2 scale #5, block key 60, corr 2 cents, freq 370.428 Hz
§ key 67: "G4" chan 2 scale #5, block key 60, corr 1 cents, freq 392.229 Hz
§ key 68: "G#4" chan 2 scale #5, block key 60, corr 2 cents, freq 415.792 Hz
§ key 69: "A4" chan 2 scale #5, block key 60, corr 2 cents, freq 440.516 Hz
§ key 70: "A#4" chan 2 scale #5, block key 60, corr 3 cents, freq 466.980 Hz
§ key 71: "B4" chan 2 scale #5, block key 60, corr 2 cents, freq 494.463 Hz
§ key 72: "C5" chan 2 scale #5, block key 60, corr 3 cents, freq 524.168 Hz

The first thing we notice is that the frequency of C4 (key #60) is 261.630 Hz, the base frequency of the block key. One octave higher, the frequency of C5 is 525.260 Hz. This gives an octave ratio of 2.0034, which equates to a stretching of 3 cents, close to 4 cents due to the rounding.

This is confirmed by the Csound score:

t 0.000 60
i1 0.000 0.333 261.630 90.000 90.000 0.000 0.000 0.000 0.000 ; C4
i1 0.333 0.333 277.187 90.000 90.000 0.000 0.000 0.000 0.000 ; C#4
i1 0.666 0.334 293.670 90.000 90.000 0.000 0.000 0.000 0.000 ; D4
i1 1.000 0.333 311.312 90.000 90.000 0.000 0.000 0.000 0.000 ; D#4
i1 1.333 0.333 329.824 90.000 90.000 0.000 0.000 0.000 0.000 ; E4
i1 1.666 0.334 349.436 90.000 90.000 0.000 0.000 0.000 0.000 ; F4
i1 2.000 0.333 370.428 90.000 90.000 0.000 0.000 0.000 0.000 ; F#4
i1 2.333 0.333 392.229 90.000 90.000 0.000 0.000 0.000 0.000 ; G4
i1 2.666 0.334 415.792 90.000 90.000 0.000 0.000 0.000 0.000 ; G#4
i1 3.000 0.333 440.516 90.000 90.000 0.000 0.000 0.000 0.000 ; A4
i1 3.333 0.333 466.980 90.000 90.000 0.000 0.000 0.000 0.000 ; A#4
i1 3.666 0.334 494.463 90.000 90.000 0.000 0.000 0.000 0.000 ; B4
i1 4.000 0.333 524.168 90.000 90.000 0.000 0.000 0.000 0.000 ; C5

When the frequencies are displayed using the just intonation scale, the octave ratio is exactly 2/1. Listen to the scale with decreasing velocities:

On the same scale, listen to a series of fifths C4/G4, D4/A4, E4/B4, F5/C5 showing that they are perfect except the wolf's fifth D4/A4 (see picture):

scale(just intonation,0) {C4 D4_ E4_ F4_, G4 A4 B4 C5}

Checking large intervals

Due to rounding (3 cents instead of 4) in the piano scale, check that rounding errors do not accumulate over octaves. The following is also an exercise for those whose ear is trained in piano tuning. We'll play identical notes in two scales: the piano scale with its extended octave, then the standard equal temperament scale with an octave of 2/1:

_tempo(1/2) {_scale(piano,0) C2 C3 C4 C5 C6 C7 _scale(0,0) C2 C3 C4 C5 C6 C7 1/16, 1/16 C2 C3 C4 C5 C6 C7 C2 C3 C4 C5 C6 C7}

The instruction "_scale(0,0)" sets the scale to the standard standard equal temperament scale. The layout of the notes in this polymetric structure is as follows:

There is a short delay (1/16 beat) on the notes of the second line to emphasise the beats, if there are any. You can hear beats in the first part, as scales are different, but perfect unison in the second part. This is how it sounds on a PianoTeq Stage physical modelling synthesiser:

This result should not be taken as a radical statement about how to tune a piano! Pianoteq synthesizers already reproduce the octave stretching that piano tuners tend to do to compensate for the inharmonicity of the strings. An additional octave stretching of four cents is therefore not worth mentioning.

The trace only shows notes whose frequencies have been corrected:

§ key 36: "C2" chan 2 scale #6, block key 60, corr -7 cents, freq 65.144 Hz
§ key 48: "C3" chan 2 scale #6, block key 60, corr -3 cents, freq 130.589 Hz
§ key 60: "C4" chan 2 scale #6, block key 60, corr 0 cents, freq 261.630 Hz
§ key 72: "C5" chan 2 scale #6, block key 60, corr 3 cents, freq 524.168 Hz
§ key 84: "C6" chan 2 scale #6, block key 60, corr 7 cents, freq 1050.760 Hz
§ key 96: "C7" chan 2 scale #6, block key 60, corr 11 cents, freq 2106.381 Hz

We note that 5 octaves gives a total stretch of 18 cents, or 3.6 cents per octave. The frequency ratio between C4 and C7, three octaves higher, is 2106.381/261.630 = 8.0509, whose cube root is 2.0042, again very close to the ratio of 2.0046 in the piano scale definition. Unsurprisingly, the C-sound score reveals exactly the same numbers.

Effect of the block key

Let us superimpose two phrases of the same notes in the same scale but without the same block key:

G3 A3 B3 {_scale(just intonation,A4) C4 D4 E4 A4, _scale(just intonation,C4) C5 D5 E5 A5}

It sounds strange, given that the note intervals are not exactly one octave:

The analysis of the trace gives an interesting result:

§ key 60: "C4" chan 2 scale #3, block key 69, corr 15 cents, freq 263.907 Hz
§ key 72: "C5" chan 3 scale #3, block key 60, corr 0 cents, freq 523.260 Hz
§ key 62: "D4" chan 2 scale #3, block key 69, corr 18 cents, freq 296.739 Hz
§ key 74: "D5" chan 3 scale #3, block key 60, corr 3 cents, freq 588.358 Hz
§ key 64: "E4" chan 2 scale #3, block key 69, corr 2 cents, freq 330.014 Hz
§ key 76: "E5" chan 3 scale #3, block key 60, corr -13 cents, freq 654.334 Hz
§ key 69: "A4" chan 2 scale #3, block key 69, corr 0 cents, freq 440.007 Hz
§ key 81: "A5" chan 3 scale #3, block key 60, corr -15 cents, freq 872.423 Hz

First, key #72 (C5) of scale #4 has 0 cents correction because the block key of this scale is C4 and it has no octave stretching. The same for key #69 (A4) of scale #3 whose block key is A4.

Pitch values can be deduced from the image of the just intonation scale., For instance, A4 (key #69) has 0 cent correction on the score because it is the block key. The corrected C4 frequency of this scale is 263.907 Hz (i.e. 15 cents above its base frequency 261.63 Hz) and the frequency ratio for A is 5/3, which yields 440.007 Hz as shown above.

Secondly, since notes C4 and C5 are superimposed with different cent corrections, i.e. different pitchbender settings, they must be sent on different MIDI channels: 2 and 3. This is the approach borrowed from MPE. Same for D4/D5, E4/E5, A4/A5. Note that each MIDI channel is reused as soon as it is free of notes.

For geeks: In this example, the notes G3 A3 B3 played at the beginning are not modified by a microtonal scale. They are therefore played on the standard equal tempered scale of the MIDI device. As a result, they appear on the Csound score in octave point pitch-class format:

i1 0.000 1.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 ; G3
i1 1.000 1.000 7.09 90.000 90.000 0.000 0.000 0.000 0.000 ; A3
i1 2.000 1.000 7.11 90.000 90.000 0.000 0.000 0.000 0.000 ; B3
i1 3.000 1.000 263.907 90.000 90.000 0.000 0.000 0.000 0.000 ; C4
i1 3.000 1.000 523.260 90.000 90.000 0.000 0.000 0.000 0.000 ; C5
i1 4.000 1.000 296.739 90.000 90.000 0.000 0.000 0.000 0.000 ; D4
i1 4.000 1.000 588.358 90.000 90.000 0.000 0.000 0.000 0.000 ; D5
i1 5.000 1.000 330.014 90.000 90.000 0.000 0.000 0.000 0.000 ; E4
i1 5.000 1.000 654.334 90.000 90.000 0.000 0.000 0.000 0.000 ; E5
i1 6.000 1.000 440.007 90.000 90.000 0.000 0.000 0.000 0.000 ; A4
i1 6.000 1.000 872.423 90.000 90.000 0.000 0.000 0.000 0.000 ; A5

Effect of the base key

The meantone_try scale

Let us use meantone_try and meantone_try2 scale to play the same phrase. We call these scales "exotic" because the names of their notes are not in the English, Italian/Spanish/French, or Indian standard. Here we use the key numbers of the MIDI output device.

The only difference is the key numbers. In meantone_try2, the base key is #64 instead of #60.

Try:

_scale(meantone_try,69) key#60 key#62 key#65 key#69 key#72

The result:

§ key 60: "key#60" chan 2 scale #4, block key 69, corr -5 cents, freq 260.875 Hz
§ key 62: "key#62" chan 2 scale #4, block key 69, corr -2 cents, freq 293.331 Hz
§ key 65: "key#65" chan 2 scale #4, block key 69, corr 13 cents, freq 351.866 Hz
§ key 69: "key#69" chan 2 scale #4, block key 69, corr 0 cents, freq 440.007 Hz
§ key 72: "key#60" chan 2 scale #4, block key 69, corr 13 cents, freq 527.204 Hz

The frequency of key#69 is 440 Hz since it is the block key. The actual sequence heard on the MIDI output device is C4 D4 F4 A4 C5. Note that the octave ratio C5/C4 is 527.204/260.875 which is greater than 2 because this scale has an octave stretched by 19 cents.

Now try:

_scale(meantone_try2,73) key#64 key#66 key#69 key#73 key#76

The result:

§ key 64: "key#64" chan 2 scale #5, block key 73, corr -5 cents, freq 260.875 Hz
§ key 66: "key#66" chan 2 scale #5, block key 73, corr -2 cents, freq 293.331 Hz
§ key 69: "key#69" chan 2 scale #5, block key 73, corr 13 cents, freq 351.866 Hz
§ key 73: "key#73" chan 2 scale #5, block key 73, corr 0 cents, freq 440.007 Hz
§ key 76: "key#64" chan 2 scale #5, block key 73, corr 13 cents, freq 527.204 Hz

Note again that the frequency of the base key #73 is 440 Hz. The frequencies are identical, the only change is the key numbers associated with the notes. The actual sequence played on the MIDI output device should again be C4 D4 F4 A4 C5, assuming that key #64 is the middle key of its keyboard.

A very exotic scale

The scale called zest24-supergoya17plus3_Db is more "exotic" than the previous one because it has 20 grades and 12 notes. The original scale downloaded from an archive did not have note names, so we decided to label twelve positions with the key numbers #60 to #71. As you can see in the picture, the intervals are very irregular. The choice of 12 tones is motivated by the desire to be able to map them onto the 12 keys of a standard piano keyboard. We'll see a different case later.

Try the following:

_scale(zest24-supergoya17plus3_Db,0) key#60 key#62 key#65 key#69 key#72

The result in real-time MIDI:

§ key 60: "key#60" chan 2 scale #7, block key 60, corr 0 cents, freq 261.630 Hz
§ key 62: "key#62" chan 2 scale #7, block key 60, corr 67 cents, freq 305.258 Hz
§ key 65: "key#65" chan 2 scale #7, block key 60, corr 176 cents, freq 386.605 Hz
§ key 69: "key#69" chan 2 scale #7, block key 60, corr 75 cents, freq 459.488 Hz
§ key 72: "key#60" chan 2 scale #7, block key 60, corr 0 cents, freq 523.260 Hz

and the Csound score:

i1 0.000 1.000 261.630 90.000 90.000 0.000 0.000 0.000 0.000 ; key#60
i1 1.000 1.000 305.258 90.000 90.000 0.000 0.000 0.000 0.000 ; key#62
i1 2.000 1.000 386.605 90.000 90.000 0.000 0.000 0.000 0.000 ; key#65
i1 3.000 1.000 459.488 90.000 90.000 0.000 0.000 0.000 0.000 ; key#69
i1 4.000 1.000 523.260 90.000 90.000 0.000 0.000 0.000 0.000 ; key#60

Key #60 is the base key and its frequency is 261.630 Hz as declared in the tonality resource. Note that the key #72, an octave higher, also has "key#60" as its note name. Its frequency of 523.260 Hz is twice 261.630 since octaves are not stretched.

Looking at the picture, we can calculate the frequency of key#65 which has a frequency ratio of 1.478. This gives 1.478 x 261.63 = 386.69 Hz, which is very close to that in the score. Minor errors are due to the rounding of cents to whole numbers.

If you play this score on a conventional MIDI device, you won't hear the correct frequencies unless the device is tuned to a 20-grade equal temperament scale. Conversely, the rendering in C-Sound is accurate.

When a scale has more than 12 grades, the reference tempered scale must have the same number of grades, regardless of the number of notes (which is indeed smaller). Apart from the musical aspect — which we won't discuss here — this has a technical advantage: the cent corrections, which are deviations from the equal temperament scale, will always be less than 100 cents. This is important because the sensitivity of pitchbenders is set to ± 200 cents.

The Bohlen-Pierce scale

The Bohlen-Pierce scale has a "tritave" interval of ratio 3/1 instead of 2/1 in the octave. The tritave is divided into 13 grades and 13 notes (see Wikipedia).

The "just-intonation" version has been implemented in the tonal resource -to.tryMPE — see picture.

Play the full sequence of notes over a tritave:

_scale(Bohlen-Pierce,0) C4 Db4 D4 E4 F4 Gb4 G4 H4 Jb4 J4 A4 Bb4 B4 C5

The Bohlen-Pierce scale played on Pianoteq

Be aware that notes with names like C, Db, D, etc. have utterly different positions than notes with the same names in a 12 tone scale.

This yields:

§ key 60: "C4" … corr 0 cents, freq 261.630 Hz
§ key 61: "Db4" … corr 33 cents, freq 282.522 Hz
§ key 62: "D4" … -> key 63 corr 1 cents, freq 311.312 Hz
§ key 63: "E4" … -> key 64 corr 35 cents, freq 336.365 Hz
§ key 64: "F4" … -> key 65 corr 82 cents, freq 366.174 Hz
§ key 65: "Gb4" … -> key 67 corr 36 cents, freq 400.239 Hz
§ key 66: "G4" … -> key 68 corr 84 cents, freq 435.960 Hz
§ key 67: "H4" … -> key 70 corr 17 cents, freq 470.772 Hz
§ key 68: "Jb4" … -> key 71 corr 65 cents, freq 512.788 Hz
§ key 69: "J4" … -> key 73 corr 19 cents, freq 560.492 Hz
§ key 70: "A4" … -> key 74 corr 66 cents, freq 610.163 Hz
§ key 71: "Bb4" … -> key 76 corr 0 cents, freq 659.266 Hz
§ key 72: "B4" … -> key 77 corr 68 cents, freq 726.449 Hz
§ key 73: "C5" … -> key 79 corr 1 cents, freq 784.457 Hz

The frequency ratio C5 / C4 is, as expected, 784.457 / 261.630 = 3.

Since the scale covers a tritave that would extend from A4 (key #60) to G5 (key #79) on a conventional 12-note MIDI device, each note is mapped to the key that requires the least amount of pitchbend. As a result, pitchbend corrections are never greater than ± 100 cents.

The Csound score:

i1 0.000 1.000 261.630 90.000 90.000 0.000 0.000 0.000 0.000 ; C4
i1 1.000 1.000 282.522 90.000 90.000 0.000 0.000 0.000 0.000 ; Db4
i1 2.000 1.000 311.312 90.000 90.000 0.000 0.000 0.000 0.000 ; D4
i1 3.000 1.000 336.365 90.000 90.000 0.000 0.000 0.000 0.000 ; E4
i1 4.000 1.000 366.174 90.000 90.000 0.000 0.000 0.000 0.000 ; F4
i1 5.000 1.000 400.239 90.000 90.000 0.000 0.000 0.000 0.000 ; Gb4
i1 6.000 1.000 435.960 90.000 90.000 0.000 0.000 0.000 0.000 ; G4
i1 7.000 1.000 470.772 90.000 90.000 0.000 0.000 0.000 0.000 ; H4
i1 8.000 1.000 512.788 90.000 90.000 0.000 0.000 0.000 0.000 ; Jb4
i1 9.000 1.000 560.492 90.000 90.000 0.000 0.000 0.000 0.000 ; J4
i1 10.000 1.000 610.163 90.000 90.000 0.000 0.000 0.000 0.000 ; A4
i1 11.000 1.000 659.266 90.000 90.000 0.000 0.000 0.000 0.000 ; Bb4
i1 12.000 1.000 726.449 90.000 90.000 0.000 0.000 0.000 0.000 ; B4
i1 13.000 1.000 784.457 90.000 90.000 0.000 0.000 0.000 0.000 ; C5

Examples of music using the Bohlen-Pierce scale :
https://en.xen.wiki/w/Bohlen-Pierce_scale/Music

To convert to Bohlen-Pierce notes played on an external MIDI device, connect it to the input of BP3, then run the following "tuning daemon" (see below):

_vel(0) C0 _script(wait forever) _scale(Bohlen-Pierce,0)

Combination of several scales

In the following example, two phrases are played on top of each other, using different microtonal scales.

On the pianoroll (see picture), key#60 is shown as C4. The note key#62, shown as D4, seems to be unique, although two key#62 notes are superimposed with slightly different cent corrections. The same is true with key#72 shown as C5.

{ _scale(zest24-supergoya17plus3_Db,0) key#60 key#62 key#69 key#72 , _scale(meantone_try,69) key#69 key#62 key#60 key#72 }

The result:

§ key 60: chan 2 scale #7, block key 60, corr 0 cents, freq 261.630 Hz
§ key 69: chan 3 scale #4, block key 69, corr 0 cents, freq 440.007 Hz
§ key 62: chan 2 scale #7, block key 60, corr 67 cents, freq 305.258 Hz
§ key 62: chan 3 scale #4, block key 69, corr -2 cents, freq 293.331 Hz
§ key 69: chan 2 scale #7, block key 60, corr 75 cents, freq 459.488 Hz
§ key 60: chan 3 scale #4, block key 69, corr -5 cents, freq 260.875 Hz
§ key 72: chan 2 scale #7, block key 60, corr 0 cents, freq 523.260 Hz
§ key 72: chan 3 scale #4, block key 69, corr 13 cents, freq 527.204 Hz

Although the second and last notes are identical (keys 62 and 72), their frequencies are not equal because they belong to different scales. For this purpose, they are played on different MIDI channels. The superimposition creates (nasty) mismatches that reflect the differences in tuning:

Use of _scale(0,0)

So far we have used "_scale(0,0)" to specify the return to a 12-grade equal tempered scale after using a microtonal scale. It can also be used to force microtonal mode in a musical item that does not require specific microtonal scales.

Pitchbend adjustments are not shown on this graph

For example, try to play the phrase:

_pitchrange(200) C4 _pitchbend(100) C4 {_pitchbend(-100) C4, _pitchbend(200) C4} C4 _pitchbend(0) C4

This is a (rather silly) way of creating a sequence of notes using the same note with pitchbend corrections. In fact, we are looking forward to hearing:

C4 C#4 {B3, D4} C#4 C4

The first solution does not work because the chord {B3, D4} consists of two of the same note A4 with different pitchbend values. It works in Csound, but in MIDI we hear:

An incorrect rendering of C4 C#4 {B3, D4} C#4 C4

Proper notation, without the aid of microtonality, would be, for example:

_pitchrange(200) C4 _pitchbend(100) C4 {_pitchbend(-100) C4, _chan(2) _pitchrange(200) _pitchbend(200) C4} C4 _pitchbend(0) C4

So we have to send the two C4s of the polymetric expression on separate MIDI channels. But the microtonal calculation does this automatically. So, putting "_scale(0,0)" at the beginning won't change the tuning but it will force the microtonal mode:

_scale(0,0) _pitchrange(200) C4 _pitchbend(100) C4 {_pitchbend(-100) C4, _pitchbend(200) C4} C4 _pitchbend(0) C4

Now we hear:

A correct rendering of C4 C#4 {B3, D4} C#4 C4 using the microtonal mode

and the trace shows:

§ key 60: "C4" chan 2
§ key 60: "C4" chan 2
--> with additional pitchbend value of 4095
§ key 60: "C4" chan 2
--> with additional pitchbend value of -4096
§ key 60: "C4" chan 3
--> with additional pitchbend value of 8191
§ key 60: "C4" chan 2
--> with additional pitchbend value of 4095
§ key 60: "C4" chan 2

Csound scores are the same in all cases (pitchbend parameters in bold):

i1 0.000 1.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C4
i1 1.000 1.000 8.00 90.000 90.000 0.000 99.988 99.988 0.000 ; C4
i1 2.000 1.000 8.00 90.000 90.000 0.000 -100.000 -100.000 0.000 ; C4
i1 2.000 1.000 8.00 90.000 90.000 0.000 199.976 199.976 0.000 ; C4
i1 3.000 1.000 8.00 90.000 90.000 0.000 99.988 99.988 0.000 ; C4
i1 4.000 1.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C4

For geeks: It wouldn't be a good idea to set microtonality mode by default for all musical works, because (1) channel assignment takes up processing time, and (2) this would render all "_chan()" commands ineffective. In some MIDI environments, MIDI channels are used to send messages to different instruments.

Combination with pitchbend commands

The following is an example of combining a microtonal phrase with a global pitchbend command of + 100 cents:

_chan(4) _pitchrange(200) _scale(zest24-supergoya17plus3_Db,0) _pitchbend(+100) key#60 key#62 key#65 key#69 key#72 _pitchbend(0) key#72

The result is:

§ key 60: "key#60" chan 2 scale #7, block key 60, corr 0 cents, freq 261.630 Hz
--> with additional pitchbend value 4095
§ key 62: "key#62" chan 2 scale #7, block key 60, corr 67 cents, freq 305.258 Hz
--> with additional pitchbend value 4095
§ key 65: "key#65" chan 2 scale #7, block key 60, corr 176 cents, freq 386.605 Hz
--> with additional pitchbend value 4095
§ key 69: "key#69" chan 2 scale #7, block key 60, corr 75 cents, freq 459.488 Hz
--> with additional pitchbend value 4095
§ key 72: "key#60" chan 2 scale #7, block key 60, corr 0 cents, freq 523.260 Hz
--> with additional pitchbend value 4095
§ key 72: "key#60" chan 2 scale #7, block key 60, corr 0 cents, freq 523.260 Hz

The "_chan(4)" command is used here to prove that it is ignored in microtonality mode. The MIDI trace shows that an additional correction has been applied. Therefore, the frequency values are not those played on the output MIDI device. However, the Csound score is explicit:

i1 0.000 1.000 261.630 90.000 90.000 0.000 99.988 99.988 0.000 ; key#60
i1 1.000 1.000 305.258 90.000 90.000 0.000 99.988 99.988 0.000 ; key#62
i1 2.000 1.000 386.605 90.000 90.000 0.000 99.988 99.988 0.000 ; key#65
i1 3.000 1.000 459.488 90.000 90.000 0.000 99.988 99.988 0.000 ; key#69
i1 4.000 1.000 523.260 90.000 90.000 0.000 99.988 99.988 0.000 ; key#60
i1 5.000 1.000 523.260 90.000 90.000 0.000 0.000 0.000 0.000 ; key#60

The numbers 99.988 and 99.988 are the pitchbend corrections (in cents) at the beginning and end of the note declared on each line.

The "grama" Indian scale

The grama scale

We have already discussed the ancient Indian tonal system which divides the octave into "twenty-two shrutis", see The two-vina experiment for details. We'll try this grama scale by setting the pramāņa ṣruti to 21 cents.

In short, this tuning scheme is a twelve degree chromatic scale: Sa, Re komal, Re, Ga komal, Ga, Ma, Ma tivra, Pa, Dha komal, Dha, Ni komal, Ni. These names stand for C, Db, D, Eb, E, F, F#, G, Ab, A, Bb, B in English notation.

Each note of the Indian scale, except Sa (C) and Ma tivra (F#), can occupy two enharmonic positions. This explains why the grama tuning scheme has 23 positions and 22 notes.

In accordance with the syntax of the Bol processor, notes are referred to as sound objects in lower case. For example, the two enharmonic positions of Re komal are called r1_ and r2_, and the two positions of Re are called r3_ and r4_. A trailing '_' is necessary to indicate octave numbers unambiguously: the note d3_4 is the low position of Dha in the 4th octave, which is admittedly close to A4 in the Western scale.

The pramāņa ṣruti is the tonal distance between all pairs of enharmonic positions, for instance between r1_ and r2_. For the sake of simplicity, we've set it to 21 cents (a syntonic comma), which is a common mistake made by Western and Indian musicologists. In reality it is a variable value — see Raga intonation.

Play the scale:

_scale(grama, d3_4) sa_4 r1_4 r2_4 r3_4 r4_4 g1_4 g2_4 g3_4 g4_4 m1_4 m2_4 m3_4 p3_4 p4_4 d1_4 d2_4 d3_4 d4_4 n1_4 n2_4 n3_4 n4_4 sa_5

The result (Csound is identical):

§ key 60: "sa_4" …corr 15 cents, freq 263.907 Hz
§ key 61: "r1_4" …corr 6 cents, freq 278.150 Hz
§ key 62: "r2_4" …corr -73 cents, freq 281.544 Hz
§ key 63: "r3_4" …-> key 61 corr 98 cents, freq 293.331 Hz
§ key 64: "r4_4" …-> key 62 corr 19 cents, freq 296.910 Hz
§ key 65: "g1_4" …-> key 63 corr 10 cents, freq 312.935 Hz
§ key 66: "g2_4" …-> key 63 corr 31 cents, freq 316.754 Hz
§ key 67: "g3_4" …-> key 64 corr 2 cents, freq 330.014 Hz
§ key 68: "g4_4" …-> key 64 corr 23 cents, freq 334.042 Hz
§ key 69: "m1_4" …-> key 65 corr 14 cents, freq 352.070 Hz
§ key 70: "m2_4" …-> key 65 corr 35 cents, freq 356.366 Hz
§ key 71: "m3_4" …-> key 66 corr 6 cents, freq 371.285 Hz
§ key 72: "p3_4" …-> key 66 corr 96 cents, freq 391.097 Hz
§ key 73: "p4_4" …-> key 67 corr 17 cents, freq 395.870 Hz
§ key 74: "d1_4" …-> key 68 corr 8 cents, freq 417.235 Hz
§ key 75: "d2_4" …-> key 68 corr 29 cents, freq 422.327 Hz
§ key 76: "d3_4" …-> key 69 corr 0 cents, freq 440.007 Hz
§ key 77: "d4_4" …-> key 69 corr 21 cents, freq 445.377 Hz
§ key 78: "n1_4" …-> key 70 corr 12 cents, freq 469.414 Hz
§ key 79: "n2_4" …-> key 70 corr 33 cents, freq 475.143 Hz
§ key 80: "n3_4" …-> key 71 corr 4 cents, freq 495.034 Hz
§ key 81: "n4_4" …-> key 71 corr 25 cents, freq 501.075 Hz
§ key 82: "sa_5" …-> key 72 corr 16 cents, freq 528.118 Hz

The grama scale (22 notes) played on Pianoteq

Listen to the same scale played against a drone (read the Microtonality page):

The Csound rendering of the grama scale (23 grades) played against a drone. This version has an additional note m4_ that does not belong to the preceding scale. 

We said earlier that, in the grama tuning scheme, d3_4 occupies the position of A4 in the Western scale. Since the block key is #76 (d3_4), the frequency of d3_4 is close to 440 Hz. Consequently, the position of sa_4 (263.907 Hz) is 15 cents higher than the base frequency (261.63 Hz).

This scale can be played on any MIDI device that accepts pitchbend commands. The 22 notes of the scale, covering an octave, are mapped to the 12 keys of a MIDI keyboard. Each note is mapped to the key that requires the least amount of pitchbend. As a result, pitchbend corrections are never greater than ± 100 cents. For example, d3_4 is mapped to key #69, which happens to be that of A4 on a conventional keyboard.

Read the Raga Intonation page to see how this theoretical framework can be adapted for modelling real music.

Microtonality in sound-objects

A sound-object is a sequence of MIDI events and/or Csound score lines — read Sound-object prototypes for details. Therefore the pitches of notes it contains can be modified by microtonal scales. In the "-da.tryMPE" project, try for instance:

_scale(just intonation,0) a f b b

and check frequency corrections in the trace (both MIDI and Csound):

§ key 69: "A4" octave 4 scale #3, block key 60, corr -15 cents, freq 436.212 Hz
§ key 41: "F2" octave 2 scale #3, block key 60, corr -1 cents, freq 87.258 Hz
§ key 71: "B4" octave 4 scale #3, block key 60, corr -11 cents, freq 490.764 Hz
§ key 71: "B4" octave 4 scale #3, block key 60, corr -11 cents, freq 490.764 Hz
§ key 71: "B4" octave 4 scale #3, block key 60, corr -11 cents, freq 490.764 Hz
§ key 71: "B4" octave 4 scale #3, block key 60, corr -11 cents, freq 490.764 Hz

The position of A on the just intonation scale (see picture) is 884 cents above C, which is 15 cents below its position on the equal temperament scale (900 cents). The same goes for B which is 1088 cents above C, and thus 11 cents below its position on the equal temperament scale (1100 cents). 

Applying microtonal corrections to MIDI input notes

This demonstrates the BP3's ability to act as an interface between MIDI devices, retuning the input in real time to a microtonal scale.

The filter of the input MIDI device should be set to "treat & pass" for all categories of events that will be transmitted (see picture).

We show a temporary solution that works very well, but will be simplified in the future.

If, for example, you want to retune the input to the just intonation scale, run the following "tuning daemon":

_script(wait for C0 channel 16) _scale(just intonation,A4) _vel(0) C0

The "wait for C0 channel 16" command that causes the machine to hang up while it listens for some kind of input. In fact, the note "C0 channel 16" should not be part of the stream of notes you need to retune, otherwise it will stop the process!

The note C0 with velocity 0 is inaudible and will not be played unless the note "C0 channel 16" releases the waiting state. This note is needed for attaching the script instruction.

An alternative to this setup is:

_vel(0) C0 _script(wait forever) _scale(just intonation,A4)

The "wait forever" command causes the machine to hang until the STOP or PANIC button is pressed. Again, we need a dummy (inaudible) note C0, at the end of which the script instruction is appended.

Because multiple instances of BP3 can be run simultaneously (read Real-time MIDI), you can set up a bank of "tuning daemons" that interact with people and MIDI devices to create interesting variations of tonal structures.

Tonal analysis of musical works

This article describes a feature of Bol Processor (BP3) designed for the tonal analysis of musical compositions. This program can evaluate melodic and harmonic intervals within a piece, comparing them against various documented tuning systems, or temperaments. The primary goal is to identify the most suitable temperament for a given musical work, particularly relevant for Baroque music. The system allows for visual and numerical comparison of how well different scales match the intervals present in the music, offering insights into a piece's intended or most consonant performance.

Musical works encoded in the Bol Processor (using "simple notes" according to English, Italian/Spanish/French and Indian conventions) can be analysed in terms of harmonic or melodic intervals.

The musical aspects are discussed after a description of the process.

In the final section, we present a one-click method for evaluating the suitability of all documented tuning systems for a given piece of music. A demo of this analysis can be found on the Bach well-tempered tonal analysis.

Basic process

This calculation is started by pressing the ANALYZE INTERVALS button at the bottom of the 'Data' window:

The machine found a '-to.tryTunigs' declaration at the top of the data content, indicating that it should pick up the scale definitions contained in this tonality resource. These definitions are only accessible if '-to.tryTunigs' was opened less than 24 hours ago: these files are stored in the 'temp_bolprocessor' folder which is automatically cleaned up of old storage. Click on the 'open' link if necessary.

The analytical process is demonstrated using a single phrase of François Couperin's Les Ombres Errantes imported from a MusicXML score — see the Importing MusicXML scores page. This example is small enough to allow a visual check of the technical process, but too short to allow a meaningful musical interpretation of the result.

In polymetric notation (English convention), the musical item reads as follows — read the Polymetric structures page:

-to.tryTunings

_scale(rameau_en_sib,0)
_rndtime(20) {_tempo(13/15) _vel(64){3, _legato(20) C5 _legato(0) {1/4,C5 B4 C5}{3/4,B4} _legato(20) Eb5,{1/2,Eb4}{5/2,G4 D4 F4 C4 Eb4},Eb4 D4 C4}} {_tempo(13/15) _vel(64){4, _legato(0) {1/4,Eb5 D5 Eb5}{3/4,D5} _legato(20) C5 _legato(0) {1/4,C5 B4 C5}{3/4,B4}{1/8,C5 B4}{7/8,C5},{4,B3 F4 Eb4 G4 D4 F4 C4 Eb4},B3 Eb4 D4 C4}}

Beginning of "Les Ombres Errantes"
Scale "Rameau en sib" (see full image)

The sound production used the tonality resource file '-to.tryTunings' which contains the tonal scale 'rameau_en_sib' — see the page Comparing temperaments. This scale probably provides the best tuning for this piece when played on a "harpsichord-like" Csound instrument.

The machine has picked up a definition of the tonal scale in a temporary copy of '-to.tryTunings'. The essential content of this definition is the set of tonal positions in the scale shown in the image — see the Microtonality page.

Click on the ANALYZE INTERVALS button and the following screen appears:

Analysis of melodic and harmonic intervals in a short fragment of "Les Ombres errantes"

The table above gives a summary of matching intervals: pairs of notes played one after the other (melodic) or one above the other (harmonic), distinguishing between ascending and descending melodic intervals. These matches can be checked in the graphical representation of this item:

Intervals are listed in descending order of importance. For example, the melodic interval 'C' to 'B' occurs in 20.3 beats, the highest number. Ascending melodic intervals 'B' to 'F' and 'D' to 'B' are the least frequent. Values less than 5% of the maximum in the column are ignored in the graphical display.

Harmonic (left) and melodic (right) intervals

Interestingly, the highest scores of harmonic intervals in this musical phrase are minor thirds such as 'D'/'B' and 'C'/'Eb'. The fifth 'C'/'G' is scored only 1.6 beats, which is 18% of the highest score.

The detection of a "harmonic interval" is based on the comparison of its start and end dates with options that can be modified. Let $start1, $end1, $start2 and $end2 be the timings of two notes. We assume $start2 >= $start1 due to a preliminary chronological sorting of the list of notes. The matching_intervals() function does the following to evaluate harmonic intervals:

$duration1 = $end1 - $start1;
$duration2 = $end2 - $start2;
$overlap = $end1 - $start2;
$smallest_duration = $duration1;
if($duration2 < $duration1) $smallest_duration = $duration2;


if($smallest_duration < $min_dur) return FALSE;
if($start1 + ($duration1 / 2.) < $start2) return FALSE;
if($overlap < ((1 - $ratio) * $smallest_duration)) return FALSE;
return TRUE;

This function eliminates brief overlaps of time intervals, such as those created by slurs interpreted as _legato() performance controls when importing MusicXML scores — see details. It also eliminates notes with durations less than $min_dur, optionally set to 500 milliseconds. For example, short notes such as 'C5', 'B4', 'Eb5', etc., are discarded. Finally, it checks that $overlap is greater than a fraction of the smallest duration, with $ratio set to 0.25 by default. Another option, not shown here, is the maximum tonal distance between two notes, which is set to 11 semitones by default.

The conditions for matching melodic intervals are similar:

if($start2 > ($end1 + $max_gap)) return FALSE;
if($start1 + ($duration1 / 2.) >= $start2) return FALSE;
if($overlap >= ($ratio * $smallest_duration)) return FALSE;
return TRUE;

The $max_gap parameter (typically 300 milliseconds) is the maximum delay between the end of the first note and the beginning of the next one.

All parameters can be changed before the process is restarted. These settings are discussed later:

Default settings for tonal analysis

Calculations

Detailed tonal analysis

To check the sequence of time intervals in great detail it is possible to activate the "Display all dates" option yielding a detailed analysis.

All matching intervals will be listed. It is not practical to use this option on large pieces of music…

Dates are in seconds, rounded to 0.1s, although more accurate values are used. In fact, all time calculations are based on whole numbers, as in the Bol Processor console.

The result is always debatable. For example, some melodic or harmonic intervals may appear "accidental" rather than significant.

For this and other reasons, it may be necessary to explore other options related to musical and performance styles.

Graphic display

Melodic and harmonic tonal intervals are displayed against the background of the tonal scale used for the performance. Here it would be 'rameau_en_sib', although by default an equal-tempered scale is used.

Clicking on the links to the harmonic interval pictures (see image above) will bring up the following three graphs — in separate and resizable windows:

Display of harmonic intervals. The 'rameau_en_sib' scale is in the middle.

Intervals are shown as gold highlights with widths proportional to their relative values. In the left-hand image, these golden segments are drawn behind the fifths, major and minor thirds marked on the scale. For this reason, the yellow highlighting of the link between Eb and G, behind the green link of a harmonic major third, is less visible in the full image.

Minor thirds (ratio 6/5) have been added to the settings. For this reason, those available in this scale are shown as black segments. These additional ratios are listed at the top right of each image.

Restricted analysis

If a MusicXML file has been imported along with bar numbers (notated [—1—], [—2—] etc.), these can be used to restrict the analysis to a subset of the score.

Below is the setting of bars #1 to #32 (the Aria) in J.S. Bach's Goldberg Variations:

Restricting the tonal analysis to the Aria in the Goldberg Variations makes sense because other variations, due to their high speed, do not show harmonic intervals longer than the minimum duration fixed in the settings (500 ms).

Musicological discussion

Tonal analysis with the Bol Processor aims to help choose the most appropriate tuning system for a piece of music — a temperament as defined by Baroque musicians. This topic is covered on the page Comparing temperaments.

We first describe a visual method for estimating (rather than measuring) the adequacy of a tuning system for the performance of musical works imported from MusicXML scores — read the page on this topic. In the next section, we will show how to automatically compare all candidate scales, taking into account the relevant parameters revealed in this section.

Take, for example, J.S. Bach's Prelude 1 in C major for which some historical information (reported by Asselin, 2000 p. 142) suggests the choice of a Kirnberger temperament. Which one?

Harmonic tonal intervals of Bach's 1st prelude versus Kirnberger II and Kirnberger III tuning systems

The full representation of the harmonic intervals is shown above and compared with two different scales described by Kirnberger (Asselin, 2000 p. 90, 93). The match looks better on the right (Kirnberger III). For example, the interval 'D' - 'A' is closer to a "pure" fifth (702 cents) on Kirnberger III (697) than on Kirnberger II (691). Another significant match is the harmonic major third 'F' - 'A'. Other intervals are similar in terms of these scales.

A careful listening to both versions might confirm this mechanical analysis:

Kirnberger II
Kirnberger III

For François Couperin's Les Ombres Errantes, the same crude analysis yields no significant result. Harmonic interval analysis may be less relevant because this piece is more generally perceived as a sequence of melodic intervals, including minor thirds and major seconds. This can be seen in the graph of melodic intervals:

Melodic intervals of "Les Ombres Errantes" (full performance)

Comparing this graph with the 'rameau_en_sib' scale does not reveal any interesting patterns, for the simple reason that neither minor thirds nor major seconds have been taken into account in this scale in terms of "just intonation" — see page Just intonation: a general framework. Although we can assume that a Pythagorean major second (ratio 9/8) sounds more "consonant" than a harmonic one (ratio 10/9), there is no reason to systematically claim that the harmonic minor third (ratio 6/5) is "better" than the Pythagorean one (ratio 32/27).

The picture on the left shows that the frequent melodic intervals of major thirds emphasise the harmonic major thirds (ratio 5/4) of this scale.

We need to check intervals smaller than the major third in the tonal scales. If we tell the machine to check intervals close (within ± 10 cents) to the harmonic minor third (ratio 6/5), the above graphs will look like this:

Melodic intervals of "Les Ombres Errantes" (full performance) with black markings of "good" minor thirds (6/5) on a ‘rameau_en_sib’ temperament

The picture on the left side shows that all the minor thirds used in this performance coincide within ± 10 cents with the harmonic minor thirds (ratio 6/5) of the scale, which is an incentive to admit that the 'rameau_en_sib' scale would be a fair (perhaps the best) tuning option for Les Ombres Errantes.

A counter-example is the matching of Les Ombres Errantes with a pure-minor-thirds temperament designed during in 16th century (Asselin 2000 p. 82, see figure). Below are the graphs of the matching melodic (left) and harmonic (right) intervals, with black lines marking the harmonic minor thirds (ratio 6/5):

Melodic (left) and harmonic (right) intervals of "Les Ombres Errantes" against a pure-minor-thirds temperament
"Les Ombres Errantes" with a pure minor thirds temperament (16th century)

The main drawback of this 'pure_minor_thirds' temperament is the very low position of 'Ab' which is supposed to produce a consonant sequence of minor thirds: 'Ab' - 'B' - 'D' - 'F'. However, 'Ab' - 'B' is not a melodic interval found in this piece, nor are 'Db' - 'E' and 'E' - 'G', which are well represented by the 'pure_minor_thirds' temperament. There are also discrepancies in the harmonic intervals, which are easy to hear. We can conclude that the pure minor thirds temperament is neither the best nor the worst tuning system for this musical work, although the comparison of sound productions suggests that it is significantly less good than the 'rameau_en_sib' scale.

➡ Comparing graphs is easy with the detached resizable pictures produced by the Bol Processor.

A "deaf musicologist's" approach

The analysis shown so far has replaced a comparison of sound rendering — see the page Comparing temperaments — with a visual problem of pattern-matching. We have shown that Baroque musicians and tuners sought to achieve consonance in terms of simple frequency ratios for fifths (close to 3/2) and harmonic major thirds (close to 5/4). This approach and its underlying assumptions are discussed on the page Just intonation: a general framework.

Furthermore, one might be tempted to claim that a "just intonation" minor third should be harmonic (ratio close to 6/5), but the decision should remain open. To this end, it is possible to enter an additional set of melodic and harmonic intervals that the analyst considers significant for the evaluation of tonal scales. Each interval is defined by an integer ratio — which can be as complex as necessary.

Comparative pattern matching assigns a numerical score to each scale that has been evaluated for its fit with the musical work. This allows the candidate scales to be sorted. However, two separate scores are required, one for melodic intervals and one for harmonic intervals. A weighted sum of scores is therefore used to sort the list of scales.

This method has been implemented in the Tonal analysis process. We have compared all the scales defined in '-to.tryTunings' — including in particular all the temperaments documented by Pierre-Yves Asselin — in terms of their suitability for the rendering of melodic and tonal intervals in François Couperin's Les Ombres Errantes:

Matching scales for "Les Ombres Errantes"

Great result! The machine confirms that the scale 'rameau_en_sib' is the best candidate for the interpretation of Les Ombres Errantes. Its scores are significantly better for both melodic and harmonic intervals. (A total of 45 tuning schemes were tried.)

By default, the evaluation of melodic and harmonic intervals considers only perfect fifths (3/2) and harmonic major thirds (5/4) as "good" intervals, with weights of 2 and 1 respectively, and wolf fifths (40/27), wolf fourths (320/243) and Pythagorean major thirds (81/64) as "bad" intervals, with weights of -2, -2 and -1 respectively. All these weights can be modified as shown in the image above.

We repeat the comparison with the additional option of harmonic minor thirds (6/5) as melodic intervals:

Matching scales, including harmonic minor thirds (ratio close to 6/5) for melodic intervals

As expected, all the melodic values increased, but the winner remained. If we add the Pythagorean major second (ratio close to 9/8), we get the following:

Matching scales, including ratios 6/5 and 9/8 for melodic intervals

The 'rameau_en_sib' scale is now challenged by 'sauveur' for melodic intervals, but its harmonic score remains higher.

Note that scales Abmaj and Cmin are identical, which explains their equal scores.

A visual comparison of scales with melodic interval markings shows that there is little difference between these temperaments in terms of the performance of Les Ombres Errantes. Since the 'sauveur' temperament was designed in 1701 by the (hearing-impaired?) French mathematician Joseph Sauveur, it is not unlikely that it was used for the composition of Les Ombres Errantes in 1730.

Comparison of 'rameau_en_sib' and 'sauveur' temperaments for melodic intervals in "Les Ombres Errantes", with additional ratios 6/5 and 9/8 displayed as black lines.

The scale 'rameau_en_sib' again scores as good as 'sauveur' when the Pythagorean minor third (ratio close to 32/27) is tried as a melodic interval (both ascending and descending) in place of the ratio 6/5… This is due to the use of 'F' - 'Ab', which is rendered as a Pythagorean minor third by 'rameau_en_sib', but not by 'sauveur'.

Many more checks can be made by changing the weights assigned to the occurrences of melodic and harmonic ratios. Finding the best settings requires a thorough study of the musical score — this is where human musicologists come in!

Ears (plus expert knowledge of the score) could make the final decision:

"Les Ombres Errantes", Rameau en sib temperament
"Les Ombres Errantes", Sauveur temperament

The analytical process we are following is a kind of reverse engineering… Obviously, composers did not search for a suitable temperament after creating a musical work. It is more realistic to assume that they composed works on existing instruments, with the effect that sets of pieces produced by the same composer (using the same instrument) at a given time obeyed implicit melodic and harmonic constraints that best suited the tuning of their instrument(s).

Comparative study

Let us look again at J.S. Bach's Prelude 1 in C major, for which Kirnberger III was chosen (visually) as a better match than Kirnberger II. Including the ratios 6/5 and 9/8 as possible melodic up/down intervals, and 6/5 as a harmonic interval, the following classification of tuning schemes emerges:

Classification of scales for the interpretation of J.S. Bach's Prelude 1 in C major

The winner is undoubtedly 'sauveur' although the harmonic score is identical for six temperaments, but 'kirnberger_3' scores much lower.

Note that this was achieved by declaring ratios close to 6/5 as possible consonant melodic and harmonic intervals. For a discussion of this hypothesis, see Bach well-tempered tonal analysis for a discussion of this hypothesis.

Sauveur's temperament is the best suited because of its high proficiency in harmonic minor thirds (6/5) and Pythagorean major seconds (9/8). It also has a complete set of perfect fourths and fifths (3/2) except for the wolf fourth 'D#' - 'G#', which is almost 477 cents (instead of 498). Fortunately, this interval is never used in Bach's piece:

Matching the melodic intervals of J.S. Bach's Prelude 1 in C major with Sauveur's temperament
J.S. Bach's Prelude 1 in C major played by the Bol Processor + Csound with Sauveur's temperament

This rendering can be compared (in terms of tunefulness) with a human performance on a real harpsichord:

J.S. Bach's Prelude 1 in C major played on the copy of an instrument built by Hans Moerman in Antwerpen (1584). Source: Wikipedia licence CC BY-SA.

Unsurprisingly, J.S. Bach's Fugue 1 in C major shares the same preference for 'sauveur', with other tuning schemes following in a different order. All of the fugues in this series of works (books I and II) are associated with preludes in the same key.

The tonal analysis of J.S. Bach's Prelude 2 in C minor again selects 'sauveur' using the same evaluation criteria — including the ratios 6/5 (melodic and harmonic) and 9/8 (melodic up/down). The scoring is completely different, but the winner is unchanged, although it is challenged by 'rameau_en_sib' for its harmonic score.

J.S. Bach's Prelude 2 in C minor played by the Bol Processor + Csound with Sauveur's temperament

Note that the Cmin scale has a bad rate because of the melodic intervals. It beats Sauveur's temperament in terms of harmonic intervals, but these are relatively rare in this prelude. This classification could be quite different if some ratios (such as 9/8) were ignored for the evaluation of melodic intervals. Even ratios close to Pythagorean thirds (81/64) may sound acceptable in fast melodic movements — see the page on Bach well-tempered tonal analysis.

J.S. Bach's Fugue 2 in C minor again favours 'sauveur'.

We get the same result with J.S. Bach's Prelude 6 in D minor (random choice). Note the strikingly high melodic scores of 'sauveur':

J.S. Bach's Prelude 6 in D minor played by theBol Processor + Csound with Sauveur's temperament

J.S. Bach once claimed that he could play his entire repertoire on the instrument he had tuned by himself. This sounds like squaring the circle, and many hypotheses have been put forward to solve this problem for das Wohltemperierte Clavier.

These examples suggest that Sauveur's temperament may have been Bach's choice. Although there is little chance that the German composer (1685-1750) would have heard of the research work of the French physician (1653-1716), the systematic construction of this temperament — a single sequence of fifths diminished by 1/5 comma (see image and read Asselin, 2000 p. 80) — suggests that any composer could have worked it out independently.

To test (and challenge) this hypothesis, we have undertaken a tonal analysis of 24 preludes and fugues from books I and II of The Well-Tempered Clavier using the same settings. Read the Bach Well-tempered tonal analysis page. This large spectrum analysis requires a batch processing device, which we will now describe.

Batch processing

To analyse the tonality of a large number of musical works, we need to create a Data page containing the names of all the pages containing the Bol Processor scores of these items. For example, the page “-da.index_preludes_book_I” is as follows:

// All Bach preludes

-se.Bach_preludes
-to.tryTunings

-da.Bach_1st_prelude
-da.Bach_2nd_prelude
-da.Bach_3d_prelude
-da.Bach_4th_prelude
-da.Bach_5th_prelude
-da.Bach_6th_prelude
-da.Bach_7th_prelude
-da.Bach_8th_prelude
-da.Bach_9th_prelude
-da.Bach_10th_prelude
-da.Bach_11th_prelude
-da.Bach_12th_prelude
-da.Bach_13th_prelude
-da.Bach_14th_prelude
-da.Bach_15th_prelude
-da.Bach_16th_prelude
-da.Bach_17th_prelude
-da.Bach_18th_prelude
-da.Bach_19th_prelude
-da.Bach_20th_prelude
-da.Bach_21st_prelude
-da.Bach_22nd_prelude
-da.Bach_23d_prelude
-da.Bach_24th_prelude

When reading this page, the Tonal analysis procedure opens each data file and picks up the Bol Processor score it contains. To facilitate this, the Batch processing option can be checked in the settings.

In the batch-processing mode, the machine will not display the full set of scales for each piece of music analysed. If the score contains a specification for a tonal scale — a _scale(some_scale, 0) instruction — the list of preferred scales will be displayed down to the specified one. If the specified scale is the first in the ranking, then the next two following scales are listed. If no scale is given, only the 10 best matching scales are listed:

Batch processing of “-da.index_preludes_book_I”
Items #2 and #3 contain the specifications of tonal scales sauveur and Dbmaj respectively.
This preference is confirmed by the analysis of item #2 but it is not the case with item #3.

At the bottom of the page, a SHOW RESULTS button displays a downloadable HTML file containing all the results:

End of batch processing. Clicking on SHOW RESULTS displays the entire result set.

The HTML page also shows the settings for the analysis, and can be downloaded, along with a CVS file of the same figures, which is suitable for statistical graphing.

The results of the analysis of all the preludes and fugues of The Well-tempered Clavier are published and discussed on the page Bach well-tempered tonal analysis.

How far does it matter?

Most temperaments used in Baroque music modify pitches by a small number of cents. While there is theoretical interest in selecting them via a systematic analysis of scores, we may wonder whether a human audience would appreciate the improvement. Wouldn't it be good enough to tune all harpsichords using equal temperament?

A recent article in the non-specialised French journal Le Canard Enchaîné (19 August 2026, p. 7) suggests that the appropriate choice of temperament is highly significant.

[…] That evening, in the cathedral, they performed the programme “Erbarme dich” (“Have mercy”) […] offering an elegant and refined vision of Bach’s music.
A quick tuning adjustment, and off they go — never mind that the harpsichord had been tuned in Vallotti temperament, the most even of the unequal temperaments. As a result, the dramatic effects intended by Bach, who chose his keys according to the colour of the chord, were sometimes softened — especially as some pieces had been transposed to suit the transverse flute.
The evening was not yet over when some members of the audience were already leaving. […]

Analysing the Erbarme dich mein Gott score for flute, piano and organ with the same settings as Les Ombres errantes (including 6/5 minor thirds and 9/8 major seconds) yields a classification in which the Sauveur temperament (see image) comes first with a score of 64,394, whereas the Tartini-Vallotti temperament (see image) comes 13th with a score of 43,951. However, this comparison is invalid if some pieces were transposed, as mentioned in the article. The important outcome is that the audience noticed the mismatch, and even walked out!

Does it apply to Western classical music?

The analysis of tonal intervals and their correspondence to documented tuning systems (temperaments) makes sense in the context of Baroque music, assuming that composers and instrument tuners sought to achieve maximum consonance in the performance of their musical repertoire. The question remains whether it is equally reliable (and useful) for the analysis of musical works from more recent periods.

Matching Beethoven’s Fugue in B flat major against documented scales

The best score — once again — is that of Sauveur's temperament, mainly because of the ascending melodic intervals. If performers are trying to achieve ratios 9/8, 6/5, 5/4 and 3/2, then ‘sauveur’ may be the best representation of the "tuning scheme" they have in mind.

The equal temperament scale comes last, with scores of 3529, 1680 and 240 for ascending melodic, descending melodic and harmonic intervals respectively. Part of the explanation lies in the comparison of the two scales as a background to the harmonic intervals:

Comparison of the equal temperament scale (left) and Sauveur's temperament (right) for the performance of Beethoven's Fugue in B flat major.

The most obvious difference is the use of almost perfect harmonic major thirds (ratio 5/4) on Sauveur's scale (see image) instead of Pythagorean major thirds (approximately ratio 81/64) on the equal tempered scale (see image). The former have been assigned weights (+1) and the latter (-1). Yellow background lines indicate that these intervals are used quite frequently.

Melodic intervals in Beethoven’s Fugue in B flat major

One drawback of Sauveur's scale is the wolf fourth 'D#' - 'G#' (approx. 477 cents), but this interval does not occur frequently in the score.

Many other observations could be made, comparing the values of the melodic intervals, and the whole process (which took almost 8 minutes) could be started again with different settings of the weights, giving more or less importance to certain intervals. After all, we do not know whether an expert player of a string instrument would play minor thirds at intervals of 6/5, 32/27, tempered, or some other value, and even more so, whether these values depend on the harmonic/melodic context of each musical phrase.

This suggests that we shouldn't get too excited about a (still primitive) tonal analysis tool when it comes to sophisticated tonal material…

Beethoven’s Fugue in B flat major performed by BP3 in Csound with Sauveur's temperament.

Reference

Asselin, P.-Y. Musique et tempérament. Paris, 1985, republished in 2000: Jobert. Soon available in English.

➡ Musicians interested in continuing this research and related development can use the current version of Bol Processor BP3 to process musical works and implement further tuning procedures. Follow the instructions on the Bol Processor ‘BP3’ and its PHP interface page to install BP3 and learn its basic operation.

Microtonality

This article focuses on the Bol Processor as a tool for creating and manipulating musical scales beyond the standard twelve-tone equal temperament. It details how the software handles real-time MIDI and Csound for microtonal tuning, explaining concepts like just intonation and various historical temperaments such as Zarlino's and BACH temperament. The article also discusses the implementation of scales with more than 12 degrees, referencing ancient Indian musicology’s grama-murcchana model and demonstrating how to compare different tunings. Ultimately, the document showcases the software's flexibility in manipulating scales, and its utility for both musical composition and musicological research.
A technical description of the implementation of microtonality in the Bol Processor is found on this page: Microtonality: how it works.

A just-intonation tuning scheme (presumably) used in Western harmony
(Image created by Bol Processor)

Microtonality is a topic addressed by many musical systems that deal with tonal intervals: the use of microtones — intervals smaller than a semitone, also called "microintervals". It can also be extended to include any music that uses intervals not found in the common Western tuning of twelve equal intervals per octave. In other words, a microtone can be thought of as a note that falls between the keys of a piano tuned to equal temperament (Wikipedia).

All examples shown on this page are available in the sample set bp3-ctests-main.zip, which is shared via GitHub. Follow the instructions on page Bol Processor ‘BP3’ and its PHP interface to install BP3 and learn its basic operation.

👉  BP3 is able to handle microtonality in real-time MIDI as well as in Csound. — read the Check MIDI microtonality page for practical details.

A brief presentation

On electronic instruments such as the Bol Processor, microtonality is a matter of "microtonal tuning", here meaning the construction of musical scales alien to the conventional one(s).

Equal temperament is an intuitive model that divides the octave (frequency ratio 2/1) into 12 "equal" intervals called semitones. Each semitone has a frequency ratio of 2 1/12 = 1.059. Tonal intervals are generally expressed on a logarithmic scale, which gives the ratio 2/1 a value of 1200 cents. Each semitone is therefore worth 100 cents in a conventional scale system.

An equal tempered scale is useful for making a piece of music sound the same when transposed to another key. However, its intervals do not correspond to the (presumably) "natural" intervals constructed from whole-number frequency ratios using the numbers 3, 4, 5. These simple ratios give the impression of consonance because the frequencies of the upper partials (harmonics) can coincide: if two strings vibrate at a frequency ratio of 3/2 (a "perfect fifth"), the 3rd harmonic of the lowest vibration is at the same frequency as the 2nd harmonic of the higher vibration.

In an equal tempered scale, the harmonic major third (C-E) of 400 cents has a ratio of 1.26 instead of 1.25 (5/4). The major fifth (C - G) also sounds slightly "out of tune" with a ratio of 1.498 instead of 1.5 (3/2). These mismatches can produce beats that are considered unpleasant in harmonic contexts.

When tuning stringed instruments (such as the piano), octaves can be stretched a little to compensate for a slight inharmonicity of the upper partials produced by vibrating strings (in higher octaves), as advocated by Serge Cordier. A value of 1204 cents sounds fair, with the added advantage of making fifths sound "perfect" in a 3/2 ratio. With this setting, the frequency ratio of the stretched octaves is 2(1204/1200) = 2.0046. This effect can be reproduced in electronic instruments such as digital pianos that imitate mechanical ones. We will see how it can be implemented in the Bol Processor BP3.

Cembalo Cromatico (University of the Arts Bremen). A 19-key-per-octave instrument with electromechanical commands.

Musicologists agree that equal temperament was never exactly achieved on classical instruments such as pipe organs and harpsichords. Rather, instrument tuners have developed rules for reproducing the most pleasing intervals in particular musical contexts. In other words, a mechanical instrument should be tuned according to a style and repertoire of music. Pierre-Yves Asselin (2000) has published a detailed compilation of tuning techniques used by European musicians and instrument makers over the past centuries — listen to examples on the page Comparing temperaments. The same flexibility can be achieved with sounds produced by "algorithms".

Outside of Western classical music, a wide variety of tonal systems deliberately reject 12-tone-per-octave tonality. Arabic-Andalusian music is often described as a "quartertone" system, which divides the octave into 24 intervals. Equal tempered scales of 7 degrees have been identified on various traditional African instruments. The grama-murcchana theoretical model of tonal music in India claims the use of 22 shruti-s, presumably microintervals of unequal size (see below).

Many unconventional systems have been invented and applied to contemporary music, often departing from octave-repeating scales. See for, example, the Bohlen-Pierce scale, which is based on a 3/1 interval (a "tritave") divided into 13 grades/notes — see the MIDI microtonality page. All these scales can be implemented in the Bol Processor.

The scale() operator in Bol Processor BP3

We'll be discussing the use of scales in the context of Csound, although the same is possible in the real-time MIDI and MIDI file environment — read this page. When using MIDI, the machine recognises that MIDI microtonality mode is required as soon as it sees a "scale()" operator. If a tonal resource (a "-to" file) is specified in the grammar or data, all scales listed in the resource will be accessible.

For geeks: Csound scores are flexible in the way they represent tonal positions. A common convention is the octave point pitch class. For example, the note "A4" would be assigned the tonal position "8.09", meaning that it is the 9th note in the 8th octave (in the English convention). This value produces a note at the diapason frequency (usually 440 Hz) on a Csound instrument.
It is also possible to specify the note position by its frequency in cycles per second (cps mode). This allows a high level of accuracy as frequencies are expressed in floating point format. For example, "A4" is equivalent to "440.0". Accuracy better than 1‰ is not noticeable.
As explained on page Csound tuning in BP3, it is possible to send notes in both the octave point pitch class and cps formats to the same Csound instrument.
In fact, microtonal scores will only use cps. The cps mode is also used by BP3 whenever the diapason frequency is not exactly 440 Hz. To make all frequencies visible on Csound scores, for example, set the diapason to "400.01"…

Let us take a simple example to demonstrate the use of multiple scales. The grammar is:

-se.tryScales
-cs.tryScales
-to.tryScales
ORD
S --> _scale(0,0) C4 E4 A4 {8,{C4,E4,G4,C5}} {8,{C4,Eb4,G4,C5}} - _scale(piano,C4) C4 E4 A4 {8,{C4,E4,G4,C5}}{8,{C4,Eb4,G4,C5}} - _scale(just intonation,C4) C4 E4 A4 {8,{C4,E4,G4,C5}} {8,{C4,Eb4,G4,C5}}

In this grammar, the same sequence is repeated three times in different tunings:

  • _scale(0,0) is the default tuning = 12-degree equal-tempered
  • _scale(piano, C4) refers to the "piano" scale
  • _scale(just intonation, C4) refers to a (so-called) "just-intonation" scale

Note "C4" appearing in these operators is the block key, here meaning the key that must correspond to its equal temperament value in the tuning set by the scale.

It may be necessary to listen several times to notice subtle differences:

A musical sequence repeated 3 times in equal-tempered, stretched octave ("piano") and "just intonation"

The sound is produced by the Csound instrument "new-vina.orc" designed by Srikumar Karaikudi Subramanian to imitate the Sarasvati vina, a long-stringed instrument played in South India — listen to his demo: Sarasvati vina. This type of instrument is capable of highlighting the finest tonal subtleties.

Beats are audible in the equal-tempered version, but slightly less so in the piano version, and almost absent in the just-intonation rendering. Looking at the Csound score makes it easy to check theoretical models:

f1 0 256 1 "vina-wave-table.aiff" 0 4 0

t 0.000 60.000
i1 0.000 1.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C4
i1 1.000 1.000 8.04 90.000 90.000 0.000 0.000 0.000 0.000 ; E4
i1 2.000 1.000 8.09 90.000 90.000 0.000 0.000 0.000 0.000 ; A4
i1 3.000 8.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C4
i1 3.000 8.000 8.04 90.000 90.000 0.000 0.000 0.000 0.000 ; E4
i1 3.000 8.000 8.07 90.000 90.000 0.000 0.000 0.000 0.000 ; G4
i1 3.000 8.000 9.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C5
i1 11.000 8.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C4
i1 11.000 8.000 8.03 90.000 90.000 0.000 0.000 0.000 0.000 ; Eb4
i1 11.000 8.000 8.07 90.000 90.000 0.000 0.000 0.000 0.000 ; G4
i1 11.000 8.000 9.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C5

i1 20.000 1.000 261.630 90.000 90.000 0.000 0.000 0.000 0.000 ; dop3
i1 21.000 1.000 329.915 90.000 90.000 0.000 0.000 0.000 0.000 ; mip3
i1 22.000 1.000 440.585 90.000 90.000 0.000 0.000 0.000 0.000 ; lap3
i1 23.000 8.000 261.630 90.000 90.000 0.000 0.000 0.000 0.000 ; dop3
i1 23.000 8.000 329.915 90.000 90.000 0.000 0.000 0.000 0.000 ; mip3
i1 23.000 8.000 392.445 90.000 90.000 0.000 0.000 0.000 0.000 ; solp3
i1 23.000 8.000 524.463 90.000 90.000 0.000 0.000 0.000 0.000 ; dop4
i1 31.000 8.000 261.630 90.000 90.000 0.000 0.000 0.000 0.000 ; dop3
i1 31.000 8.000 311.340 90.000 90.000 0.000 0.000 0.000 0.000 ; mibp3
i1 31.000 8.000 392.445 90.000 90.000 0.000 0.000 0.000 0.000 ; solp3
i1 31.000 8.000 524.463 90.000 90.000 0.000 0.000 0.000 0.000 ; dop4

i1 40.000 1.000 261.630 90.000 90.000 0.000 0.000 0.000 0.000 ; Cj4
i1 41.000 1.000 327.038 90.000 90.000 0.000 0.000 0.000 0.000 ; Ej4
i1 42.000 1.000 436.137 90.000 90.000 0.000 0.000 0.000 0.000 ; Aj4
i1 43.000 8.000 261.630 90.000 90.000 0.000 0.000 0.000 0.000 ; Cj4
i1 43.000 8.000 327.038 90.000 90.000 0.000 0.000 0.000 0.000 ; Ej4
i1 43.000 8.000 392.445 90.000 90.000 0.000 0.000 0.000 0.000 ; Gj4
i1 43.000 8.000 523.260 90.000 90.000 0.000 0.000 0.000 0.000 ; Cj5
i1 51.000 8.000 261.630 90.000 90.000 0.000 0.000 0.000 0.000 ; Cj4
i1 51.000 8.000 313.956 90.000 90.000 0.000 0.000 0.000 0.000 ; Dj#4
i1 51.000 8.000 392.445 90.000 90.000 0.000 0.000 0.000 0.000 ; Gj4
i1 51.000 8.000 523.260 90.000 90.000 0.000 0.000 0.000 0.000 ; Cj5
s

In the Csound score, note names have been automatically replaced with their translations in the definitions of scales piano and just intonation (see below). For example, in the piano scale of this example, 'C4', 'D4', 'E4'… have been replaced by 'do3', 're3', 'mi3' with an additional 'p' marker: 'dop3', 'rep3', 'mip3'…
In the same way, just intonation notes are labelled 'Cj4', 'Dj4', 'Ej4' etc. This renaming is optional since all these scales are made up of 12 degrees with identical key positions, but it is used here to make the Csound score more explicit.

The use of "C4" as a block key means that it is always played at a frequency of 261.630 Hz. Consequently, "A4" is at 440 Hz in the first occurrence and a little higher in the piano version due to the octave stretching with a ratio of 524.463 / 261.630 = 2.0046, which is 1204 cents.

Finally, we notice that, as predicted by the model, the perfect major fifth (C - G) produces the same positions (392.445 Hz) in the piano and just intonation scales.

In reality, the "just intonation" fragment in this example would be out of tune if we follow the framework of tonality proposed by Asselin (2000) and confirmed by an extension of the ancient grama-murcchana system in India. In the last "C minor" chord {C4, Eb4, G4, C5}, the notes "C4", "C5" and "G4" should be lowered by a syntonic comma. This means that playing "just intonation" in Western harmony requires more than a single just-intonation scale: each harmonic context requires its own specific tuning, which indeed cannot be achieved on keyboard instruments. A method for constructing just-intonation scales and using them in Bol Processor music is given on the Just intonation: a general framework page.

Looking at two scales

From the grammar page "-gr.tryScales" we can follow the tonal resource file "-to.tryScales" which contains scale definitions. Csound instrument definitions are contained in "-cs.tryScales", along with the instruction

f1 0 256 1 "vina-wave-table.aiff" 0 4 0

telling the Csound instrument to use the "vina" waveform. From August 2024, tonal resources and Csound instruments are stored in separate files, as microtonality is no longer reserved for Csound.

The following is a representation of the piano scale (Cordier's equal temperament):

The "piano" scale: 12-tone equal-tempered with an octave stretching of 4 cents (see full image).
Note buttons for export/import of SCALA and KBM files.

All the intervals were set in a single click, after entering "1204" as the size of the octave in cents, which set the last ratio to 2.004 (approximately 501/250). The "INTERPOLATE" button was then clicked to calculate the intermediate ratios.

The scale is displayed as a circular graph by clicking on the "IMAGE" link:

The "piano" scale proposed by Serge Cordier. Note that the size of the whole circle is 1204 cents, not 1200!

The display confirms that the position of "G" ("solp") is in the ratio 3/2 or 702 cents. However, the tonal distance between "G" ("solp") and "D" ("rep") is slightly smaller (699 cents), which means that this scale is not a pure cycle of fifths, as the latter would have ended after 12 steps with an octave extended by a Pythagorean comma (scale "twelve_fifths" in "-to.tryScales"):

Cycle of 12 perfect fifths ending with the "last C" one Pythagorean comma higher (approximately 81/80 = 22 cents)

The basekey is the key used to produce basefreq. Here basefreq is set to 261.630 Hz for key #60 which is usually the "middle C" on a piano keyboard. The basefreq parameter has an effect on the pitch which is further adjusted by the value of the diapason entered in "-se.tryScales". If the diapason is set to 430 Hz, the frequency of "C4" would be 261.630 x 430 / 440 = 255.68 Hz.

The baseoctave parameter is not stored in the Csound function table, but it is required by the Bol Processor to name notes correctly. This scale uses the Italian/French note convention, where key #60 is called "do3" instead of "C4". Therefore baseoctave = 3.

Temperament

At the bottom of the "Scale" page is a form for constructing scales in musical temperament. The scope of this procedure is wider than usual because the interface permits the modification of any series of intervals, not just fifths and fourths.

Bol Processor procedures for the production of tempered scales (and all scales in general) can be used both to visualise/hear intervals and chords derived from a theoretical description of the scale, and to check that a procedure for tuning a mechanical instrument conforms to its theoretical description. Below is an example of both approaches applied to Zarlino's meantone temperament (tempérament mésotonique).

The long history of the temperament in European music is covered in Pierre-Yves Asselin's dissertation and publication (2000, p. 139-150). During the 16th and 17th centuries, European musicians tended to prefer "pure" major thirds (frequency ratio 5/4) at the cost of compromising the size of the fifths. This was called the "pure third meantone temperament" (tempérament mésotonique à tierces majeures pures) which was generally achieved by reducing the size of certain fifths by a fraction of the syntonic comma (Asselin 2000 p. 76). After this period, there was another fashion of using perfect fifths (frequency ratio 3/2) and compromising the size of major thirds in the same way. Both methods — and many more — are implemented in the Bol Processor. Algorithmic tuning is indeed easier to achieve than tuning a mechanical instrument!

Zarlino, theory

Let us try Zarlino's meantone temperament (Asselin 2000 p. 85-87) which was popular in the 16th and 17th centuries. It consists of 12 fifths starting from "E♭" ("mi♭") up to "G#" ("sol#") diminished by 2/7 of a syntonic comma — that is 6 cents.

➡ This should not be confused with Zarlino's "natural scale", an instance of just intonation.

Theoretically, this takes two steps from the previously known position "C".

First, we enter the starting note "do" and the sequence of fifths "do, sol, re, sol#," specifying a ratio of 3:2 with a -2/7 comma modification (see picture).

Then we do the same with fourths (descending fifths) starting from "do" ("C") down to "mi♭" ("E♭").

The result is displayed by clicking on the IMAGE link:

Zarlino's meantone temperament (source Asselin 2000 p. 85)

In this temperament, the harmonic major thirds (green connections on the graph) are equal and slightly smaller (384 cents) than the "pure" ones (ratio 5/4 or 386 cents). Semitones between unaltered and altered notes are equal (71 cents). All major tones are equal (192 cents) except "do#-mi♭" and "sol#-sib" (242 cents).

Noticeable dissonances are found in the "sol#-mi♭" fifth (746 cents, i.e. an extra 2 + 1/7 commas = 44 cents) and major thirds such as "sol#-do", "do#-fa", "fa#-sib" and "si-mi♭" which are larger (433 cents) than Pythagorean major thirds (408 cents). Obviously, these intervals are not intended to be used in the musical repertoire to which this tuning is applied…

Zarlino meantone temperament, table of intervals (in cents)

Comparison

A layperson might wonder whether small tonal adjustments — often less than a quarter of a semitone (i.e. 25 cents) — have any noticeable effect on musical works using these tuning systems. Comparative experiments are easy with the Bol Processor.

For example, let us play one (of a billion variations) of Mozart's musical dice game, with tuning options selected by activating a first rule in "-gr.Mozart":

// gram#1[1] S --> _vel(80)_tempo(3/4) _scale(0,0) A B // Equal temperament
// gram#1[2] S --> _vel(80) _tempo(3/4) _scale(piano,0) A B // Equal temperament (Cordier)
// gram#1[3] S --> _vel(80) _tempo(3/4) _scale(Zarlino_temp,0) A B // Zarlino's temperament
// gram#1[4] S --> _vel(80) _tempo(3/4) Ajust Bjust // Just intonation

Musical productions are listed below. The random seed has been set to 998 (in "-se.Mozart") as this variation contains a greater number of chords, and the performance has been slowed down by "_tempo(3/4)".

It is important to remember that of these options, only the first three ones (temperaments) are accessible on fixed-pitch MIDI instruments with 12-degree keyboards. The last one (just intonation) requires a "retuning" of each harmonic content, which is possible if the instrument accepts pitchbender corrections — see page MIDI microtonality.

The first option (equal temperament) is the default tuning of most electronic instruments:

Equal temperament on Mozart's dice game

The second option is an equal temperament with octaves stretched by 4 cents, as advocated by Serge Cordier (see above):

Equal temperament with stretched octaves (Cordier)

The third option is Zarlino's temperament:

Zarlino's temperament

The last option is "just intonation":

Just intonation

Zarlino: a simulation of physical tuning

The tuning of mechanical instruments (such as a harpsichords) requires different procedures from the programming of "tempered" scales on the Bol processor. However, by using the computer, it is possible to quickly verify that the mechanical procedure would produce the expected result. Let us demonstrate this using Zarlino's temperament.

On the computer we had programmed a series of 7 ascending fifths diminished by a 2/7 comma from "do" to "do#". This is impossible to achieve "by ear" on a mechanical instrument. Pierre-Yves Asselin (2000 p. 86) revealed the method shown below.

First step

From "do", tune two successive major thirds. This results in a "sol#" which is positioned at a frequency ratio of 25/16 (773 cents) above "do".

This "sol#" is actually "SOL#+2" of the 2nd order harmonic fifths down series in Asselin's tuning framework (2000 p. 62) — see page Just intonation: a general framework. It is not exactly the one expected on Zarlino's meantone temperament, although it is close. It is labelled "sol2#".

Second step

From "sol2#" tune down a perfect fifth, resulting in "do#".

Be careful to program a perfect fifth, which is specified on the form as "add 0/1 comma". There is also a form for creating series of perfect fifths which can be used for this step.

The resulting "do#" (ratio 1.04166) is exactly 52/3/23, as expected in Zarlino's meantone temperament (Asselin 2000 p. 194).

Third step

Tune 7 equal fifths between "do" and "do#". Equalising fifths is a typical procedure for tuning mechanical instruments. Notes "sol", "re", "la", "mi", "si", "fa#" will be created. Here we specify that all intervals need to be close to the fraction 3/2, even though they will end up as fifths diminished by a 2/7 comma since we clicked the EQUALIZE INTERVALS button.

The missing notes "sol", "re", "la", "si", "fa#" are created. For the existing note "mi", the machine checks that its current position is close to the one predicted by the approximate fraction.

The graph shows that the calculated position of "mi" (ratio 1.248) is slightly different from its previous position (1.25), but this difference is negligible. We keep both positions on the graph, knowing that only one will occur in a physical tuning.

Fourth step

Now tune down 3 fifths from "do" to "mi♭", diminished by a 2/7 comma. This can be done by reproducing "by ear" intervals created in the previous step. Another method is to tune "mi♭" a harmonic major third below "sol" as shown on the form.

Fifth step

Once "mi♭" has been tuned we can tune three equal fifths (in fact diminished by 2/7 comma) between "mi♭" and "do". Again we use the "equalize intervals" procedure. At this stage, the positions of "si♭" and "fa" are created.

The result is shown in the graph below:

Zarlino's meantone temperament designed as a simulation of physical tuning

On this graph, the ratio 1.563 for "sol#" is close (within 7 cents) to 1.557 of Zarlino's temperament. On a mechanical instrument, since "mi" tuned by equalising fifths (3d step) was at position 1.248, adjusting the "mi-sol#" major third to a 5/4 ratio would set "sol#" at a better ratio (1.56).

More temperaments

All the temperaments listed in Asselin's thesis can be easily programmed on the Bol Processor. Take, for example, a classical meantone tuning (Asselin 2000 p. 76), popular in the 16th and 17th centuries, also known as Chaumont (Asselin 2000 p. 109). Its aim is to produce "pure thirds" (ratio 5/4). It consists of a series of fifths from "mi♭" ("E♭") to "sol#" ("G#") diminished by a 1/4 comma. The problem is that the tuning scheme — unlike Zarlino's meantone — does not start from "do" ("C"). There are two solutions.

The first solution is to divide the series of fifths into two parts: first create the series "do, sol, re, la, mi, si, fa#, do#, sol#" of ascending fifths, then the series "do, fa, si♭, mi♭" of descending fifths.

In the second solution, we directly create the series "mi♭, si♭, fa, do, sol, re, la, mi, si, fa#, do#, sol#" of ascending fifths, giving the graph shown below.

Classical / Chaumont meantone tuning positioned on mi♭

This tuning is correct but it cannot be used by the Bol Processor console because of the shift of the reference. Complicated procedures would be required to set the diapason (A4 frequency) to the desired standard and to assign the correct key numbers to the notes of the scale.

Fortunately, this problem is solved in a single click by resetting the base of the scale to note "do", which amounts to a rotation of the graph.

We take this opportunity to replace the Italian/French note convention with the English note convention.

The result is the classic meantone scale tuning which is notable for its large number of harmonic major thirds (circa 5/4, green lines):

The same methods can be used to implement another meantone temperament popular at the same time (16th-17th century) which aims to enhance pure minor thirds (Asselin 2000 p. 83). It can also be described as a series of ascending fifths from "mi♭" to "sol#" with a different adjustment: the fifths are diminished by 1/3 comma.

In this tuning, the minor thirds are sized 316 cents (harmonic minor third, frequency ratio 6/5) with the exception of "A#-C#", "D#-F#" and "F-G#" which are all 352 cents:

Pure minor-third meantone temperament
Source: Asselin (2000 p. 101)

The BACH temperament designed by Johann Peter Kellner for the music of the 18th century (Asselin 2000 p. 101-103) contains two varieties of fifths (see tuning scheme). It is therefore not a "meantone" temperament.

It can be programmed in 3 steps:

  1. A series of descending fifths from "do-sol-re-la-mi", diminished by 1/5 comma;
  2. A series of ascending perfect fifths from "do" to "sol♭";
  3. An ascending perfect fifth from "mi" to "si".

The last interval is a remaining fifth "si-sol♭" ("B-G♭") diminished by exactly 1/5 comma (i.e. 697 cents).

The result is close to Werkmeister III (1691) (Asselin 2000 p. 94), with all positions close to the Pythagorean/harmonic series used for just intonation.

BACH temperament designed by Johann Peter Kellner (18th century)
Werckmeister IV temperament
Source: Asselin (2000 p. 96)

The procedures for tuning temperaments with the Bol Processor sometimes differ from those used for physical instruments. Examples are Werckmeister IV (Asselin 2000 p. 96) and Werckmeister V (p. 99). To tune Werckmeister IV on an instrument (see picture), we start by tuning the sequence G C F Bb Eb Ab Db Gb B E as perfect descending fifths. Then interpolate three fifths (diminished by 1/3 comma) between G and E. Then retune G so that G D becomes a perfect fifth, which reduces C G by 1/3 comma. The same is done on E so that A E becomes a perfect fifth and E B is diminished by 1/3 comma. Similar adjustments are made to retune Bb, and finally Ab and Db to obtain the intervals shown on the picture.

On the Bol Processor the same procedure can be followed if the 1/3 comma correction is replaced by 7 cents. Another procedure is to "add" intervals, which is acceptable on a digital model because of the accuracy. This procedure is automatically summarised at the bottom of the "scale" page:

Werckmeister IV temperament (Asselin 2000 p. 96)
Added fifths down: “do,fa” starting fraction 1/1
Created meantone downward notes “fa,sib” fraction 3/2 adjusted -1/3 comma
Created meantone downward notes “sib,mib,sol#” fraction 3/2 adjusted 1/3 comma
Created meantone downward notes “sol#,do#” fraction 3/2
Created meantone downward notes “do#,fa#” fraction 3/2 adjusted -1/3 comma
Created meantone downward notes “fa#,si” fraction 3/2
Created meantone downward notes “si,mi” fraction 3/2 adjusted -1/3 comma
Created meantone downward notes “mi,la” fraction 3/2
Created meantone upward notes “do,sol” fraction 3/2 adjusted -1/3 comma
Created meantone upward notes “sol,re” fraction 3/2

Werckmeister IV temperament

Let us compare some temperaments on ascending unaltered and descending altered scales…

Equal-tempered tuning, 20th century
Classical (Chaumont) meantone temperament, 16th-17th century
Meantone temperament, pure minor thirds, 16th-17th century
BACH temperament (Kellner) 18th century

Eighteen temperaments described by Pierre-Yves Asselin (2000) have been programmed in the "-to.tryTunings" tonal resource. These can be checked against various musical works, see the pages Comparing temperaments and Tonal analysis of musical works.

As Schlick's temperament is not fully documented, we have set "do-la♭" as a pure major third and "mi-sol#" as a major third augmented by a 2/3 comma. As a result, "sol#" and "la♭" remain distinct.

Tartini-Vallotti temperament (Asselin 2000 p. 104)

Implementations of temperaments in the Bol Processor cannot be used as a reference because (1) errors may have occurred and (2) it is important to know the musical repertoire for which each temperament was designed. See also chapter VIII of Musique et tempéraments (Asselin 2000 p. 139-180) for the history of temperaments and musical examples discussed in terms of instrument tuning.

Tartini-Vallotti temperament: the interval list

Circular graphs show noticeable intervals - perfect fifths, wolf fifths, harmonic and Pythagorean major thirds - in a wide range of uncertainty. For example, in the Tartini-Vallotti temperament shown above, "C-E" is listed as a harmonic major third (green segment), although it is slightly larger (+7 cents) than a "pure" major third (ratio 5/4). The safe way to check that this temperament matches its description is to read the deviations in the interval list (see picture).

D'Alembert-Rousseau temperament with series of slightly larger/smaller fifths

In a few temperaments the sizes of the fifths are not given explicitly, as the tuner is instructed to tune slightly larger (than perfect) or slightly smaller fifths. This is the case in the D'Alembert-Rousseau temperament (Asselin 2000 p. 119), where the series "do, fa, sib, mi♭, sol#" is expected to be slightly larger and "sol#, do#, fa#, si, mi" slightly smaller… In addition, the frame should be "complete", which implies the absence of a remaining comma fraction when closing the cycle of fifths.

In this example, the conditions were met by increasing the slightly larger fifths "do, fa, sib, mi♭, sol#" by 1/12 comma (+2 cents). To complete the cycle, the last series "sol#, do#, fa#, si, mi" was declared as equalised intervals. This resulted in the slightly smaller fifths being reduced by 2 cents to reflect the slightly larger ones. Incidentally, this -1/12 comma adjustment is also the one required to construct an equal-tempered scale.

The whole process of creating a scale is automatically recorded in the Comments section of the "scale" page, for example "d_alembert_rousseau":

D'Alembert-Rousseau temperament (Asselin 2000 p. 119)
Created meantone upward notes “do,sol,re,la,mi” fraction 3/2 adjusted -1/4 comma
Created meantone downward notes “do,fa,sib,mib,sol#” fraction 3/2 adjusted 1/12 comma
Equalized intervals over series “sol#,do#,fa#,si,mi” approx fraction 2/3 adjusted 2.2 cents to ratio = 0.668

It took us about 8 minutes to understand the procedure and another 8 minutes to tune the scale according to D'Alembert-Rousseau…

For a comparison of temperaments applied to several pieces of Baroque music, see the page Comparing temperaments.

The full set of tuning schemes currently implemented on the Bol Processor is presented on this page : https://bolprocessor.org/misc/figs/list-scales.php

More than 12 degrees

We will use a model from ancient Indian musicology to demonstrate divisions of more than 12 degrees per octave. This model is an interpretation of the description of the basic scales (grama) and their transpositions (murcchana) in Bharata Muni's Natya Shastra, a treatise dating from a period between 400 BCE and 200 CE — read the page The two-vina experiment.

The inner wheel of Arnold's model, analogous to the "Ma-grama" of Natya Shastra

The grama-murcchana model and its application to Western harmony is described on the page Just intonation: a general framework. Its application to Hindustani music is presented on the page Raga intonation.

E.J. Arnold (1982) had designed a device to demonstrate the transposition of scales in Bharata's model. The actual division of the octave is 23 steps, but this amounts to having 22 optional positions (shruti-s) since the base note has only one option.

The result can be described as 11 pairs of note positions giving 211 = 2048 possible chromatic scales. Of these, only 12 are "optimally consonant", i.e. with only one "wrong" major fifth, short by 1 syntonic comma (pramāņa ṣruti), which here, for simplicity, is 21 cents.. These 12 chromatic scales are the ones that can be used in harmonic or modal music to experience the best consonance.

Below is a picture of the "grama" scale as displayed by the BP3 editor:

A framework for just-intonation chromatic scales based on the grama-murcchana model in ancient Indian musicology (see full image). The syntonic comma (pramāņa ṣruti) has been set at 21 cents. The note "m4" is not marked.

In this scale we use the conventional Indian sargam notation: sa, re, ga, ma , pa, dha, ni, translated as "C", "D", "E", "F", "G", "A", "B". Note that "re" ("D"), for example, can be found in four positions: r1 and r2 are the two possibilities for "D♭", the first one (256/243) being called "Pythagorean" (derived from five descending fifths) and the second one (16/15) "harmonic" (derived from one descending fifth and one descending major third). Positions r2 and r3 are "D♮" (natural) with r3 being harmonic (10/9) and r4 being Pythagorean (9/8).

Tanpura: the drone of Indian musicians
(manufactured in Miraj)

There are special cases (visible on the wheel model) where m3 is almost superimposed on p1 and m4 with p2, their difference being an inaudible schisma (32805 / 32768 = 1.00112 = 1.9 cents). We use m3p1 and m4p2 to denote these merged positions.

The intervals given in cents are those identified by Western musicologists: the Pythagorean limma (256/243 = 90 cents), the syntonic comma (81/80 = 22 cents) and the minor semitone (25/24 = 70 cents). This shows that a shruti, as described by Bharata, can be of 3 different sizes. However, in its application to Indian music, this model should be rendered "flexible" with a size of the syntonic comma (pramāņa ṣruti) between 0 and 56.8 cents — see page The two-vina experiment.

Clicking on the IMAGE link displays a circular graphic representation of the "grama" scale:

The "grama" scale, an interpretation of the ancient Indian theory of musical scales

Let us play a diatonic scale according to the grama-murcchana model, an occurrence of Western just-intonation scales, and the piano stretched-octave tuning, again with "C4" (or "sa_4") as the block key. The grammar is called "-gr.tryShruti":

S --> _tempo(2) _scale(grama, sa_4) sa_4 r4_4 g3_4 m1_4 p4_4 d3_4 n3_4 sa_5 _scale(just intonation, C4) C4 D4 E4 F4 G4 A4 B4 C5 _scale(piano, C4) do4 re4 mi4 fa4 sol4 la4 si4 do5

Diatonic scales in the grama-murcchana, just-intonation and tempered stretched-octave tunings

The differences are barely perceptible for a simple reason: the first two are identical, since this just intonation scale is a special case of grama-murcchana, while the piano scale is a fair approximation of the former. This can be seen in the following Csound score:

f1 0 256 1 "vina-wave-table.aiff" 0 4 0

t 0.000 60.000
i1 0.000 0.500 261.630 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 0.500 0.500 294.334 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; r4_4
i1 1.000 0.500 327.038 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; g3_4
i1 1.500 0.500 348.753 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; m1_4
i1 2.000 0.500 392.445 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_4
i1 2.500 0.500 436.137 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; d3_4
i1 3.000 0.500 490.556 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; n3_4
i1 3.500 0.500 523.260 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_5

i1 4.000 0.500 261.630 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; Cj4
i1 4.500 0.500 294.334 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; Dj4
i1 5.000 0.500 327.038 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; Ej4
i1 5.500 0.500 348.753 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; Fj4
i1 6.000 0.500 392.445 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; Gj4
i1 6.500 0.500 436.137 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; Aj4
i1 7.000 0.500 490.556 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; Bj4
i1 7.500 0.500 523.260 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; Cj5

i1 8.000 0.500 261.630 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; do4
i1 8.500 0.500 293.811 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; re4
i1 9.000 0.500 329.916 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; mi4
i1 9.500 0.500 349.538 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; fa4
i1 10.000 0.500 392.445 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sol4
i1 10.500 0.500 440.585 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; la4
i1 11.000 0.500 494.742 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; si4
i1 11.500 0.500 524.464 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; do5
s

Let us now listen to the 22 shrutis against a drone ("C" and "G" translated as sa and p4):

S --> scale(grama,sa_4) {9 Full_scale _ _ _ , Drone} - - tempo(3/4) {_retro Full_scale} _ _ _
Full_scale --> sa_4 r1_4 r2_4 r3_4 r4_4 g1_4 g2_4 g3_4 g4_4 m1_4 m2_4 m3p1_4 m4p2_4 p3_4 p4_4 d1_4 d2_4 d3_4 d4_4 n1_4 n2_4 n3_4 n4_4 sa_5
Drone --> _volume(30) Droneseq Droneseq Droneseq Droneseq Droneseq Droneseq Droneseq Droneseq
Droneseq --> {_legato(300) p4_3 sa_4 sa_4 sa_3}

Time structure of the drone sequence (played 2 times)

Note the use of the _retro performance tool to reverse the order of the Full_scale sequence. The _legato(300) command extends the duration of notes up to three times their current duration. This produces a Droneseq sound structure similar to that of the Indian tanpura.

In the sound rendering of this example, a 279 Hz sample waveform of a Miraj tanpura was used to feed the Karplus-Strong algorithm.

The 23 positions of Bharata's grama-murcchana model interpreted as "just intonation"

f1 0 0 1 "tanpura_waveform.aiff" 0 4 0

t 0.000 60.000
i1 1.125 1.125 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 0.000 4.500 196.223 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_3
i1 2.250 3.375 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 5.625 1.125 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 3.375 4.500 130.815 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_3
i1 4.500 4.500 196.223 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_3
i1 9.000 1.000 261.630 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 6.750 3.375 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 10.000 1.000 275.496 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; r1_4
i1 10.125 1.125 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 11.000 1.000 279.159 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; r2_4
i1 7.875 4.500 130.815 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_3
i1 12.000 1.000 290.671 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; r3_4
i1 9.000 4.500 196.223 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_3
i1 13.000 1.000 294.334 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; r4_4
i1 11.250 3.375 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 14.000 1.000 310.032 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; g1_4
i1 14.625 1.125 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 15.000 1.000 313.956 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; g2_4
i1 12.375 4.500 130.815 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_3
i1 16.000 1.000 327.038 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; g3_4
i1 17.000 1.000 331.224 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; g4_4
i1 13.500 4.500 196.223 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_3
i1 18.000 1.000 348.753 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; m1_4
i1 15.750 3.375 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 19.000 1.000 353.201 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; m2_4
i1 19.125 1.125 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 20.000 1.000 367.852 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; m3p1_4
i1 16.875 4.500 130.815 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_3
i1 21.000 1.000 372.038 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; m4p2_4
i1 18.000 4.500 196.223 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_3
i1 22.000 1.000 387.474 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p3_4
i1 20.250 3.375 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 23.000 1.000 392.445 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_4
i1 23.625 1.125 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 24.000 1.000 413.375 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; d1_4
i1 21.375 4.500 130.815 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_3
i1 25.000 1.000 418.608 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; d2_4
i1 26.000 1.000 436.137 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; d3_4
i1 22.500 4.500 196.223 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_3
i1 27.000 1.000 441.632 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; d4_4
i1 24.750 3.375 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 28.000 1.000 465.178 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; n1_4
i1 28.125 1.125 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 29.000 1.000 470.934 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; n2_4
i1 25.875 4.500 130.815 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_3
i1 30.000 1.000 490.556 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; n3_4
i1 27.000 4.500 196.223 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_3
i1 31.000 1.000 496.574 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; n4_4
i1 29.250 3.375 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 32.625 1.125 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 30.375 4.500 130.815 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_3
i1 32.000 4.000 523.260 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_5
i1 31.500 4.500 196.223 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_3
i1 33.750 4.500 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 38.000 1.333 523.260 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_5
i1 34.875 4.500 130.815 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_3
i1 39.333 1.333 496.574 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; n4_4
i1 40.666 1.334 490.556 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; n3_4
i1 42.000 1.333 470.934 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; n2_4
i1 43.333 1.333 465.178 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; n1_4
i1 44.666 1.334 441.632 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; d4_4
i1 46.000 1.333 436.137 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; d3_4
i1 47.333 1.333 418.608 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; d2_4
i1 48.666 1.334 413.375 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; d1_4
i1 50.000 1.333 392.445 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_4
i1 51.333 1.333 387.474 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p3_4
i1 52.666 1.334 372.038 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; m4p2_4
i1 54.000 1.333 367.852 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; m3p1_4
i1 55.333 1.333 353.201 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; m2_4
i1 56.666 1.334 348.753 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; m1_4
i1 58.000 1.333 331.224 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; g4_4
i1 59.333 1.333 327.038 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; g3_4
i1 60.666 1.334 313.956 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; g2_4
i1 62.000 1.333 310.032 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; g1_4
i1 63.333 1.333 294.334 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; r4_4
i1 64.666 1.334 290.671 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; r3_4
i1 66.000 1.333 279.159 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; r2_4
i1 67.333 1.333 275.496 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; r1_4
i1 68.666 5.334 261.630 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
s

Listening to this sequence makes it clear that treating a sequence of shruti-s as a "scale" is iconoclastic for the aesthetics of Hindustani music: most of these notes sound out of tune when played in relation to a drone (the tanpura). As discussed on page The two-vina experiment, the presence of a drone makes it unlikely that mutual consonance in melodic intervals will always prevail over consonance with the drone's upper partials. If the grama-murcchana system has any relevance to the performance of classical ragas — see page Raga intonation — then at the very least the model should be made flexible enough to accommodate the correct intonation in melodic movements.

Scale encoding in BP3 (for geeks)

The PHP Bol Processor interface produces scale encoding and sends it to its C console via a "tonality file" such as “-to.tryTunings”. The console requires the following data in order to calculate note frequencies:

  • The base frequency of C4 (in Herz) (default 261.63 Hz)
  • The number of grades in an octave (default 12)
  • The value of the syntonic comma (default 81/80)
  • The frequency ratio between two octaves (default 2)
  • The base key of C4 (default 60)
  • The tuning ratios of all grades

If available, tuning ratios are provided as integer fractions. Otherwise, floating-point values are provided.

Below are two examples of encodings found in “-to.tryTunings”:

“Abmaj”
/C C# D D# E F F# G G# A A# B C/
c21.506289596715 81 80c
[1 1 16 15 9 8 6 5 81 64 4 3 64 45 3 2 8 5 27 16 9 5 243 128 2 1]

The first line contains the names of notes.

The second line is the value of the comma: 21.5062 cents, i.e. 81/80. (The 'c' are markers for identifying the line.)

The third line contains tuning ratios: 1/1, 16/15, 9/8, etc.

“Zarlino_natural”
/C C# D D# E F F# G G# A A# B C/
[1 1 16 15 9 8 6 5 5 4 4 3 64 45 3 2 8 5 5 3 16 9 15 8 2 1]
f2 0 128 -51 12 2 261.63 60 1 1.067 1.125 1.2 1.25 1.333 1.422 1.5 1.6 1.667 1.8 1.875 2

The second line contains tuning ratios: 1/1, 16/15, 9/8, etc.

The third line is in Csound GEN51 format: https://csound.com/docs/manual/GEN51.html

  • numgrades = 12
  • interval = 2
  • basefreq = 261.63 Hz
  • basekey = 60
  • tuning-ratios = 1, 1.067, 1.125, etc.

In “-to.tryScales” there is an "exotic" example called Bohlen-Pierce (see description):

"Bohlen-Pierce"
c21.506289596715 81 80c
/C Db D E F Gb G H Jb J A Bb B C/
k0 1 2 3 4 5 6 7 8 9 10 11 12 13k
[1 1 27 25 25 21 9 7 7 5 75 49 5 3 9 5 49 25 15 7 7 3 63 25 25 9 3 1]
sp h • • • h h h • • p h h ps
f2 0 128 -51 13 3 261.63 60 1 1.08 1.19 1.286 1.4 1.531 1.667 1.8 1.96 2.143 2.333 2.52 2.778 3

The last line in GEN51 format reads as follows:

  • numgrades = 13
  • interval = 3
  • basefreq = 261.63 Hz
  • basekey = 60
  • tuning-ratios = 1, 1.08, 1.19, … , 2.778, 3.

The 13 grades are named on the second line. Their ratios are given on the fourth line: 1/1, 27/25, 25/21, 9/7, etc.

The fifth line contains information about ratios: "p" stands for "Pythagorean", "h" stands for "harmonic", and "•" stands for neither.

The third line contains the distance in number of keys between the grade and the base key "C". On a standard piano keyboard, if "C4" (key 60) is the base key, the next "C5" will be on key 73, i.e. the conventional position of "C#13". In addition, its frequency will be 3 times the one of C4. Indeed, this tuning would require a keyboard specifically designed to match 13 intervals in its "tritave".

Comparing scales

A scale comparison tool is available on the tonal resource page. Click on COMPARE TONAL SCALES and select the ones that need to be analysed.

Scales are compared 2 by 2, so that a set of n scales gives n2/2 results, which are displayed in tables. The following is a comparison of scales called Amin, Cmaj and equal_tempered. The first two ones are described on the page Just intonation: a general framework.

Comparison of three tonal scales

All comparisons are made on a 12-degree (chromatic) scale, measuring the sizes of perfect fifths — some of which may be wolf's fifths as explained on the just intonation page. The average difference of fifths is calculated by summing the squares of the differences between the sizes of fifths of identical degrees (counted in cents):

D=\ \sqrt{\frac{\sum_{^{i=1}}^{12}\left(fa_i\ -\ fb_i\right)^2}{12}}

The distance between Amin and Cmaj is 8.9 cents and the distance between each of these scales and the equal-tempered one is almost 6 cents.

The second table is the result of a search for the smallest distance when transposing one of the scales by 1 to 11 semitones. Here we see that Amin (see picture) and Cmaj (see picture) are practically equivalent — they are harmonically related — since the difference goes down to 1.2 cents. The best matching version of Cmaj is constructed by transposing Amin up a fifth (7 semitones), thus moving 'C' to 'G'. For details of this procedure, see the section on Creation of just-intonation scales.

This device can be further developed to produce a classification of selected tonal scales highlighting similar/identical tuning schemes.

Another approach to tonal scale comparison is to assess the concordance between a musical work and the full set of documented tuning procedures: read the page Tonal analysis of musical works.

The syntactic model

Settings in "-se.tryOneScale"

The following are guidelines for a correct and useful implementation of microtonal scales in BP3.

We follow simple sequences listed in "-gr.tryOneScale". This grammar is linked to "-to.tryOneScale" which contains a unique just intonation scale with its notes labelled "Cj", "Cj#", "Dj" etc. In "-se.tryOneScale", the Note convention has been set to 0 (English), the 'C4' key number to 60 and the Default block key to 60. All these parameters are important to reproduce the same effects. Read the Check MIDI microtonality page for practical details.

We use the Csound output format to display the frequencies of notes, but the output would be the same using real-time MIDI or MIDI files.

Let us play:

S --> C4 A4 G4

If the diapason is exactly 440 Hz, it produces the following Csound score:

i1 0.000 1.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C4
i1 1.000 1.000 8.09 90.000 90.000 0.000 0.000 0.000 0.000 ; A4
i1 2.000 1.000 8.07 90.000 90.000 0.000 0.000 0.000 0.000 ; G4

The frequencies are not explicit because the default Csound score format uses the octave point pitch-class representation, for example "A4" is the 9th pitch-class or the 8th octave (on a standard MIDI instrument). To make them explicit, we set the diapason in "-se.tryOneScale" to a slightly different value, for example 440.0001 Hz. This will produce:

i1 0.000 1.000 261.626 90.000 90.000 0.000 0.000 0.000 0.000 ; C4
i1 1.000 1.000 440.000 90.000 90.000 0.000 0.000 0.000 0.000 ; A4
i1 2.000 1.000 391.996 90.000 90.000 0.000 0.000 0.000 0.000 ; G4

This is a an equal-tempered scale tuned for A4 = 440 Hz. The same can be achieved by specifying the default scale: _scale(0,0):

S --> _scale(0,0) C4 A4 G4

👉 We could expect the frequency of "C4" to be 261.630 Hz, but the value of 261.626 Hz differs due to the slightly higher diapason. The ratio of the difference is 261.630/261.626 = 1.000015 = 0.026 cents…

Now, let's play with the "just intonation" scale and its specific labels: "Cj4", "Aj"' and "Gj4":

S --> _scale(just intonation, Cj4) Cj4 Aj4 Gj4

This will give almost the same Csound score because the block key "Cj4" is set to 261.630 Hz in the "just intonation" scale definition:

i1 0.000 1.000 261.630 64.000 64.000 0.000 0.000 0.000 0.000 ; Cj4
i1 1.000 1.000 436.212 64.000 64.000 0.000 0.000 0.000 0.000 ; Aj4
i1 2.000 1.000 392.229 64.000 64.000 0.000 0.000 0.000 0.000 ; Gj4

However "Aj4" is different from "A4" because it must fit the ratio 436.212/261.620 = 1.66 = 5/3.

Using "Aj4" as the block key would give:

S --> _scale(just intonation, Aj4) Cj4 Aj4 Gj4

and a sightly different Csound score:

i1 0.000 1.000 263.952 90.000 90.000 0.000 0.000 0.000 0.000 ; Cj4
i1 1.000 1.000 440.007 90.000 90.000 0.000 0.000 0.000 0.000 ; Aj4
i1 2.000 1.000 395.928 90.000 90.000 0.000 0.000 0.000 0.000 ; Gj4

Here, "Aj4" has been set to 440 Hz which is the diapason frequency in the equal-tempered scale. The note "Cj4" has raised, but the ratios are unchanged, e.g. 440.007/263.952 = 5/3.

Rule #1: When parsing a sequence of notes, if a microtonal scale has been specified, the parser will first attempt to match the note against labels in the current microtonal scale. If there is no match, it will try to interpret the note according to the Note convention specified in settings.

For instance:

S --> _scale(just intonation, Cj4) Cj4 Aj4 Gj4 D4 F4 E4

The notes in the sequence "D4 F4 E4" are translated to the corresponding positions in the intonation scale. The result is visible in both the Csound score and the graphic display.

This practice is only relevant to 12-degree tonal scales where positions are equivalent — albeit with slightly different frequency ratios. For example, since the matching is based on key numbers, feeding the "grama" (23-degree) microtonal scale (see above) with "C4 D4 E4" would produce "sa_4 r2_4 r4_4", where r2_4 is close to "C#4" and r4_4 is close to "D4". This makes sense because the key sequence is 60-62-64.

There is currently no generic way of mapping note positions in scales with different divisions. An additional difficulty would be scales with an interval other than 2/1 such as Bohlen-Pierce (see example).

We will show later that rule #1 provides a flexibility that makes it very easy to insert enharmonic corrections in a musical score by selecting one of 12 just-intonation chromatic scales — see the page Just intonation: a general framework.

Rule #2: If the parser cannot identify a note in the current microtonal scale and against the note convention, it will try other microtonal scales previously loaded in the sequence.

Top of the "-gr.tryScales" grammar

This can be demonstrated with "-gr.tryScales". At the top of the grammar are listed the scales that will be sent to the console along with the grammar and instructions. Each scale becomes "active" in the grammar once a _scale() operator has declared it.

Let us try to produce:

S --> _scale(piano,dop4) fap3 _scale(just intonation,69) C4 rep4

Active scales are piano, then just intonation. There are no problems with note "fap3", which belongs to the piano scale, nor with "C4" which is known in the English note convention. As predicted by rule #2, the note "C4" is translated to its equivalent "Cj4" and played in just intonation.

Since the baseoctave of the scale piano is 3 (see the image above), the pitch of "fap3" will be close to that of "F4".

What happens to note "rep4"? If the piano scale had not been activated, this note would be rejected as a syntax error. However, following rule #2, the parser finds it in the piano scale. This results in the key number 74 since baseoctave = 3.

The note is interpreted as key #74 in the just intonation scale, displayed as "Dj5". This can be seen in the Csound score below and in the graphic.

i1 0.000 1.000 349.538 90.000 90.000 0.000 0.000 0.000 0.000 ; fap3
i1 1.000 1.000 263.952 90.000 90.000 0.000 0.000 0.000 0.000 ; Cj4
i1 2.000 1.000 593.891 90.000 90.000 0.000 0.000 0.000 0.000 ; Dj5

As a result, notes found in a sequence are always interpreted as belonging to the scale declared immediately to the left, even if their label belongs to a different scale or note convention.

Therefore, it is not a good idea to mix notes belonging to different scales without declaring the scale before they occur. A "_scale()" declaration is best placed at the beginning of each sequence, especially at the beginning of the right argument of a rule.

References

Arnold, E.J. A Mathematical model of the Shruti-Swara-Grama-Murcchana-Jati System. Journal of the Sangit Natak Akademi, New Delhi 1982.

Asselin, P.-Y. Musique et tempérament. Paris, 1985, republished in 2000: Jobert. Soon available in English.

« Translate