If you need to start XAMPP automatically after a reboot, here's a basic way to do it using systemd, which is the init system for most Linux distributions:
1) Create a systemd service file
Open a text editor to create a new file, for example:
sudo nano /etc/systemd/system/xampp.service
Add the following content to the file:
[Unit] Description=XAMPP Control Panel After=network.target
In May 2024, the Bol Processor BP3 acquired the ability to manage the input and output of MIDI events. This allows it to "communicate" in real time with external MIDI devices (keyboards, synthesizers) and even with other instances of BP3 running on the same machine.
For geeks and programmers: This feature had already been implemented in the earlier (MacOS only) version called 'BP2'. However, the implementation in a C language 'console' to work in MacOS, Linux and Windows environments was more technical. In addition, the concept of "real time" in the current MIDI setup is different from the previous one using Opcode Music System.
The following examples will work exactly the same in MacOS, Windows and Linux. They have been tested on a recent PowerBook running MacOS (Sonoma), and an HP Intel Core computer running Windows 10 (64-bit) and LinuxLite 7.0 (in Ubuntu).
Setting up the MIDI environment
Let us assume that you have successfully downloaded, installed and compiled the Bol processor BP3 as described on the page Bol Processor ‘BP3’ and its PHP interface.
In Bol Processor jargon, a 'project' is either a grammar (with a '-gr' prefix) or a set of data (with a '-da' prefix). So, create or load a simple project, e.g. "-da.acceleration" which can be found in the "ctests" folder (download it here).
An output
By default, a project is set up to create MIDI files, as shown on the selector. Make sure your project is working! Then select Real-time MIDI and click SAVE format.
The selector will now display a different image, as shown below:
By default, the MIDI output used for sending events is numbered '0' and the MIDI input used for receiving events is numbered '1'. This is a common situation. In MacOS and Windows, these numbers are taken as 'ports'. In Linux they are considered as 'clients', each 'client' having its own 'ports'… Never mind the difference, BP3 will take care of it when trying to connect to real or virtual devices!
We cannot rely on port numbers alone because they change when we turn on and off MIDI devices connected to the computer. The client number is more specific to a MIDI device. But the only reliable identification is its name, which is empty by default: the next field after the input/output number.
Let us first check the MIDI output. Windows does this automatically. The good news is that Windows 10 (and presumably later versions) comes with a built-in MIDI device called the Microsoft GS Wavetable Synth. The Bol Processor will automatically detect it and connect to it if no other device is connected to the system.
Linux also connects, by default, the output to a virtual device whose client number is 0, but it won't produce any sound in the basic installation of Ubuntu. So, to try real-time MIDI on Linux, you need to connect an external MIDI device via its USB/MIDI interface, or to install a software synthesizer.
To connect external MIDI devices to Windows, you may need to install an environment similar to IAC on MacOS. Read details below. However, the tests shown on this page can be performed on Windows without any additional installation.
The following paragraphs are for MacOS users. Windows and Linux users can jump to the next section.
Turn on a MIDI device (synthesizer, piano, etc.) connected to the computer. On my personal Mac, I usually use the Pianoteq synthesiser, which produces a physical model synthesis of various keyboard instruments. It communicates with BP3 via a device called the Inter-Application Communication (IAC) architecture — read this if you need details.
The IAC driver is installed by default on recent MacOS systems. (It is a part of the CoreMIDI framework provided by Apple.) It allows you to create virtual MIDI devices that enable MIDI applications to communicate internally within the same machine without requiring external MIDI hardware. Equivalent devices exist in the Linux and Windows environments, see below.
The IAC also communicates with external MIDI devices via the USB ports, BlueTooth and possibly more network protocols. We'll try it later.
To set up the IAC, run the Audio MIDI Setup application (in the Utilities folder). Ask it to show "MIDI Studio". On my personal computer, it looks like this: the IAC driver, the Pianoteq synthesiser, a Pocket Key 15 keyboard connected to a USB port, and a Yamaha piano connected by standard MIDI cables and a USB MIDI interface. The Yamaha piano appears grey because it is switched off.
On active MIDI devices you will see triangles indicating input/output ports. These are used to connect devices directly by drawing a 'cable' to connect them. We don't need to use these 'connectors' as BP3 communicates via the IAC MIDI ports.
Check output options
(MacOS, Linux and Windows)
The easiest way to proceed now is to run any project in the Real-time MIDI mode, and see if sounds are produced… Whatever the result, at the end of the (potentially silent) performance, you will see a Show all … messages button along with a blinking red signal "=> 1 warning". Click on the button to read detailed explanations of the failure (or success):
🎹 Setting up MIDI system MIDI output = 0: “Bus 1” 👉 the number of your choice MIDI output = 1: “Bus 2” MIDI output = 2: “Pocket Key 25” MIDI input = 0: “Bus 1” MIDI input = 1: “Bus 2” 👉 the number of your choice MIDI input = 2: “Pocket Key 25” BP3 will be interactive Warning: name of MIDI source or/and output changed (see above)
(For MacOS users)
This all makes sense given the Audio MIDI Setup shown above. The Bol Processor scanned all output and input MIDI ports. Given port '0' as an output by default, it assigned it to "Bus 1" which the 'port' set up in IAC. It also assigned MIDI input to port '1', but we won't need this immediately.
If your synthesiser happens to be connected to "Bus 1", you will hear sounds and the problem is solved. Let us suppose that you are running Pianoteq and hear nothing. Open the settings of Pianoteq and select "Devices". All you have to do is check "IAC Driver Bus 1". You might also check other inputs, including Pocket Key 25 if you want to connect your keyboard directly to Pianoteq, but these are extra procedures.
Opening Pianoteq settings informed us that it is communicating with IAC, and it suggested to use a IAC 'Bus' for this communication. The 'Bus 1' port is technically called a virtual port.
Screenshot
All you need to do to ensure that the connection remains correct when more devices are switched on/off and MIDI port numbers change. The solution is to write the name "Bus 1" as the MIDI output. In the same way, you can write "Pocket Key 25" (or whatever is detected as your input MIDI device) to the MIDI input, as we may use it later. Note that MIDI port numbers are now irrelevant, as names take precedence. BP3 will correct them automatically.
Click the SAVE MIDI ports button to store this setting.
To the right of the MIDI port name is another empty field where you can enter a comment. For example, write "Pianoteq synth" to the right of "Bus 1".
Let us now switch on a Yamaha piano which is connected via a USB MIDI interface. The interface I use has a green light that indicates it has power. However, if the piano is actually communicating with it, we should see a flashing red light. In MacOS, have found that sometimes it is necessary to restart the computer after switching on the piano… But in Windows and Linux the red light flashes immediately.
As soon as the red light flashes, open the Pianoteq settings. Great! We can now see that the piano is recognised and connected. The easiest way to connect it to the BP3 is to delete the MIDI output name "Bus 1", click SAVE, then PLAY. Whatever happens, we'll get a warning and see the following diagnosis:
MIDI input = 1: “Pocket Key 25” MIDI output = 0: “???” 🎹 Setting up MacOS MIDI system MIDI output = 0: “Bus 1” 👉 the number of your choice MIDI output = 1: “Bus 2” MIDI output = 2: “Pocket Key 25” MIDI output = 3: “USB MIDI Interface” MIDI input = 0: “Bus 1” MIDI input = 1: “Bus 2” 👉 the number of your choice MIDI input = 2: “Pocket Key 25” 👉 the name of your choice MIDI input = 3: “USB MIDI Interface” BP3 will be interactive Warning: name of MIDI source or/and output changed (see above)
As the MIDI input is identified as "Pocket Key 25", it is correctly connecting to port '2.' But the Yamaha piano is identified as "USB MIDI Interface". This is the name we need to copy to the MIDI output, then SAVE MIDI ports and PLAY.
We hear the output on the Yamaha piano, although port numbers are incorrect on the interface. The port numbers (and names) will be fixed as soon as you save or reload the project (data or grammar).
Why does the name "Yamaha piano" appear in Pianoteq settings, but not in the MIDI ports scanned by BP3? This is a mystery that experienced users of a MIDI studio could probably solve…
An input
Setting up an input follows exactly the same protocol as setting up the output. For example, we can set up the input on "Pocket Key 25” as shown above. “USB MIDI Interface” (the Yamaha piano) is another possible choice. Let us continue with Pocket Key 25.
Windows users can simply plug their external MIDI keyboard (e.g. "Pocket Key 25”) to a USB port of their computer, as it will be automatically recognised and set up by the system.
Connecting an input to BP3 is of little interest if BP3 does nothing with input events. The instructions it can handle are listed in the section List of scripts for dealing with real-time MIDI below. "Wait for note…" means that BP3 will stop playing until it receives a NoteOn of the note in question — even with velocity zero.
The script command tells that the performance should start when note C3 is received on MIDI channel 1. To avoid any confusion about octave numbers, I have written the name on the lowest key of my Pocket Key 25 (see photo). This confusion is made worse by the fact that the Italian/Spanish/French convention uses lower octave numbers!
So, the labelled key is the one we need to press to start this show. Let's try it…
When the PLAY button is clicked on the Data page, a flashing STOP button is displayed. The machine would wait forever unless the correct MIDI event has been received. The STOP button — or the PANIC button at the top right — can be used to abort the process cleanly. If all goes well, pressing the C3 key should produce this sound:
Harm Visser's '-da.acceleration' example
Notice that the _transpose(12) instruction plays notes one octave higher!
(This little "acceleration" piece was composed by Harm Visser to illustrate the period notation. Read his tutorial.)
Multiple interruptions are of course possible. Try this:
Now the machine will start its performance after receiving a NoteOn of C3. It will then stop after three beats and wait for a NoteOn of C4. A noteworthy detail is that one second after an interruption, AllNotesOff is sent to all MIDI channels and the pedals are set to off. This prevents notes waiting for their NoteOff from being heard. This "All Notes Off" feature can be turned off in the preferences file.
MIDI input filters
Let us work with the continuous improvisation "Mozart’s musical dice game" (called "-gr.Mozart" in the "ctests" folder). If this project is set for real-time MIDI, the improvisation will not stop until we click on the STOP or PANIC button. Inserting as "wait for note…" at the beginning would of course stop the performance at the beginning of every variation. Beware that you will have to write "do2" instead of "C3" due to the note convention!
But let's try something else, using the external keyboard (the Pocket Key 25 or Yamaha piano) to play notes on top of the performance. How strange! We don't hear any notes played on the external keyboard unless it's connected directly to the output device.
The reason for this becomes clear after clicking on the FILTER button for MIDI input 2:
All types of MIDI events are listed along with how they are processed by BP3. Here we are only interested in NoteOn/NoteOff events. The default setting is '1', which means that they can trigger script commands, but are not forwarded to the MIDI output. This is why 'do2' was able to start the performance, although we could not hear it.
To play notes over the performance, we need to set the status of NoteOn and NoteOff to '2'. Note: If we only set the NoteOn status, BP3 will automatically set the NoteOff status to avoid confusion. Once you have changed the settings, click SAVE MIDI ports, then PRODUCE ITEM(S).
Since the Pocket Key 25 keyboard sends only NoteOn/Noteoff messages, we could as well set other event filters (KeyPressure, etc.) to '0'.
These filter settings are stored, together with the MIDI port names or numbers, in a temporary file whose name depends on both the session number (created by your browser) and the project name. A copy of these settings is stored in the (permanent) folder "midi_resources". This storage makes it possible to launch several instances of BP3 on the same browser or on different browsers, as we will now see.
Several BP3s performing and communicating
From the previous description of interactions via MIDI events — limited for the time being to waiting for a particular note — you may have guessed that a great feature of the Bol Processor BP3 environment is the possibility of running several BP3s, on different machines, or even on a single machine and the same browser… in cooperation with real humans playing MIDI instruments!
Each instance of BP3 can be thought of as a 'musician' with their own compositional skills embedded in a grammar or data (a set of pre-composed musical fragments). We are working on interactions that will allow each musician to modify the behaviour of another musician's grammar, for example by changing rule weights — which may result in some rules being suppressed while others are activated — or changing metronome settings if they want to play faster/slower, etc. All these features were part of earlier versions (BP2) several decades ago!
Let us start with an extremely simple example using the "wait for note…" script.
Create two projects that contain only data, for example "-da.Beatrix" and "-da.Alan":
Note that these melodies do not contain the same number of notes, but they will have the same duration (2 beats) because of their polymetric structures.
We want Alan's performance to start precisely after the last note of Beatrix's performance. As we don't want E4 to overlap with F3, we have put a silence '-' before F3.
To manage the interaction in MacOS, we need an additional IAC port which is (automatically) named "Bus2". To do this, open Audi MIDI Setup and click on the IAC driver. Then add a port (see picture). You can create as many ports as you wish.
Set both Beatrix's MIDI output and Alan's MIDI input to "Bus2".
Now we want to hear both performances. Alan's MIDI output is sent to "Bus1" and will therefore be audible on the Pianoteq synthesiser.
Windows and Linux users can connect the two performers more easily: send both Beatrix's and Alan's messages to the external MIDI device, and connect Alan's input to the same MIDI device. But… the input filter should receive events and not forward them to the output, which is the same device, otherwise the loop will produce a disastrous bouncing effect!
Back to MacOS, there are two ways to send Beatrix's performance to the Pianoteq synthesiser:
Pianoteq settings make it possible to listen to both "Bus1" and "Bus2" virtual ports.
You can set up the MIDI event filter on Alan's project to route input NoteOn/NoteOff events to the current MIDI output. See above for filters.
To play the performance, click PLAY on Alan's project so that it is ready to perform. Then click PLAY on Beatrix's project. This is the result:
Two phrases played in sequence by two instances of the BP3 (Beatrix & Alan).
No doubt this sounds rather unmusical! In fact, we only publish tasteless technical examples to encourage musicians to compose interesting pieces! 😀
Checking the time accuracy
Let us check that the real-time synchronisation is not affected by delays. We'll now ask Alan and Beatrix to play the same piece of music (one octave apart) in the same time.
In MacOS, Alan will send MIDI events to "Bus2". Beatrix will listen to "Bus2" and send MIDI events to "Bus1" (Pianoteq). Beatrix will have a filter that routes the received events to the output. The Pianoteq synthesiser will be set to listen to "Bus1" only.
To start the performance, first click on the PLAY button of Beatrix's project, then on the PLAY button of Alan's project.
Have you noticed that Beatrix is waiting for E3, which does not appear in Alan's score? Oh yes, it does! There is a _transpose(12) command that changes E2 (the first note) to E3. So, it works. This is the performance:
Two superimposed performances (one octave apart), played by two instances of the BP3 (Beatrix & Alan).
Not too bad? Despite the lack of musical interest, we must admit that the superimposition is technically acceptable, even if it is not perfect: there is a delay of about 60 milliseconds on the first note, the time it takes Beatrix's machine to detect that it has received a NoteOn for C3. The subsequent notes are programmed to compensate for this delay, but there are still discrepancies (which can be quantified on the Pianoteq MIDI input). They seem to be caused by delays outside BP3.
You can adjust the delay in Beatrix's project settings. There is a parameter called "Sync delay", which is the number of milliseconds Beatrix's output events should be postponed after the synchronisation. We currently find that 380 ms is a good value.
In fact, the superimposition would sound even better if both performances were triggered by the same event, such as the conductor pressing a key on the external keyboard. This exercise was only intended to show that synchronisation between "virtual musicians" works well.
Working with multiple MIDI inputs
In the previous example, we could decide that Alan's performance will start when he receives a particular note from the Pocket Key 25 keyboard. In this case, we need to click on both START buttons, putting both 'musicians' in wait mode, and the performance will not start until the correct key is pressed on the keyboard.
This case is manageable with single inputs on each instance of BP3. More complicated cases, however, require external 'actors', such as a Pocket Key 25 keyboard sending to all the 'musicians' synchronisation messages, or messages modifying parameters in grammars, changing the metronome value, etc.
To achieve this, the Bol Processor is a able to manage multiple MIDI inputs.
The new game is as follows: both Beatrix and Alan will take turns playing variations of Mozart's musical dice game (see '-gr.Mozart'), one octave apart. They will use the Improvise mode to continue throwing the dice and creating unheard variations. But they will wait for a signal from the other to start playing a new variation.
In short, both musicians will use the same grammar, with only a small change for mutual synchronisation. Their settings must be carefully adjusted:
Select Italian/Spanish/French as a note convention
Check Non-stop improvise
Adjust Pclock = 3 and Qclock = 11 to get the same metronome speed of 220 bpm
Set Sync delay to 380 ms
We do't want both musicians to repeat the same variations. So, set the Seed for randomization to different values, for instance '1' and '2'. Or set it to zero to instruct the machine to seed the random sequence with an arbitrary number of its choice.
In the current version of BP3, the easiest way to send a signal is to send a note with a velocity of zero, which will therefore go unheard. So we need to change the grammar to add these particular notes.
In fact, the same notes should never be part of the score, so that the signal is really sent at the end. This is easy with Mozart's game, for example we can use C# (do#) for the synchronisation. Below are the tops of the grammars used by Beatrix and Alan.
Beatrix '-gr.Beatrix':
-se.Beatrix ORD gram#1[1] S --> _script(wait for do#3 channel 1) _vel(80) A B _vel(0) do#2 gram#1[2] A --> A1 A2 A3 A4 A5 A6 A7 A8 A1 A2 A3 A4 A5 A6 A7 A'8 gram#1[3] B --> B1 B2 B3 B4 B5 B6 B7 B8 B1 B2 B3 B4 B5 B6 B7 B8 ------------------- LIN [Select rules randomly and apply from left to right] etc.
Alan's '-gr.Alan':
-se.Alan ORD gram#1[1] S --> _script(wait for do#2 channel 1) _vel(80) _transpose(-12) A B _vel(0) do#4 gram#1[2] A --> A1 A2 A3 A4 A5 A6 A7 A8 A1 A2 A3 A4 A5 A6 A7 A'8 gram#1[3] B --> B1 B2 B3 B4 B5 B6 B7 B8 B1 B2 B3 B4 B5 B6 B7 B8 ------------------- LIN [Select rules randomly and apply from left to right] etc.
Again, we put do#4 at the end of Alan's performance because it is played as do#3 (one octave lower) due to the _transpose(-12) instruction.
Now we need to set up the MIDI inputs and outputs. Beatrix will send events to "Bus 1" which is the Pianoteq synthesizer. She will receive events from "Bus 2", use them for synchronisation, and forward them to the output.
Alan will send events to "Bus 2" and listen to "Bus 1" for the synchronisation.
This is all perfect on paper, but who is going to start? We have created a chicken and egg situation, so we need a superpower to start the process! Actually, a real human pressing the do#2 key on a Pocket Key 25 keyboard will do.
The (recent) interface has a Add an input button. We click it on Alan's project and paste the name Pocket Key 25. We also use the comment fields to remember the use of each port:
To start the concert, we'll click START on both projects. The order is irrelevant. Then we'll press a key on the Pocket Key 25. Which key?
If we press the do#2 key, we will certainly trigger Alan's improvisation and the cycle will start. But if we press the do#3 key, nothing will happen because the filter of the Pocket Key 25's input, by default, does not transmit NoteOns to the output. So Beatrix won't hear it… By setting NoteOn to status '2' (accept and forward) on this filter, it will be possible to decide who will start the performance: do#2 for Alan and do#3 for Beatrix.
Here we go (starting with Alan):
Alan and Beatrix (two instances of BP3) playing variations of Mozart's musical dice game
👉 This simple show should convince musicians to create "virtual bands" of BP3s playing different grammars and sending specific synchronisation signals according to which variation has just been produced. Along with human performers who join in the fun!
The "virtual musicians" can be on the same computer or remotely connected via network (BlueTooth) or MIDI cables and USB interfaces. If they are on the same computer, they can be run on different browsers and/or the same browser. In the latter case, BP3 will not allow the same project (grammar or data) to be run in the same session.
The number of MIDI inputs in a project is currently limited to 32. It is very unlikely that a musician will need more!
Synchronise to a sequence (or list) of notes
The following expression
gram#1[1] S --> _script(wait for C3 channel 1) - _script(wait for E3 channel 1) etc.
synchronises the production to the sequence of notes C3 E3 (whatever the duration and velocity). This creates interesting situations where a "virtual musician" is expected to start playing after receiving a signal (C3) from one partner, then a signal (E3) from another partner.
Note that there is a silence '-' between the two script instructions. If there is no silence, then BP3 will resume playing if either C3 or E3 has been received.
Remember that because of the MIDI channel specification (range 1 to 16), the detection of signals can be very selective. They are also inaudible when transmitted by NoteOns with velocity zero.
Crashing the band!
In the example of Alan & Beatrix playing Mozart, the connection seems to create a loop: Beatrix sends events to Pianoteq and Alan (bus 1), who in turn sends events to Beatrix (bus 2). Isn't that dangerous?
The reason it doesn't crash is that Alan's input "fromBeatrix" (Bus 1) is filtered: NoteOns are received and processed (for synchronisation), but not passed to the output (Bus 2), i.e. to Beatrix. You can try to change the filter of input "Bus1" on Alan's project, setting NoteOns to status '2' (treat + pass): you will get a superb crash after a flood of notes! ➡ This won't happen on Linux, because its MIDI driver has been equipped with an anti-bouncing mechanism. The same will soon be implemented on MacOS and Windows.
Working with multiple MIDI outputs
The Bol Processor accepts up to 32 MIDI outputs.
Example of a project using two inputs and two outputs:
A setup with two MIDI outputs and two MIDI inputs
The procedure for adding outputs is the same as the one for adding inputs: click on the Add an output button, then enter the name of the MIDI device if you know it exactly, otherwise leave it blank and let the machine connect it by default to the next available output, while suggesting other options:
🎹 Your real-time MIDI settings: MIDI output = 0: “Bus 1” - Pianoteq MIDI output = 3: “USB MIDI Interface” - Yamaha piano MIDI input = 1: “Bus 2” - from Alex MIDI input = 2: “Pocket Key 25” - a small keyboard
🎹 Setting up MacOS MIDI system MIDI output = 0: “Bus 1” 👉 the name of your choice MIDI output = 3: “USB MIDI Interface” 👉 the name of your choice MIDI input = 1: “Bus 2” 👉 the name of your choice MIDI input 1 makes BP3 interactive MIDI input = 2: “Pocket Key 25” 👉 the name of your choice MIDI input 2 makes BP3 interactive
🎶 More MIDI output options were available: MIDI output = 1: “Bus 2” MIDI output = 2: “Pocket Key 25”
🎶 More MIDI input options were available: MIDI input = 0: “Bus 1” MIDI input = 3: “USB MIDI Interface”
Filtering MIDI outputs
In the example above, MIDI output 3 (the Yamaha piano connected to the USB MIDI Interface) has the following filter:
A filter for MIDI output 3
The channel filter specifies that this instrument will receive all MIDI channels except channel 2. Filtering MIDI channels makes it possible to send events exclusively to different instruments.
In this setup, for example, channel 2 events can be sent exclusively to MIDI output 0 (Pianoteq). This allows parts of the musical work to be played by specific instruments.
MIDI events can also be filtered by type. The idea is the same as for MIDI input filters, see above.
Using standard MIDI control
MIDI has standard control messages, namely Start, Continue and Stop, which can be used to coordinate multiple "virtual musicians" (instances of BP3). The advantage is the clarity of the data and the grammars programmed for interactions. The disadvantage is that these messages are not assigned to specific MIDI channels. This can be a problem with a large number of "musicians".
Let us look at a trivial example (of no musical interest), again with Beatrix and Alan playing together. This time, they take turns playing their items (simple sequences of notes). The same approach can be used with grammars where each part is an improvisation, as we have shown with the Mozart example.
In short, he will play three notes (E3 D3 C3), then send a START to Beatrix and wait for a CONTINUE from Beatrix, then on receipt play the final three notes A2 B2 C3.
This is Beatrix's data:
_script(wait for Start) E4 D4 C4 _script(MIDI send Continue)
We'll start the performance with Beatrix. Her machine will wait for START. Then we'll start Alan's part, which will play three notes, then hand over to Beatrix, who will play her part, and return to Alan for the final part…
Start and Continue should be "heard" by Beatrix. Automatically, Stop will have the same status.
This all sounds logical, but it doesn't work! We hear Alan's E3 D3 C3, but then nothing… The first reason is that Beatrix should be able to hear Alan's START command, which is no longer a NoteOn as in the previous examples. This means that the filter of her input "Bus 2", from which she receives Alan's MIDI messages, must be set correctly. The Start event should be received, see picture on the side. Also remember that NoteOn and NoteOff should be received and transmitted to the output (the Pianoteq synth).
Well, now we hear Alan's E3 D3 C3 followed with Beatrix's E4 D4 C4, but then… nothing! 😢
Careful analysis is needed to solve the problem. However, this is simple logic. Remember that Alan is playing on "Bus 2", which is not connected to any MIDI device. If we hear Alan's production, it is because it is received by Beatrix on "Bus 2" and then forwarded to "Bus 1" (the Pianoteq synth). The problem is that the final part A2 B2 C3 is sent to Beatrix, but she has already stopped listening because her own data is finished!
You can imagine a band in which one musician plays an improvisation and then gives a signal to another musician to start their own improvisation, but the other musician has left the place believing that the programme was finished. The solution is to tell the musicians not to leave their places until they receive a STOP signal. Maybe a signal from a conductor (here using the Pocket Key 25 keyboard), maybe a signal from the musician who is in charge of ending the performance. So we'll tell Alan to send a STOP signal at the end of his performance, and Beatrix to wait for Alan's STOP signal. Below are the revised scores.
// Alan E3 D3 C3 _script(MIDI send Start) _script(wait for Continue) A2 B2 C3 _script(MIDI send Stop)
// Beatrix _script(wait for Start) E4 D4 C4 _script(MIDI send Continue) _script(wait for Stop)
The MIDI messages Start, Continue, Stop have been used here to facilitate the reading of scores (or grammars), but these can be replaced by NoteOn with velocity zero on different MIDI channels when working with a larger number of actors.
For geeks: In the Bol processor, scripts are appended to the next following sound object. For example, _script(wait for Start) is appended to note E4 in Beatrix's score. But what about scripts at the end of a score? The secret is that BP3 creates an invisible MIDI event (ActiveSensing) at the end of each element to which it can append the final scripts.
List of scripts for dealing with real-time MIDI
The list below will be kept up to date as there are many scripts on the agenda. These instructions are not case-sensitive.
Input scripts
When a note is specified, be sure to use the same note convention as in the project, e.g. C3 or do2 or sa3, etc.
Wait for note channel c
Wait for a NoteOn of the specified note on channel c (1…16)
Wait for Start
Wait for a Start MIDI message (250)
Wait for Continue
Wait for a Continue MIDI message (251)
Wait for Stop
Wait for a Stop MIDI message (252)
Velocity param Kx = note channel c
Set parameter Kx (0 < x < 128) to the velocity (range 0…127) of the specific note on channel c (1…16)
Control param Kx = #y channel c
Set parameter Kx (0 < x < 128) to the value (range 0…127) of MIDI controller #y (0 < y < 128) on channel c (1…16)
Output scripts
Hold for x milliseconds
Delay all subsequent events by the specified duration x (integer).
Send Start
Send Start MIDI message (250)
Send Continue
Send Continue MIDI message (251)
Send Stop
Send Stop MIDI message (252)
Scripts on top of a grammar
(To be continued)
Alternatives to IAC
Here are the equivalents of Apple's IAC (Inter-Application Communication) for each system:
👉 The following is an explanation from ChatGPT…
Windows environment
On Windows, you can use software like loopMIDI or virtualMIDISynth to create virtual MIDI ports. These tools work similarly to the IAC Driver on macOS:
loopMIDI: Created by Tobias Erichsen, loopMIDI is a popular choice for creating virtual MIDI ports on Windows. It allows you to create and manage several virtual ports which can be used by applications to communicate with each other.
These tools integrate with software applications that support MIDI, providing a seamless way to connect various MIDI applications without needing external MIDI hardware.
Linux environment
On Linux, ALSA (Advanced Linux Sound Architecture) provides capabilities to create virtual MIDI devices through its sequencing API:
snd-virmidi: This ALSA MIDI driver provides virtual MIDI ports for sending and receiving MIDI between applications running on the same system. It's part of the standard ALSA module set and can be configured to provide multiple ports.
To set up virtual MIDI ports on Linux using ALSA, you typically need to load the snd-virmidi module. You can do this by running:
sudo modprobe snd-virmidi midi_devs=1
This command loads the snd-virmidi module and sets it up to provide one virtual MIDI device (you can increase the number of devices by changing the midi_devs parameter). The virtual ports can then be accessed by MIDI applications on the Linux system.
👉 This is done automatically by the "install_bp3.sh" shell script installing BP3 on Linux/Ubuntu (download here).
👉 An earlier version of this page recommended w64devkit. This was a wrong choice, as its downloadable files are signalled with viruses or malicious code.
Look at the warning displayed at the top right of any page of the Bol Processor. In the Windows environment you can read:
Top right warning in Windows environment indicating that a 'gcc' installation is required.
The installation of MinGW will allow "gcc" to run on a Windows machine. This may not be necessary if it has already been installed by another application. In this case, there will be no such warning at the top right of Bol Processor pages:
Clicking on the "run the compiler" link will create the "bp.exe" console. After reloading the page you are ready to use BP3:
👉 The PANIC button is used to get silence when you are running more than one instance of BP3.
If you get a warning that the file may contain malicious code, don't take the risk. Try another file!
Install MinGW-w64:
Open the MinGW file with 7-Zip, telling it to extract files and store them to a folder, by default "x86_64-13.2.0-release-win32-seh-ucrt-rt_v11-rev0" in your Downloads folder.
Save the path to this folder in a text file, for instance (if the user is named "berna"): C:\Users\berna\Downloads\x86_64-13.2.0-release-win32-seh-ucrt-rt_v11-rev0\mingw64
👉 For geeks and expert Windows users: It is not good practice to keep executable files in the Downloads folder, as they may be deleted when optimising disk space. You should move them to a suitable location like other applications. I keep the Downloads location for the demo.
Set up the Environment Path:
Right-click on 'This PC' or 'Computer' on the desktop or in File Explorer, and select 'Properties'.
Click on 'Advanced system settings' and then 'Environment Variables'.
In the System Variables section, find and select the variable 'Path', then click on 'Edit'.
Click on 'New' and add the path to the directory 'bin' of your MinGW-w64 installation, such as "C:\Users\berna\Downloads\x86_64-13.2.0-release-win32-seh-ucrt-rt_v11-rev0\mingw64\bin" if you haven't changed the location.
Click 'OK' to close all dialogues.
Verify Installation:
👉 The BP3 interface does this verification automatically. If ‘gcc’ responds you will be offered to (re)compile the console. The following instructions are for an additional check.
Open Command Prompt (cmd.exe) and type: cd C:\MinGW\bin gcc --version
The first command opens a Unix "shell". The second command should output the GCC version installed and include 'x86_64', indicating it's set up for 64-bit. Ignore the win32 segments you see in file and folder names. They are there to confuse you!
Additional Tips
Choosing a Shell: MinGW-w64 works with standard Windows command prompt and also with more Unix-like terminals like Git Bash or Cygwin if those are already installed.
Using Make: To use 'make' with MinGW-w64, make sure that package 'mingw32-make' is selected during installation. It might be named differently like 'mingw-w64-make' based on the version. You might need to rename 'mingw32-make.exe' to 'make.exe' in the bin directory to make it recognizable as 'make'.
By following these steps, you should be well-equipped to compile 64-bit applications — not only BP3 — using GCC on Windows via MinGW-w64. This setup is useful for developers who need a lightweight GCC environment without needing a full Linux setup or the bulk of Visual Studio.
Kippen, James & Bernard Bel (1989) https://hal.science/hal-00275429v1 Can a computer help resolve the problem of ethnographic description? Anthropological Quarterly, 62 (3): 131-144.
Kippen, James & Bernard Bel (1992) https://hal.science/halshs-00004506v1 Modelling music with grammars: formal language representation in the Bol Processor. In A. Marsden & A. Pople (eds.) Computer Representations and Models in Music, London, Academic Press, 1992: 207-238.
Kippen, James & Bernard Bel (1992) https://hal.science/hal-00256386v1 Bol Processor Grammars. In Mira Balaban, Otto Laske et Kemal Ebcioglu (eds.) Understanding Music with AI, American Association for Artificial Intelligence Press, Menlo Park CA: 366-400.
Kippen, James & Bernard Bel (1992) https://bp3.tech/two-algorithms/ Symbolic and sonic representations of sound-object structures. In Mira Balaban, Otto Laske et Kemal Ebcioglu (eds.) Understanding Music with AI, American Association for Artificial Intelligence Press, Menlo Park CA: 64-110.
Kippen, James & Bernard Bel (1992) https://hal.science/hal-00256385v1 Modelling improvisatory and compositional processes. In Denise Penrose & Ray Lauzanna (eds.) Languages of Design, 1. Elsevier Science Publishers, Amsterdam: 11-26.
Bel, Bernard (1992) https://bp3.tech/time-setting-of-sound-objects/ Time-setting of sound-objects: a constraint-satisfaction approach. International Workshop on Sonic Representation and Transform, Trieste (Italy), 26-30 October.
Bel, Bernard (1998) https://hal.science/hal-00250274 Migrating Musical Concepts - an overview of the Bol Processor. Computer Music Journal, Vol. 22, 2: 56-64.
Bel, Bernard (2001) https://bp3.tech/rationalizing-musical-time/ Rationalizing musical time: syntactic and symbolic-numeric approaches. In Clarence Barlow, (ed.) The Ratio Book. Den Haag: Royal Conservatory - Institute of Sonology: 86-101.
QAVAID
Kippen, James & Bernard Bel (1989) https://hal.science/halshs-00004505 The identification and modelling of a percussion ‘language,’ and the Emergence of Musical Concepts in a machine-learning experimental set-up. Computers and the Humanities, 23 (3): 119-214.
Bel, Bernard (1990) https://hal.science/hal-00275789v2 Inférence de langages réguliers. Journées Françaises de l'Apprentissage, Lannion, France : 5-27.
Modelling music with grammars: formal language representation in the Bol Processor. In A. Marsden & A. Pople (eds.): Computer Representations and Models in Music, London, Academic Press, 1992, p. 207-238.
Abstract
Improvisation in North Indian tabla drumming is similar to speech insofar as it is bound to anunderlying system of rules determining correct sequences. The parallel is further reinforced by the fact that tabla music may be represented with an oral notation system used for its transmission and, occasionally, performance. Yet the rules are implicit and available only through the musicians’ ability to play correct sequences and recognise incorrect ones. A linguistic model of tabla improvisation and evaluation derived from pattern languages and formal grammars has been implemented in the Bol Processor, a software system used in interactive fieldwork with expert musicians. The paper demonstrates the ability of the model to handle complex structures by taking real examples from the repertoire. It also questions the relevance of attempting to model irregularities encountered in actual performance.
Pattern grammars in formal representations of musical structures. 11th International Joint Conference on Artificial Intelligence, Workshop on AI & Music, 20 August 1989, p.113-42
Abstract
This paper introduces several formal models of pattern representation in music. Polyvalent multimodal grammars describe partially overlapping sound events as found in polyphonic structures. Bol Processor grammars are characterisations of sequential events in terms of substring repetitions, homomorphisms, etc. Parsing techniques, stochastic production and recent developments of BP grammars are briefly described.
Time-setting of sound-objects: a constraint-satisfaction approach. Invited paper, Workshop on Sonic Representations and Transforms. INTERNATIONAL SCHOOL FOR ADVANCED STUDIES (ISAS), Trieste, 26-30 October 1992.
Abstract
This paper deals with the scheduling of “sound-objects”, hereby meaning predefined sequences of elementary tasks in a sound processor, with each task mapped to a time-point. Given a structure of sound-objects completely ordered in a phase diagram, an “instance” of the structure may be obtained by computing the dates at which each task should be executed. Time-setting the structure amounts to solving a system of constraints depending on (1) metric and topological properties of sound-objects, (2) contexts in which they are found, and (3) parameters related to the performance itself (“smooth” or “striated” time, speed, etc.). This may require relocating/truncating objects or delaying part of the sound-object structure. A constraint-satisfaction algorithm is introduced, the time complexity of which is O(n.k) in most cases, where n is the number of sequences and k the maximum length of a sequence. In the worst case it remains better than O(n2.k3). Other fields of applications are proposed, including multimedia performance and computer-aided video editing.
Below is the complete set of Preludes and Fugues by J.S. Bach known as The Well-Tempered Clavier, Books II and II, published around 1722 and 1742 respectively.
What was the composer's intention when he used the term "well tempered"?
The matching algorithm selected the tuning scheme(s) that best matched the definitions of 'consonant' and 'dissonant' melodic and harmonic intervals. Two sets of definitions were used: "standard" and " alternative". Obviously, under any hypothesis, some tuning schemes are more suitable than others for achieving the composer's presumed perception of 'consonance'. Therefore, the following sound productions of the Preludes and Fugues, with their "best" tuning schemes, should not be taken as a definitive answer to the question of temperament discussed by Bach's students and followers. They may, however, come closest to what the composer intended, within the limits of the ear's ability to discriminate between intervals.
Note that if several tuning schemes ranked first for matching a piece, only one of them was used for the demo. It is possible that another may sound better.
Settings of an audio unit for the post-processing
All the pieces were played and recorded on a Csound instrument, similar to a harpsichord, allowing a clear appreciation of the tonal intervals. This kind of "magnifying glass" view of the tonal intervals produced harsh sounding versions, available in the Standard (raw) and Alternate (raw) folders. These have been post-processed with a bit of reverb to produce softer attacks. The post-processed sound files are the ones accessed in the tables below. Readers familiar with sound editing are invited to download the raw files and suggest better post-processing options.
The last two columns of each table contain recordings of human interpretations of the same works by outstanding harpsichordists. These explore dimensions of musicality that the mechanical interpretation of the score with perfect tonal intervals could not reach. It remains that the challenge of accurate tonality was a priority for this corpus, as evidenced by the title "well-tempered" given by its composer.
Book I sound examples
These Bol Processor + Csound recordings may be reused under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) licence. Attribution includes links to the present page, to Csound and to the author/editor of its MusicXML score (listed on the Bach Well-tempered tonal analysis page).
➡ Listen with headphones or a very good sound system!
As explained on the Bach Well-tempered tonal analysis page, the D'Alambert-Rousseau temperament was found to be equivalent to H.A. Kellner's BACH in terms of scale intervals.
➡ Listen to the synthesis of Goldberg Variations with Sauveur's meantone temperament. ➡ Listen to the synthesis of Goldberg Variations with D'Alembert-Rousseau temperament. ➡ Listen to the Aria on a harpsichord tuned with Werckmeister III meantone temperament.
In the same period (1730), the French musician François Couperin composed Les Ombres Errantes, for which our tonal analysis suggests a Rameau en sib temperament:
François Couperin's “Les Ombres Errantes” interpreted by the Bol Processor + Csound with a “Rameau en sib” temperament ➡ Image Source: MusicXML score by Vinckenbosch in theMuseScore community
Conclusive remarks
The title of this corpus, The Well-Tempered Clavier, suggests that its composer intended to demonstrate the suitability of one or more temperaments for the performance of musical works in any tonality. As previously stated, this does not imply that they were all intended to conform to the same unique solution; however, it is tempting to hypothesize that the same instrument and tuning scheme were utilized for the entirety of the set. This has led to speculation by J.S. Bach's pupils, who were not instructed on how to proceed. Part of the reputation of great artists in those days was based on the withholding of information.
It would be illogical in the context of human musicians and physical instruments to play a prelude in one tuning and then retune the instrument solely for the purpose of playing the fugue. Consequently, these audio examples are not intended to emulate a genuine performance. They can, however, assist in evaluating the suitability of a preferred tuning scheme for each musical work.
A "deaf musicologist" employs a method of tonality assessment that involves measuring melodic and harmonic intervals in terms of frequency ratios. The results of this assessment depend on the values (weights) assigned to certain ratios in advance. Our findings demonstrate that equally meaningful sets of hypotheses can lead to completely different results, which only trained ears can distinguish. The combination of hypotheses may not elucidate the situation. An apparent preference for a tuning scheme may be the result of a numerical artefact rather than proof of its validity.
A meticulous listening to these recordings, with the exclusion of the somewhat inelegant rendering of fast trills in the lower octave, reveals a musical dimension that cannot be reduced to the concept of 'intervals'. Each piece can be likened to a precious stone, exhibiting an astonishing regularity in its structure. The listener is invited by the artist to explore all sides of the crystal and to appreciate its purity: a 'tonal landscape'. In this approach, the slightest imperfection, such as a few cents up or down, is amplified by the structure. In short, the most important feature may be less the choice of a structure than its consistency in rendering each musical phrase.
It is uncertain whether J.S. Bach had a specific, unique musical temperament in mind when he composed The Well-Tempered Clavier. This is because the highest rating in terms of intervals may not be the most appropriate. This question remains open to art historians and musicologists. However, from the sound examples, it is evident that playing this repertoire on improperly tuned instruments — in terms of consonance — is tantamount to exposing plastic imitations of diamonds.
Reference(s)
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 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. Download and install Csound from its distribution page.
Harpsichord jacks in a completed harpsichord Source: Material Matters
The following is a "computational" tonal analysis of musical works by J.S. Bach known as The Well-tempered Clavier, books II and II, published around 1722 and 1742 respectively, and the Goldberg Variations (1741).
The aim of this exercise was to match each musical work to a set of tuning schemes described and implemented on the Bol Processor. These include all the temperaments documented by Pierre-Yves Asselin ([1985], 2000) and "natural" scales systematically constructed — see Creation of just intonation scales.
It has been suggested that the best match for a scale is the tuning scheme that is appropriate for the interpretation of a musical work. This assumption is based on the hypotheses that (1) musicians and composers of the Baroque period aimed to achieve optimal 'consonance', and that (2) this notion implied a preference for certain intervals expressed as integer ratios. These claims are discussed on this page. Accurately tuned sound examples are suggested for auditive evaluation of the results.
The interest of this tonal analysis goes beyond the understanding of music theory and practice. Its epistemological dimension is the trustworthiness of today's fashionable mathematical "predictive models". We show that, given a set of hypotheses, the solution to an optimisation problem — finding the best tuning scheme for all musical works in a repertoire — is not unique, as it depends on initial conditions. Furthermore, the same initial conditions can produce a cloud of seemingly identical solutions, even though each of them points to completely different procedures for its realisation in the "real world" — here, the tuning of a harpsichord.
The take-home message is that scientists should not be impressed by the accuracy and apparent consistency of machine-generated solutions. They must critically examine the initial conditions and the calculation process itself.
Ultimately, the only acceptable way to (in)validate a compositional model is to listen to the audio rendering of the results.
"Standard" analysis
The Well-Tempered Clavier consists of two books, each containing 24 preludes and 24 fugues in all the usual key signatures. In total, this analysis covered 96 musical works (presumably) written by the same composer under (presumably) similar conditions.
Our first analysis is based on the following settings of intervals estimated to be consonant or dissonant:
Settings for a "standard" analysis
The analysis of ascending and descending melodic intervals looks for common frequency ratios close to 3/2 (Pythagorean fifths) and 5/4 (harmonic major thirds), which are widely regarded as 'consonant'. It also includes the ratios 6/5 (harmonic minor thirds) and 9/8 (Pythagorean major seconds), which can be considered optimal. Other ratios are often considered 'dissonant': 40/27 (wolf fifth), 320/243 (wolf fourth) and 81/64 (Pythagorean major third). These dissonant intervals are 1 comma (ratio 81/80) higher or lower than their "consonant" neighbours — see page Just intonation: a general framework.
Consonant intervals are given positive weights, for example '1' for a harmonic major third and '2' for a Pythagorean fifth. Dissonant intervals are given negative weights, for example '-2' for wolfish intervals and '-1' for Pythagorean major thirds. These weights can be modified; indeed, the modification will in turn change the ratings of the tuning schemes.
Each melodic interval found in the musical work will be sized according to the same interval in the scale being tested for compatibility. For example, when trying to match the D'Alambert-Rousseau tuning scheme (see image), a note sequence 'C' - 'Eb' will be sized 290 cents, which is close to 294 cents or the ratio 32/27 (Pythagorean minor third). When this ratio appears in the settings, the scale value is increased by the weight of the ratio multiplied by the (symbolic) duration of the interval — see Tonal Analysis of Musical Works for details of this procedure.
The same method is applied to harmonic intervals, which are given the same weights as melodic intervals, except for the 9/8 ratio, which is ignored.
The scores for ascending and descending melodic intervals are then added to the score for harmonic intervals, with weights of 1, 1 and 2 respectively. This weighting may be modified if "consonance" is expected to be greater for melodic than for harmonic intervals, or if ascending and descending melodic intervals are not considered equally important.
Each scale is given a mark if it is found to be the best match for a piece of music. Counting these marks over the entire repertoire gives the best tuning scheme(s) for that repertoire.
Results are stored in tables that can be downloaded in both HTML and CSV formats. The initial settings are recalled at the bottom of the "All Results" HTML page.
Each cell in the "all results" table indicates the rank of a given tuning scheme (scale) that matches a given musical work. For example, in the fugues of book I, Corette's temperament (column corrette) was ranked 6th for the 5th fugue, and the best match for this piece was the Sauveur's temperament (column sauveur).
The line labelled Ranked first (times) shows the number of times each tuning scheme ranked first in the classification of this corpus. The line labelled Average score shows the average global (melodic + harmonic) score computed for this tuning scheme, as explained on our Tonal analysis page.
Abstract tables show the list of first ranked tuning schemes for each musical work.
➡ The full set of scale images is available on this page.
Discussion of the standard analysis
The scale of Sauveur's temperament
Of of these 96 musical works, 56 chose 'sauveur' as their favourite tuning scheme, plus 9 as their second favourite. This temperament strikingly dominates the classification because of its ability to produce almost perfect Pythagorean fifths (ratio 3/2), harmonic major thirds (ratio 5/4) and harmonic minor thirds (ratio 6/5).
Note that it also contains a wolf fourth 'Eb' - 'G#' close to 477 cents (or ratio 320/243) which is perceived as a dissonant interval. It is assumed that these two notes are never (or rarely) found in melodic or harmonic intervals in this repertoire. This illustrates the fact that there is no one-size-fits-all solution to the problem of tuning an instrument for this type of music. In a kind of "reverse engineering", we can say that the composer explored melodic and harmonic pleasing effects in order to build this repertoire: playing on the instrument before notating it on sheets of music sheets.
As suggested in our tutorial, there is no evidence that J.S. Bach was aware of the theoretical work of the French physician Joseph Sauveur, but the theoretical framework 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 work it out independently. This process has been recorded on the Bol Processor's Scale page as follows:
Created meantone downward notes “do,fa,sib,mib” fraction 3/2 adjusted -1/5 comma Created meantone upward notes “do,sol,re,la,mi,si,fa#,do#,sol#” fraction 3/2 adjusted -1/5 comma
Interestingly, "natural scales" with names corresponding to the key — for example, Abmin (i.e. G#min) for Fugue 18 in G♯ minor, Book II (BWV 887) — were often at the top of the popular tuning schemes, but in most cases were overtaken by several temperaments. For more details on these scales, see our page on the Creation of just-intonation scales.
In all cases, the equal temperament (see image) was among the lowest, due to its use of major and minor thirds close to Pythagorean. This contradicts the popular belief that Bach's series of Preludes and Fugues was intended to equate 'well-tempered' with 'equal-tempered'…
This first result also suggests that temperaments often provide a better tonal structure for achieving maximum consonance than the so-called just intonation scales.
Temperaments are based on empirical tuning procedures guided by perceived intervals (see Asselin, 2000) whereas "just intonation" is the result of speculation about numerical ratios — a deductive process. This brings us back to a discussion of the ancient Indian approach to tonality, see the page on The two-vina experiment.
"Alternate" analysis
At this stage, it is tempting to conclude that J.S. Bach's The Well-Tempered Clavier was intended to be played on instruments tuned to Sauveur's temperament. However, the result of any analysis must always be examined for bias in its hypotheses. In the present case, we must revise the choice of certain frequency ratios as criteria for assessing the 'consonance' of melodic and harmonic intervals.
The minor third — either harmonic (6/5) or Pythagorean (32/27) — is in question because the Pythagorean minor third appears in some temperaments. For example, the Cmaj natural scale (see image) uses 32/27 for its interval 'C' - 'Eb'. Therefore, it makes sense to ignore all minor thirds when evaluating harmonic intervals and to accept both ratios 6/5 and 32/27 as equal positive weights in melodic intervals. This option is illustrated by sound examples, read on. A useful variant would be different ratios in ascending and descending harmonic intervals.
The same observation applies to major thirds: although 5/4 (harmonic) certainly sounds better than 81/64 (Pythagorean) in harmonic intervals, there is no strong reason to prefer the former in melodic intervals — again with a possible distinction between ascending and descending movements.
Let us start the whole analysis again with these changed settings:
The results contradict the conclusion of the 'standard' analysis: Sauveur's temperament may not be such a good choice, given the alternative choice of ratios for consonant/dissonant melodic and harmonic intervals.
According to these settings, the best tuning schemes might be the D'Alambert-Rousseau temperament (see picture and read Asselin, 2000 p. 119) and H.A. Kellner's BACH temperament (see picture and read Asselin, 2000 p. 101). Both were designed after J.S. Bach's death, but similar or identical tuning procedures could have been devised by the composer.
A comparison of the images and cent positions (identical within ± 7 cents) explains why these two temperaments produced identical matches, despite their completely different tuning procedures. Look at the procedures (traced by the algorithm) and listen to short note sequences produced with these scales:
D'Alembert-Rousseau temperament 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
Sequence of notes according to D'Alembert-Rousseau temperament
Sequence of notes according to Kellner's BACH temperament
As a reminder, the same sequence of notes with an equal-tempered scale:
Sequence of notes according to equal temperament
D'Alembert-Rousseau tuning scheme (Asselin, 2000 p. 119)
These tuning procedures are not exactly the same as those described by Asselin (2000, p. 120 and 102), but they produce the same tonal positions.
In these temperaments, intervals such as 'C' - 'Eb' are rendered as Pythagorean minor thirds (32/27), and many Pythagorean major thirds (ratio 81/64) are encountered. This justifies their choice, given the new conditions of analysis.
Again, these temperaments dominate the classification, taking first place 65 times and second place 15 times, while the equal temperament, despite its mastery of Pythagorean major thirds, took first place only 21 times. Compared to Sauveur's temperament in the standard analysis (56 first positions and 9 second positions), these temperaments look 'better', but this comparison is irrelevant as the two analyses focused on different ratios.
The 33 Preludes and Fugues that do not conform to these temperaments often prefer a just intonation scale in the same key; for example, Prelude 8 in E♭ minor of Book I (BWV 853) chooses the Ebmin scale, and Prelude 9 in E major of Book I (BWV 854) chooses the Emaj scale. However, this matching is less common in the "dissident" fugues.
More advanced analysis is required. Note that changing the weighting of intervals or the weighting in the summation of melodic and harmonic scores can radically change the classification.
In this discussion, we have only examined tuning schemes at the top of the classification. Other schemes may be preferable when looking at melodic or harmonic scores separately — see our tutorial Tonal analysis.
Sound examples
The automatic tonal analysis of a large repertoire, compared with the whole set of tuning schemes implemented in the Bol processor, did not solve the problem of finding "the best tuning scheme" for this repertoire, since it depends on the initial conditions: frequency ratios estimated as "consonant" or "dissonant", plus the composer's presumed focus on optimal consonance. Nevertheless, two analyses selected 2 (or 3) tuning schemes as dominant in the classification. Further analysis would be required to refine this result, if it is significant.
All sound examples are compared with human interpretations on (not so well-tempered?) physical instruments on the page The Well-tempered clavier.
These sound examples are useful to hear the difference between tuning schemes selected on the basis of the "standard" and "alternative" settings. For example, Fugue 8 of book I may sound more melodious with a Dmin tuning (see illustration) than with a Marpurg tuning (see illustration). The difference may lie in the choice of the most convenient ratios for minor thirds.
Is this method reliable?
As the results shown in the 4 tables for each book (see above) suggest, some preludes and fugues ranked several tuning schemes as their favourite: number '1' is coloured red in the 'all results' tables. However, we only recorded one of the winners. What does this mean?
Take for example Prelude 12 of book I. In the "alternate" settings, five scales are ranked first: Emin, Cmaj, BACH, d_alembert_rousseau, bethisy. We have already shown that BACH and d_alembert_rousseau are almost identical despite the differences in their tuning procedures. Emin and Cmaj are exactly the same. This leaves us with the following choice:
Three scales ranking 1st for Prelude 12 of book 1 as per "alternate" settings
Tonal positions differ by a only few cents, which may not be noticeable in melodic and harmonic intervals. Below are recordings using these three scales:
Prelude 12 of book I, Emin tuning schemePrelude 12 of book I, Bethisy temperamentPrelude 12 of book I, Kellner's BACH temperament
This example suggests that if the widths of acceptable melodic and harmonic intervals have been set small enough to provide a well-focused solution set, differences in the first-ranked scales may be inaudible.
Listen to minor thirds
Judging the sizes of the common minor thirds by ear may make it easier to decide which is more "consonant". Lucky users of the Bol Processor BP3 only need to create the following data file:
-cs.tryTunings
// Harmonic minor third _scale(2_cycles_of_fifths,0) DO3 RE#3 DO3 RE#3 DO3 RE#3 {4,DO3,RE#3}
//Pythagorean minor third _scale(2_cycles_of_fifths,0) DO3 MIb=RE#-c3 DO3 MIb=RE#-c3 DO3 MIb=RE#-c3 {4,DO3,MIb=RE#-c3}
These items produce sequences of 'C' - 'D#' melodic and harmonic intervals using harmonic (6/5) and Pythagorean (32/27) minor thirds:
Harmonic minor thirds in sequence then superposedPythagorean minor thirds in sequence then superposedAlternance of harmonic then Pythagorean minor thirds
Listening to these examples suggests that both 6/5 and 32/27 are suitable ratios for minor thirds as "consonant" melodic intervals, while 6/5 sounds "softer" than 32/27 as a harmonic interval.
The names of the notes (inspired by the book, ibid.) sound bizarre but they make the positions explicit. For example, "Mib=RE#-c" indicates a position that is usually called mi bémol (E flat), which is identical to ré dièse (D sharp) minus one comma.
This scale — and the even more complicated "3_cycles_of_fifths" — is not practical for writing music… It is used to visualise (and hear) tonal positions produced by different tuning schemes that conform to the just intonation paradigm.
Listen to tempered fifths
Readers unfamiliar with tuning procedures may need to appreciate the tiny differences in intervals produced by temperaments created using the methods introduced on the Microtonality page and described in detail in Asselin (2000).
Let us listen to Pythagorean fifths in three forms: pure (frequency ratio 3/2 = 702 cents), equal-tempered (700 cents), diminished by 1/5 comma (697.3 cents) and diminished by 1/4 comma (696.2 cents).
Pure fifth (702 cents)Equal-tempered fifth (700 cents)Fifth diminished by 1/5 comma (697.3 cents)Fifth diminished by 1/4 comma (696.2 cents)Sequence of fifths: pure, then equal-tempered, then diminished by 1/5 comma, then diminished by 1/4 comma
The same exercise was attempted with J.S. Bach's Goldberg Variations (1741). The aria and its thirty variations were performed in a single sequence, apparently with the same instrument/tuning. For this reason, we checked a unique MusicXML score containing all the variations.
With the "standard" hypothesis of consonance, the result is as follows:
(As expected) Sauveur's meantone temperament won the game, followed by Kellner's BACH. The equal-tempered scale came 28th in this classification… (Note that the calculation of this table took 3 1/2 hours on an old MacBook Pro…).
Listen to the synthesis of the Goldberg Variations with Sauveur's meantone temperament:
The "alternative" model of consonance gives the following classification:
Favourite tuning schemes, according to this model, would be D'Alembert-Rousseau (see picture) and Kellner's BACH (see picture) meantone temperaments, both of which have equal value because their tonal intervals are almost identical.
Listen to the synthesis of the Goldberg Variations with the D'Alembert-Rousseau temperament:
These preferred tunings are the same as those best suited to the set of preludes and fugues in The Well-Tempered Clavier.
These sound examples can be compared to human performance, for example the Aria on a harpsichord tuned to the Werckmeister III meantone temperament — listen to this recording. In fact, the musicians show a more flexible timing than the Bol Processor, which sticks to the parameters of the MusicXML score. Nevertheless, a comparison focusing on tonal intervals remains possible.
The fact that Werckmeister III (see image) ranked low in the automatic tonal analysis does not indicate a wrong choice. This tuning scheme may perform better against a particular model of "consonance".
Let us use calculations to work out its main difference from D'Alembert-Rousseau and Kellner's BACH. We can limit the analysis to bars #1 to #32 (the Aria), which exposes most of the melodic/harmonic intervals; this Aria functions similarly to the opening section (ālāp) in North Indian classical music… We notice that neither D - F# (397 cents) nor G - B (398 cents) in Werckmeister III are exact harmonic major thirds (390 cents), intervals with a high frequency as shown in the table of interval frequencies:
Interval frequencies in the Aria of Goldberg Variations
Below is a comparison of the Werckmeister III and D'Alembert-Rousseau scales in terms of matching melodic intervals (in the "alternate" model of consonance) over the first 32 bars of the Goldberg Variations:
Matching two scales with the melodic intervals of the Aria in Goldberg Variations: Werckmeister III (left) and D'Alembert-Rousseau (right)
The width of the yellow lines is proportional to the occurrence/duration of melodic intervals in this part of the corpus. The picture confirms the absence of an exact harmonic major third D - F# in the Werckmeister III scale, and the same mismatch of the major third G - B. Another mismatch is on the minor third E - G, here aiming at a ratio of 6/5 (315 cents) or 32/27 (294 cents).
Sources of MusicXML scores
Links point to MusicXML scores used in this analysis. These links must be cited in the attribution part of Creative Commons licences. Updated versions are welcome.
Our thanks to the editors of these scores in the MuseScore community!
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 '-cs.tryTunigs' declaration at the top of the data content, indicating that it should pick up the tonal scale definitions contained in this Csound resource. These definitions are only accessible if '-cs.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 Bol Processor notation (English convention), the musical item reads as follows — read the Polymetric structures page:
The sound production used the Csound resource file '-cs.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 '-cs.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:
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:
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).
Musical 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 IIKirnberger 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-thirdstemperament 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 '-cs.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:
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 temperamentJ.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:
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.
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.
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…
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. Download and install Csound from its distribution page.