Melisma Stochastic Melody Generator: Proximity Parameters

This page explains the parameters of the MSMG relating to pitch proximity and range.

In choosing a note, the MSMG takes into account the pitch of the previous note, and favors notes that are relatively close to it in pitch height; that is to say, it favors small intervals. Each note is chosen probabilistically, using a distribution like this. (The asterisk represents the position of the previous note. This itself has a probability of zero, under default parameters; see the discussion of the "repeated notes" parameter below.)

  ...    6  5  4  3  2  1  0  1  2  3  4  5  6 ...  <-distance from previous
                                                      pitch (in semitones)

The values continue to decrease gradually as distance increases from the previous note (though this is limited to notes within the allowable pitch range, as discussed below).

The "proximity factor" parameter controls the flatness of this distribution. When proximity factor=1.0, the distribution used is that shown above. As the factor is decreased towards zero, the distribution becomes flatter; when it is zero, all notes within the allowable range have the same probability.

Pitch choices are also affected by tonality factors. The probability value for a pitch is actually given by the product of its key-profile value and its proximity value (these values must all be normalized to sum to 1 for all allowable pitches). We can represent this with a bar graph in which the height of a bar represents the key-profile value for that pitch, and its width represents its proximity value; the probability of the pitch is then given by the area of the bar. If the previous pitch was scale-degree 4, then, the combined key-profile/proximity distribution would look like this. (Scale degree 4 itself--the previous pitch--has a proximity probability of zero, therefore its bar has no width; chromatic pitches have tonal probability of zero, so their bars have no height.)

...   7 1 b2 2  b3   3 (4) #4   5  b6 6 b7 7 1  ...

Each melody is also confined to notes within a certain pitch range. This can be controlled using the "top of range" and "bottom of range" parameters; following convention, 60 represents middle C, with higher numbers representing higher pitches (so 72 is an octave above middle C). The proximity distribution described above is simply cut off at the top and bottom of the allowable range; all notes beyond have a probability of zero. Thus if the previous pitch were two semitones below the top of the allowable range, the resulting proximity distribution would look like this:

The parameter "repeated notes" controls whether immediately-repeated notes are allowed. If 1, they are allowed; if 0 (the default), they are not. If 1, the probability of repeated notes is determined by the proximity parameter: if 0.0, a repeated note is no more likely than any other note in the range; if 1.0, repeated notes have a probability of 1.0, so that the melody will consist of a single repeated note.

CAUTION: Some parameter settings may lead to a null melody. For example, suppose you try to force a monotone melody on middle C (by setting repeated notes=1, bottom=60, and top=60); but suppose also that tonality=1.0 and the key is D major (either because key=2 or the program randomly chooses D major), a scale which does not include C. Then no note will have a non-zero probability as the first note, and no notes will be generated.

Imagine a melody confined to a fairly small range (say an octave and a half). Suppose at some point the melody makes a large upwards leap; this will tend to take it towards the upper end of the range (say two semitones below the upper end, as in the bar graph above). Notice that, at this point, most of the probability "mass" is below the note; that means the following note is most likely to be below the current note. This raises the possibility that the widely observed phenomenon of "gap-fill" - the tendency of large melodic leaps to be followed by a change of direction - may not be due to any deliberate strategy on the part of composers, but rather to constraints on range and pitch proximity. [1] (Experiment: Generate some stochastic melodies with proximity factor = .6 or so, bottom=60, top=79. Do most large leaps in the melody seem to be "filled in"?)

1. Paul von Hippel, "Redefining Pitch Proximity: Tessitura and Mobility as Constraints on Melodic Intervals", Music Perception 17 (2000): 315-27; Paul von Hippel & David Huron, "Why do Skips Precede Reversals? The Effect of Tessitura on Melodic Structure", Music Perception 18 (2000): 59-85.