Randomizing
Keywords: mma

Subsections

- RndSeed
- RSkip
- RTime
- RDuration
- RPitch
- Other Randomizing Commands

#
Randomizing

One criticism of computer generated music is that all to often it's too predictable or mechanical sounding. Again, in MMA we're not trying to replace real, flesh and blood musicians, but applying some randomization to the way in which tracks are generated can help bridge the human/mechanical gap.

#
RndSeed

All of the random functions (RTIME, RSKIP, etc.) in MMA depend on the Python random module. Each time MMA generates a track the values generated by the random functions will be different. In most cases this is a “good thing”; however, you may want MMA to use the same sequence of random values13.1 each time it generates a track. Simple: just use:

RndSeed 123

at the top of your song file. You can use any integer value you want: it really doesn't make any difference, but different values will generate different sequences.

You can also use this with no value, in which case Python uses its own value (see the Python manual for details). Essentially, using no value undoes the effect which permits the mixing of random and not-so-random sections in the same song.

One interesting use of RNDSEED could be to ensure that a repeated section is identical: simply start the section with something like:

Repeat RndSeed 8 ...chords

It is highly recommended that you do not use this command in library files.

#
RSkip

To aid in creating syncopated sounding patterns, you can use the RSKIP directive to randomly silence or skip notes. The command takes a value in the range 0 to 99. The “0” argument disables skipping. For example:

Begin Drum Define D1 1 0 90 Define D8 D1 * 8 Sequence D8 Tone OpenHiHat RSkip 40 End

In this case a drum pattern has been defined to hit short “OpenHiHat” notes 8 per bar. The RSKIP argument of “40” causes the note to be NOT sounded (randomly) only 40% of the time.

Using a value of “10” will cause notes to be skipped 10% of the time (they are played 90% of the time), “90” means to skip the notes 90% of the time, etc.

You can specify a different RSKIP for each bar in a sequence. Repeated values can be represented with a “/”:

Scale RSkip 40 90 / 40

If you use the RSKIP in a chord track, the entire chord will not be silenced. The option will be applied to the individual notes of each chord. This may or may not be what you are after. You cannot use this option to generate entire chords randomly. For this effect you need to create several chord patterns and select them with SEQRND.

The BEATS option specifies the beats in each bar to apply skipping to. This is set with a option value setting:

Bass Rskip Beats=1,3 10 20 40 50

The above command will set random skipping for notes exactly on beats 1 and 3. The percentage of skipping will vary between each bar of the sequence (10%, 20%, 40% and 50%). It is not possible to set different beats for different bars; the beats option applies equally to each bar in the sequence. Beats are reset to None each time RSKIP is invoked.

#
RTime

One of the biggest problems with computer generated drum and rhythm tracks is that, unlike real musicians, the beats are precise and “on the beat”. The RTIME directive attempts to solve this.

The command can be applied to all tracks.

Drum-4 Rtime 4

The value passed to the RTIME directive is the number of MIDI ticks with which to vary the start time of the notes. For example, if you specify “5” the start times will vary from -5 to +5 ticks) on each note for the specified track. There are 192 MIDI ticks in each quarter note.

Any value from 0 to 100 can be used; however values in the range 0 to 10 are most commonly used. Exercise caution in using large values!

You can specify a different RTIME for each bar in a sequence. Repeated values can be represented with a “/”:

Chord RTime 4 10 / 4

You can further fine-tune the RTIME settings by using a minimum and maximum value in the form MINIMUM,MAXIMUM. Note the COMMA! For example:

Chord Rtime 0,10 -10,0 -10,20 8

Would set different minimum and maximum adjustment values for different sequence points. In the above example the adjustments would be in the range 0 to 10, -10 to 0, -10 to 20 and -8 to 8.

Notes:

- RTIME is guaranteed never to set a note before the start of a bar.

- RTIME is applied to every note in a chord. This means that if you have a chord (either from a CHORD track or as a result of a HARMONY setting) each note can start at different point. This probably makes sense since no musician will ever hit a number of keys on a piano or strings on a guitar at the same instant; nor can two trumpet players ever start a note at the same exact time. The point of RTIME is to humanize events a little bit by moving the “hit” points. Please note the difference in how this command works versus the RDURATION command, below.

#
RDuration

In a similar manner that the RTIME command, discussed above, sets the start point for a note, this command adjusts the duration of a note.

The RDURATION argument is a percentage value by which a duration is adjusted. A setting of 0 disables the adjustment for a track (this is the default). In its simplest usage:

Bass RDuration 10

the command will adjust the duration of every note in a BASS track plus or minus 10%. So, if the duration set starts off as 192 MIDI ticks (a quarter note), the command can change it to anywhere between 182 and 202 ticks.

You can further fine-tune the RDURATION settings by using a minimum and maximum value in the form MINIMUM,MAXIMUM. Note the COMMA! For example:

Chord RDuration 0,10 -10,0 -10,20 8

Would set different minimum and maximum adjustment values for different sequence points. In the above example the adjustments would be in the range 0 to 10, -10 to 0, -10 to 20 and -8 to 8.

Notes:

- No generated value will generate a null duration. If the randomized value is 0 or less, it will become 1 (tick).

- It is quite possible to cause adjoining notes to overlap. Generally, this is not a problem.

- A different value can be used for each bar in a sequence:

  Scale RDuration 5,10 0 / 20

- A “/” can be used to repeat values.

- The ARTICULATE setting is applied before the randomization is done.

- If the note being adjusted is part of a chord or a HARMONY event, all notes for that timestamp in the track will be adjusted by the same value ... all notes (including HARMONY notes) will have the same duration. Please note the difference in how this command works versus the RTIME command, above.

#
RPitch

When creating alternate melody background effects it is nice to be able to add unpredictability to some of the notes. Using an ARIA track (details here) is one way, but it might be a bit much.

The RPITCH option lets you create a predicable set of notes and, at random times, change some of them. Whenever a note is generated (this applies to all notes including chords, melody/solo, harmony and ornaments) the RPITCH setting for the track is evaluated and the note is modified.

The setting is simple:

Bass-Alt Rpitch Offsets=-2,-1,1,2

In this case the each note in the BASS-ALT track may be modified. In the offset list, each value sets the number of semitones to increment or decrement the current note by. “-2” means subtract 2 semitones and “2” means to add 2 semitones, etc.

You can have any number of value modifiers. Just remember to have all the values joined by commas. You can set a range of values by joining 2 numbers with a single “-”. So, -3-4 would be the same as “-3,-2,-1,0,1,2,3,4”.

A number of options are available for the RPITCH command:

Scale By default the SCALE (or alternately SCALETYPE) is set to CHROMATIC. However, you can also use CHORD or SCALE. In this case a note is selected from the appropriate list of chord or scale notes using a random value from the offset list. The current note is incremented (or decremented) by that value. Use of CHORD or SCALE should all but eliminate dissonance in the selected notes (not always since the original note might be dissonant). Be cautious using large values: it can very easily generate notes completely out of the current octave range. Offsets As detailed above, this is a simple list of values. Any values greater than 12 or less than -12 will be reported as “large” (this is a warning, not an error). Using a number of “0” values will reduce the number of note changes (adding 0 has no effect). And, you can use a range like “0-3” or even “-2-0,4-7”. Bars By default this option is applied to all bars in the current sequence. Using the BARS option will limit the effect to the specified bars. Rate By default 25% of notes are modified. However, you can reduce or increase the effect by setting a different rate. The specified value is a percentage in the range 0 to 100 (using 0 effectively turns the option off).

A complete command line might look like:

Solo RPitch Scale=Chord Rate=30 Bars=1,3 Offsets=-2-2

- Use of small values and a low RATE will ensure nice, subtle effects.

- To disable, you just need to set a null value:

  Chord-1 RPitch None

  or, with less typing:

  Bass-Stuff Rpitch

- This command cannot be applied to DRUM or PLECTRUM tracks.

- If you specify an offset greater than 12 or less than -12 a warning will be generated. This is an arbitrary value and no damage will be done.

- The underlying chord/scale notes are examined with the SCALETYPE set to SCALE or CHORD. In default CHROMATIC some (or lots of) dissonance should be expected. Overuse of this option will make your track sound like something a beginner might be playing ... probably not what you want.

- RPITCH is saved in GROOVES.

- You can not specify different values for bars in the sequence; however, you CAN limit effects with the BAR option.

- The example song `just-walkin-in-the-rain` shows how one might modify an existing library track with good results.

# Other Randomizing Commands

In addition to the above, the following commands should be examined:

- Aria tracks have a “r” option for the movement direction.

- The track Direction command has a “random” option for playing scales, arpeggios, and other tracks.

- RVOLUME makes random adjustments to the volume of each note.

- The VOICING command has an RMOVE option.

- RNDSET lets you set a variable to a random value.

- SeqRnd enables randomization of sequences; this randomization can be fine-tuned with the SeqRndWeight command.

- $(randint()) Expressions allows you to select a integer value from a range. Please refer to the PYTHON documentation for more details.

#### Footnotes

... values13.1
  Yes, this is a contradiction of terms.