## Melisma Stochastic Melody Generator: Meter Parameters

This page explains the parameters of the MSMG relating to rhythm, meter, and tempo.

Rhythm in the MSMG is controlled by a metrical grid: a repeating cycle of 8 beats. Each position in the cycle has a value associated with it, indicating the probability of a note-onset occurring at that beat. With default settings, the probabilities are as follows:

```   1  2  3  4  5  6  7  8       <-beat
1.0 .2 .4 .2 .8 .2 .4 .2      <-probability
```

(Although this looks a bit like the key profiles and proximity profile, it is actually quite different; it represents eight different random variables, rather than a single variable with all values summing to 1.)

We can think of beat 1 as a half-note beat; beats 1 and 5 are quarter-note beats; beats 1, 3, 5, and 7 are eighth-note beats; and all beats are 16th-note beats. In the default case, quarter-note beats are spaced 500 ms apart (half a second); this can be manipulated using the "beat interval" parameter. The factor "number of beats" controls the number of quarter-note beats generated, i.e. the length of the melody.

The parameter "meter factor" controls the flatness of the meter profile. With meter factor = 1.0, the profile is exactly as given above; as the meter factor decreases towards zero, the profile becomes increasingly flat. If meter factor = 0.0, all positions in the profile have the same probability (about 0.33).

The "rubato factor" controls the regularity of the beat pattern itself. (Rubato refers to expressive variation in tempo.) With rubato factor = 0.0, there is no rubato: quarter-note beats are spaced perfectly evenly (at a distance determined by the "beat interval" parameter), and lower-level beats are equally spaced in between. If rubato factor is set to a non-zero value, a random element is added to each quarter-note beat interval (the interval between the previous quarter-note beat and the current one). As rubato factor increases towards 1.0 the size of this random element increases; If beat interval=500 and rubato factor=1.0, it ranges from 0 to 100 ms (positive or negative), so that actual beat intervals vary from 400 ms to 600 ms. Here is one series of beat times generated with these settings:

```    0 482 1062 1561 2093 2601 3097 3561 3970 4552 5095 5586...
```

The division of the quarter-note beats into lower-level beats is always perfectly regular, regardless of the level of rubato.

The meter factor controls the amount of syncopation in the melody (the degree to which notes are aligned with "strong" beats); the rubato factor controls the amount of rubato. Increasing either the amount of syncopation or the amount of rubato can make the meter more difficult to perceive. What is less obvious, perhaps, is the way rubato and syncopation interact. Try the following experiment. First set the rubato factor to 0.0. Try generating melodies with different values of the meter factor (starting at 1.0 and gradually decreasing); determine the level at which it becomes difficult or impossible to infer (and follow) the beat. Now set the rubato factor to 0.7, and repeat the experiment; is the "beat perception threshold" for the meter factor now different?

The interaction between rubato and syncopation is an important fact about music.[1] It may explain why genres with much syncopation (such as jazz, rock, and traditional African music) tend to be played with very little rubato; in styles with very little syncopation (such as classical music) the degree of rubato in performance is much greater.

The parameter "rhythmic anchoring" relates to the placement of notes on weak beats. In the initial version of the model, the decision to place a note on a beat (a "note-beat decision") was independent of neighboring beats. However, this was found to yield unsatisfactory melodies: in some cases, for example, a note would occur on the fourth sixteenth-beat of a measure without any note on the third or fifth sixteenth-beat, creating an odd syncopation (though this rarely occurs, given the probabilities in the beat profile). If "rhythmic anchoring" is set to 0, note-beat decisions are independent, as just described. If rhythmic anchoring=1, a note can only occur on a sixteenth-note beat if there is a note at either the previous or following eighth-note beat; similarly, notes on eighth-note beats require notes on the previous or following quarter-note beats. If rhythmic anchoring=2, a note can only occur on a sixteenth-note (or eighth-note) beat if there is a note at the following higher-level beat. As the meter factor is lowered, these constraints are gradually relaxed. (Note-beat decisions are made at higher metrical levels first, then lower levels; the beat profile is applied only if the constraints of the rhythmic anchoring rule are met. Therefore, if rhythmic anchoring is set to 1 or 2, the actual density of notes at lower metrical levels will be somewhat less than stipulated in the beat profile.)

1. David Temperley, The Cognition of Basic Musical Structures (Cambridge: MIT Press, 2001), pp. 292-299.