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 Bol Processor 'BP3' and its PHP interface.
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:
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.
When using microtonal scales, this pitch range of ± 200 cents is set automatically by sending an appropriate message to the 16 MIDI channels.
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
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
Be aware that notes with names like C, Db, D, etc. have 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: "key#60" chan 2 scale #7, block key 60, corr 0 cents, freq 261.630 Hz
§ key 69: "key#69" chan 3 scale #4, block key 69, corr 0 cents, freq 440.007 Hz
§ key 62: "key#62" chan 2 scale #7, block key 60, corr 67 cents, freq 305.258 Hz
§ key 62: "key#62" chan 3 scale #4, block key 69, corr -2 cents, freq 293.331 Hz
§ key 69: "key#69" chan 2 scale #7, block key 60, corr 75 cents, freq 459.488 Hz
§ key 60: "key#60" chan 3 scale #4, block key 69, corr -5 cents, freq 260.875 Hz
§ key 72: "key#60" chan 2 scale #7, block key 60, corr 0 cents, freq 523.260 Hz
§ key 72: "key#60" chan 3 scale #4, block key 69, corr 13 cents, freq 527.204 Hz
The second (key 62) and last (key 72) notes are identical, but because they belong to different scales, their frequencies are not identical. 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.
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:
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:
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
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
Listen to the same scale played against a drone (read the Microtonality page):
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.