How Music Varies During Playback
As DirectMusic plays a segment (other than a simple MIDI file or an authored segment based on a MIDI file), changes are made to the basic harmony and rhythm so that the performance does not sound static. Changes are partly scripted and partly random.
- Choice of pattern. Typically a style contains multiple patterns, which are selected in response to commands from the command track. For example, if the command track calls for a break embellishment to be played, the style playback engine selects a break pattern that is compatible with the current . (The author specifies which groove levels are appropriate for each pattern.) If there is more than one suitable pattern, a random choice is made.
- Variations within a pattern. Any part within a pattern can have multiple variations. Variations can play in an order specified by the author; otherwise, the style playback engine makes a random choice of variations on each repetition of the pattern.
- Groove level. The current groove level of the segment determines which of the patterns in the style can be selected for playback. The current level is set by the command track, which is normally authored into a segment or template. The current groove level of a segment can be changed programmatically, and a modifier can be applied to all segments by setting the master groove level for the performance.
- Transposition. As the segment plays, the underlying chord changes according to the progression in the chord track. The notes in the current pattern are automatically transposed to harmonize with the new chord.
- Variations in timing. The playback engine can introduce small random changes in the parameters of individual notes—when they begin and when they end.
- Band. The choice of instruments and instrument settings (volume, pan, and transposition) can be changed as the segment is playing, either by the band track within an authored segment or dynamically by the application. The application can change the band by creating a secondary segment based on a band object, then playing that segment.
In many cases, applications exert control over the music by playing different segments, rather than by manipulating existing segments. For example, to have the music reflect a change in the intensity of a game, you can simply transition to a new segment authored for that intensity level. You can achieve a similar effect with a single style-based segment by having the author create patterns with different groove ranges, then changing the groove level in response to game events.
For more information on how to change the music at run time, see Music Parameters.