Mozart’s musical dice game

Dice animation
Source: MaskOfVirtue

The following is a version of a Musikalisches Würfelspiel attributed to the Austrian composer Wolfgang Amadeus Mozart (1756-1791). The source is a manuscript published by B. Schott's Söhne (Mainz 39542) containing musical fragments and their correspondances to numbers selected by rolling two dice.

We will show an implementation of this game that works with both BP2.9.8 and BP3. The BP3 example has already been introduced in the page Bol Processor ‘BP3’ and its PHP interface. Here we will focus on the improvisational aspects.

The implementation took time because the score fragments were not available in digital format. Therefore, note names were captured from a connected MIDI keyboard. Today, similar projects can be easily handled using MusicXML scores and the import procedure implemented in the Bol Processor BP3.

Set up options

Settings of “-gr.Mozart”

In the settings of the grammar "-gr.Mozart" (see picture), the option "Non-stop improvize" is checked. This means that the machine is expected to create and play new variations of the theme forever. On the BP3, in the absence of real-time MIDI, only 10 variations are produced, saved in a MIDI or Csound file and immediately available for listening via the interface players.

At the bottom of the settings, the note convention has been set to "French". At the top of it is the "seed for randomization" which deserves a comment.

Computers produce sequences of random numbers determined by successive calls to the rand() function in the C programming language. Another function called srand(x) reseeds the sequence with number "x": the seed. A given seed will produce the same sequence for subsequent calls of rand(). The only way to get unpredictable sequences is to use a different seed each time a random sequence is required. In other words, shuffle the cards. To do this, the Bol Processor picks up a seed in the time() function which returns the current date/time as an integer number.

Here, the seed is set to "999". Unless modified, the sequence of variations of Mozart's dice game should be identical (on the same computer). In order to generate random sequences we need to instruct the machine to reseed the sequence with an arbitrary number of its choice. By convention, this is done by setting the seed to 0.

The result

Below you can hear a sequence of 10 variations created with seed = 999. The MIDI file was downloaded and sent to a PianoTeq synthesiser tuned to equal temperament:

Ten variations of "-gr.Mozart" produced with seed = 999

I remember playing variations of "-gr.Mozart" to a team of music teachers who concluded enthusiastically: "That must be Mozart!"

You can also download the MIDI file and send it to a MIDI device. Below is another set of variations sent by BP2.9.8 to a Roland D-50 synthesiser whose split patch assigned notes to different instruments according to their tonal position:

Variations of "-gr.mozart" played on a split patch of Roland D-50

The same can be achieved by using _chan() or _ins() instructions in the grammar to assign instruments via reserved MIDI channels or their indices in Csound.

These examples are played on electronic instruments tuned to equal temperament. However, Bol Processor + Csound can produce the same by exploiting microtonality to produce works tuned in different temperaments or in pure intonation. Below is the same set of pieces using Zarlino's meantone temperament (Asselin 2000 p. 85):

Mozart's musical dice game in Zarlino's meantone temperament

Finally, "just intonation" can be achieved by retuning the instrument at each measure to match the harmonic context, as explained on the page Just intonation, a general framework. This gives the following interpretation — the best tuning, in my opinion:

Mozart's musical dice game in just intonation

The MIDI format does not allow for these precise context-sensitive microtonal adjustments.

The stochastic model

A challenging aspect of this game is that there is no equal probability of getting numbers in the range 2 … 12. For example, a sum of 7 is six times more likely than a sum of 2 or 12. The designer of this game may have been aware of this, as the less likely numbers have been mapped to musical sequences that sound more "dissonant".

In order to simulate the dice game, it was therefore necessary to assign weights to the rules that reflected the real probabilities. This was achieved in the grammar (below) by assigning weights K1, K2 etc. to all rules activated by dice rolls.

Show grammar
Sound-object and pianoroll displays of a polymetric expression {{2,do3,sol3}{do3,mi3},mi5 re5 mi5 sol5 do6 sol5} produced by T162 in "-gr.Mozart"
Sound-object and pianoroll displays of a polymetric expression {{2,do3,sol3}{do3,mi3},mi5 re5 mi5 sol5 do6 sol5} produced by T162 in "-gr.Mozart"

Subgrammars #1 to #17 rewrite the work string — initially "S" — as strings of variables "A1", "A2", "B1", "T96" etc. The numbers of the "T-variables" are taken from tables in the game.

Subgrammar #18 rewrites each "T-variable" as a polymetric expression of terminal symbols (simple notes). For example, "la3" is equivalent to "A4" in English which is set to 440 Hz in "-se.Mozart". This instrument can be tuned.

The pictures show self-explanatory pianoroll and sound-object displays of the polymetric expression produced by "T162":

{{2,do3,sol3}{do3,mi3},mi5 re5 mi5 sol5 do6 sol5}

To create the "-gr.Mozart" project, notes have been entered from a connected MIDI (piano) keyboard — read instructions.

Octave numbering and diapason

When we captured notes from a MIDI keyboard to construct the rules for subgrammar #18, we had the Bol Processor set up incorrectly due to confusion over octave numbering in the English and French conventions.

In English, the "middle C" on a piano keyboard is called "C4" and its number is 60. In French, the key with the same number is called "do3". When we mistakenly called it "do4", all the notes were written an octave higher…

After fixing the problem on BP2, there were two ways to correct the octave shift:

  • Set the "Middle C" number to 48 
  • Keep the standard "Middle C" = "C4" = 60 and transpose the whole piece down 12 semitones:
    S --> _transpose(-12) _vel(80) A B

We believe that the second solution makes more sense because it is based on a universal standard of key numbering.

Both solutions have the same corrective effect on the Csound score: only note names will change, for example "mi5" is replaced with "mi4" but both octave point pitch-class notations remain "9.04".

Settings on -gr.Mozart

On the Settings page the diapason (frequency of "A4") is set to 440 Hz which is the most common standard for tuning instruments. If "A4" was numbered 48 this frequency should be lowered to 220 Hz.

However, this diapason setting has no effect on the tonality of pieces produced by "-gr.Mozart" in MIDI format. The real-time MIDI stream or MIDI file will be played by MIDI devices — such as the MIDIjs javascript player — using their own default setting of "A4".

In the Bol Processor BP2, the frequency of "A4" also had no effect on the Csound output. In the orchestra file "default.orc", the oscillator parameter kpitch was derived from the octave point pitch-class parameter p4 via the function cpspch() also using the default 440 Hz diapason = cpspch(8.09) — see documentation. This has been changed in BP3, using an updated version of "default.orc". See Csound tuning in BP3 for more details.

References

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

3 Replies to “Mozart’s musical dice game”

  1. As an engineer rather than a musician, I have long been interested in the clever compromise of equal temperament. Now that I am used to hearing equal-temperament keyboards, I find that your just-intonation example to sound dull by comparison, as the beats of equal temperament are part of the character of the sound that I am used to hearing. I wonder whether the additional beats introduced by tuning octaves slightly wide add to the character of music played on the piano.

    1. I fully agree with this. The just-intonation model is a theoretical one with no real existence on conventional keyboard instruments. Much like the Pythagorean theorem never applies to triangles on the surface of the earth or in curved space… In terms of perception, hearing just-intonation intervals produced by sounds reproducing physical instruments is analogous to looking at perfect concentric circles drawn over a web of perfect squares: you need "adjustments" of these circles for them to look "correct"!
      Somehow, imperfection is more perfect… In speech prosody, for instance, we observe that speakers are aiming at tonal targets that they do not reach, although they could. If they reach targets their speech sounds like ridiculously singing…

    2. Another factor is the "accumulation" of musical experience. Supporters of just (or "pure") intonation claim that we lost the ability to appreciate its value, so we should train back our ears to reach what they consider the highest rendering of music — along with mystical conotations. This is also a belief of Indian musicians claiming to follow the grama-murcchana model for the intonation of raga (read Raga intonation).

      Indeed, there is no other way to substantiate these claims than undergoing the training process. It happened to me, listening to Darius Milhaud's La Création du monde many times as I was taking part in a choreographic rendering of this work. I did not like it in the beginning, thinking it sounded like "bad jazz". After a few months it started sounding better and better because I gradually lost my implicit reference to jazz. I could at last enjoy its polytonality in the way Milhaud had perceived it, being exposed to mixed jazz performance sounds from the window of his room in New Orleans — as his wife later explained.

      I am tempted to say that we can't enjoy musical works played with the style and instruments available at the time they were composed, because both have evolved over decades or centuries. Concerts of Chopin's music (by great performers) using instruments of his time sound horrific to my ears!

Leave a Reply

Your email address will not be published. Required fields are marked *