Chapter 3: Variation


Scott Selfon

Okay, we understand linear pieces of music and getting from one piece of music to another. A primary challenge to overcome is repetition. No matter how smooth our transitions, if we hear the same pieces of audio repeatedly, they are bound to get stale. Here is where DirectMusic provides significant strength!

Variable Playback/Variations

Content variability can be achieved on several different levels. On a "microscopic" level, content can specify ranges for volume and pitch on individual waves played in Wave Tracks, as well as randomized volume, start time, and duration on notes in Pattern Tracks.

click to expand
Figure 3-1: The Wave Properties page allows you to specify ranges for attenuation and fine-tuning. This particular example will randomly pitch-shift the wave up or down by two semitones.

click to expand
Figure 3-2: The Pattern Note Properties page allows you to specify variability for velocity, start time, and duration. This particular note will play with randomization in start time, duration, and with a random velocity between 75 and 125.

On the "macroscopic" level, you could of course author multiple Segments and write a script to choose between them randomly.

Then we have variations, which provide the best of both worlds. Variations are those 32 intimidating-looking buttons present on Wave Track parts and Pattern Track parts (in Segment files), as well as in pattern parts (in Style files, a format which we cover in a bit).

click to expand
Figure 3-3: The Variation Button window.

Each of those buttons represents one version of the part; for instance, you could have a drum part where variation 1 includes the full drum part, variation 2 removes the snare, variation 3 mixes up the rhythms a bit, and so on.

The primary thing to remember about variations is that at any given time, a single variation plays per part. This does not mean that every single part is playing variation 12 at the same time, but it does mean that if you author 12 variations for your drum Track, only one is being played at any given time. Each part chooses a new variation to play whenever its Segment is started or loops.

Before we get into the details of variation behavior and functionality, let's talk a bit about the 32 buttons, which can be among the trickier aspects of DirectMusic Producer to understand. When you first create an empty part that supports variations, each of the 32 button labels is white. This indicates that these variations are empty. As soon as you add any note, continuous controller, or wave information to a variation, that variation's label becomes black, which indicates that it has some information in it.


Figure 3-4: Variation 1 has data in it, while variation 2 is empty.

One potentially confusing aspect of variations is that empty variations are just as acceptable to be "picked" to be played as variations with data. For instance, a composer might create three alternate versions of a drum part on variations 1 through 3. When he then tries to play the piece of music, he finds that most of the time it's silent. Why? Because variations 4 through 32 were enabled and empty (silent), meaning 29 out of 32 times, an empty variation was chosen.

This brings us to disabling variations. When a variation is disabled, DirectMusic will never "pick" it to be played. By default, all variations are enabled. This is indicated in DirectMusic Producer by a solid gray background for the button.


Figure 3-5: Variations 3 and 4 are disabled. Variation 3 has data in it, which typically should be deleted (since the variation will never be chosen).

To disable one or more variations, make sure the appropriate variation is pressed by clicking on it; then right-click anywhere over the 32 variation buttons and choose Disable from the right-click menu that appears. Disabled variations have a checkerboard look to them. Note that it is possible to have a non-empty variation that is disabled. In most typical scenarios, this means that you are saving data that you will never use, so it is generally a good idea to go ahead and erase any disabled variations when your project is completed.

Auditioning Variations in DirectMusic Producer

The final aspect of the user interface for variations is the buttons being selected ("pressed down") or not selected ("up").


Figure 3-6: Variation 1 is selected; 2 is not.

The main thing to remember about this aspect of the buttons is that it is solely for editing and auditioning purposes in DirectMusic Producer — whether a button is pressed or not has no bearing on how the variations will behave in a DirectMusic player or in a game at run time. Pressing buttons provides for two purposes:

  • Editing one or more variations simultaneously. Pressing a single variation button means that you are now editing only that variation. Paste from the clipboard, add a note, or drag a wave into the part, and that data is assigned solely to that variation. If you select multiple variations, notes and waves added will be identically added to each of the selected variations.

  • Auditioning variations within DirectMusic Producer. Let's say you created a four-part piece of music, and each part had ten enabled variations. You listen to it a few times and notice that there's an incorrect note in one variation of the bass part. Rather than forcing you to keep repeatedly playing the Segment until that variation gets picked again, DirectMusic Producer has an audition mode, where the same variation (whichever one is "pressed") will be chosen every time the Segment is played. Only one part can be in audition mode at a time. To select a part for audition mode, just click anywhere on it. The part that is in audition mode is highlighted in a slight yellow shade.


Figure 3-7: Part three (piano) is in audition mode. Within DirectMusic Producer, all other parts will randomly choose which variation to play from the enabled variation buttons. Part three will always play whatever variation button is pressed (until it is no longer in audition mode).

Remember that audition mode only applies in DirectMusic Producer; when a Segment is saved and played in a DirectMusic application, none of its parts will be in audition mode, and all parts will choose from their enabled variations.

Audition mode provides for some unique behaviors not seen outside of DirectMusic Producer. First, as multiple variation buttons can be selected ("pressed") at once, you have the opportunity to hear a single part playing multiple variations at once. As mentioned previously, only a single variation will be chosen at a time in an actual DirectMusic application. You can also select disabled variations and audition them; a DirectMusic application will never play a disabled variation. Lastly, you can have all of the variations on your auditioned part deselected, in which case no variation will be chosen, causing this part to be silent. Again, this behavior is solely an audition feature of DirectMusic Producer.




DirectX 9 Audio Exposed(c) Interactive Audio Development
DirectX 9 Audio Exposed: Interactive Audio Development
ISBN: 1556222882
EAN: 2147483647
Year: 2006
Pages: 170

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net