Jason Booth
Wow! That was a lot of theory to take in. Now we're ready to dig into using the program that does it all: DirectMusic Producer. DirectMusic Producer is a complex program with a steep learning curve. While this section is not meant to be artistic, it demonstrates DirectMusic's basics, as well as the fundamentals required to use the program in a production environment. We also revisit some basic ideas key to using DirectMusic, including variation, styles, and chord changes. Our goal is to create a simple blues that uses DirectMusic's recomposition features to follow chord changes.
Getting Started
Insert the CD included with this book into your CD-ROM drive, as we refer to MIDI files on this CD for the note data in this chapter. Open DirectMusic Producer and create a new project by selecting File>New from the menu and selecting a project in the dialog box. Name your project, and choose a storage location for its data on your hard drive. Select File>Import File into Project>MIDI File as Segment from the menu. Navigate to the Unit I\Chapter 5\Tutorial Part One directory on the CD and select the file Tutorial_Bass_Melody.mid. The Segment opens automatically in the main screen of DirectMusic Producer.
A DirectMusic Segment file, created from a MIDI sequence.
This Segment has several tracks of data in it. The first is a Tempo Track, which controls the speed of playback. The second track is a Chord Track, which controls how DirectMusic transposes other Segments over this Segment. The next two tracks are Sequence Tracks containing note data. The final track is a Band Track, which controls the instrument patching.
Often, when importing data from sequencing programs, the data requires some amount of cleanup. In this case, there are several problems; first, the Segment is two bars long, yet the music in the Sequence Tracks is only one bar long. To fix this problem, right-click on the title bar of the window and select Properties.
The properties dialog box.
Note Almost everything in DirectMusic has a properties dialog; our Segment itself has one, as well as each track and each piece of data in each track.
Click on the button next to Length, and set the number of measures to one.
Patterns
The music we imported from the MIDI file is incredibly simplistic. It is a single bar of a bass line and melody and hardly interesting at that. However, music often exists as the collective of small patterns like this one, which play over various chord changes. Our next step is to make this small piece of music play over a series of chord changes, using DirectMusic's transposition functionality to adjust the notes to match the new chords.
Currently, our music is stored as a Sequence Track in our Segment. Sequence Tracks do not transpose to follow chords, and play exactly as the author wrote them. To get our melody and bass line to transpose over chord changes, we need to use a Pattern Track instead.
To create a new Pattern Track:
Select File>New.
Set the number of measures to one.
Select Pattern Track from the menu.
Select the Segment1.sgp (which was created) from the menu on the left-hand side.
Right-click and select Rename.
Rename the Segment to BassSegment.sgp.
We need to copy the data from our old Segment into the new Segment's Pattern Track. Select the Tutorial_Bass_Melody.sgt Segment and maximize track one's window. This opens the roll editor, where you can view and edit note data.
The roll editor displays note data, which you can edit right in DirectMusic Producer.
Select the first note in the window and press Ctrl+A to select all the notes. Press Ctrl+C to copy this data. Open Pattern Track one in our new Bass pattern. Click on the first beat in the measure, and press Ctrl+V to paste the data into the track. You may have to scroll the track up or down to see the note data.
Create a new Segment named Melody.sgt with a Pattern Track, and repeat this process with track two. At the end of the process, you need to point the Pattern Track to channel two by right-clicking on the Pattern Track to bring up the properties dialog box and set the pchannel to two.
Setting the Chord Reference
For DirectMusic to transpose a melody to a new chord, it needs to understand the relationship of the melody to its chord and scale. In our case, we base the bass line and melody off a C7 chord.
Add a Chord Track to the bass and melody Segments by right-clicking in the Segment window and selecting Add Track and Chord Track from the menus. Right-click on the first beat in the measure of the Chord Track and select Insert to insert a chord.
Figure 5-4: We define the chord and scale reference in the Chord Properties page. Here we use a C7 chord with a C Mixolydian scale.
On the bottom piano roll, set the chord to C7. Do this by clicking on the appropriate notes on the piano roll (C2, E2, G2, and Bb2). Now adjust the scale by changing the B natural to a Bb. Repeat this process for the second part as well.
Note You can copy the chord from the Chord Track and paste it in the other Segment's Chord Track, rather than resetting the notes manually.
Creating a Primary Segment
Now that both of our parts reference chords and scales, we must create a chord progression for them to play over. Create a new Segment called MasterSegment.sgt, set its length to four bars, and add a Chord Track. Place a series of chords in this Chord Track for the bass and melody parts to follow by selecting bar one and pressing Insert to insert a new chord. Use the following chord progression:
C7> F7> G7> C7
The notes and scales for these chords are shown here:
Chord
Chord Notes
Scale
--------------------------------------------------------------------------------
C7
C E G Bb
C D E F G A Bb
F7
F A C Eb
C D Eb F G A Bb
G7
G B E G
C D E F G A B
Adding your melody and bass line.
Add two Segment Trigger Tracks to MasterSegment.sgt. A Segment Trigger Track allows you to include another Segment inside of your Segment, which is extremely useful for organization. In your Segment Trigger Track, right-click on the first beat of the first bar and select Insert from the menu. Select your bass Segment from the drop-down box in the properties page. Now copy and paste this Segment into all four measures on the Segment. Repeat this process on the second track to include the melody as well. Play this Segment. Notice that your instrument settings vanish, and both tracks sound like a piano. To fix this, add a Band Track to the Segment, and copy the Band from your original, imported Segment file into this track.
When you are done, MasterSegment.sgt should look like this:
Your completed master Segment.
Play the Segment and notice how the notes now transpose to follow the chord progression.
Making Our Music Cooler
Play the Segment and notice that both the bass and melody move in a linear fashion. That is, when the chord changes from C7 to F7, both lines move up a fourth in parallel. If two musicians were to play this, it is unlikely that they would move through these changes in such a strict parallel fashion. DirectMusic allows us a number of ways to specify how a given part should move through the chord changes.
Open the properties page onto the F7 chord. Notice that there are four different chord and scale levels. Use these different levels to specify alternate ways in which DirectMusic should interpret the chord. On the second level of the chord, change the chord mapping so that the top two notes of the chord are on the bottom of the chord. It should now be composed of C, Eb, F, and A, which is the second inversion of the chord. For the G7 chord, set the second chord to the second inversion as well (in this case, C, E, G, and B). Your chord should look like this:
Setting up alternate ways for DirectMusic to interpret the G7 chord.
Now go back to your melody Segment file, right-click on an area of the pattern where no notes are found, and bring up the properties dialog. In the bottom, right-hand corner under Default Play Mode, set the chord level to Chord Level 2 so that this pattern follows the chord mappings specified in the second layer of the chord.
Adjusting chord levels.
Play MasterSegment.sgt again. Notice that while the bass is moving linearly through the chord change, the melody now uses the inversion to determine the root note of the melody. Save your project.
In case you are lost, there is a completed version of this section of the tutorial on the companion CD located in Unit I\Chapter 5\Tutorial Part One.
Variations
Now that we have a basic piece of music playing over some chord changes, we want to add some variation to the playback so that each time our bass line plays, it plays a little bit differently. Open the BassSegment.sgt that we created earlier, and open the Pattern Track. Notice the variation bar. By default, DirectMusic Producer fills in all of these variations with the same data.
Figure 5-9: The variation bar.
Select only the variation to work on. Notice in the above figure that we selected all variations because every number in the bar is depressed. You can quickly select or unselect all variations by clicking the vertical bar on the leftmost edge of the variation bar. Click this bar so that every variation number is not depressed, then select variation 2. Your variation bar should look like this:
Only variation 2 is selected.
In the pattern, raise the note on the second beat to an E, and lower the last note to an E. Your pattern should look like this:
Our first bass line variation.
If we play the project now, we would only hear this variation one out of 32 times, since DirectMusic fills out our 32 Segments for us by default. To have the variation play more often, disable all variations except for variations 1 and 2 by deselecting variation 2 and selecting variations 3 and higher. Right-click on the Variation tab, and select Disable. Your Variation tab should now look like this:
Variations 1 and 2 are enabled, while all others are disabled.
Play the master Segment, and notice how both our original bass line and our variation play.
Again, we saved a completed version of this section of the tutorial on the companion CD in the folder Unit I\Chapter 5\Tutorial Part Two.
Styles
In the previous two sections of this chapter, we stored our musical data in Pattern Tracks. Pattern Tracks have a lot of power, as they can follow chord changes in multiple ways and contain up to 32 variations. However, even more powerful than patterns are Styles. As defined in Chapter 4, a Style is a collection of patterns, which DirectMusic chooses based on various parameters. Each pattern within a Style acts just like Pattern Tracks, containing chord mappings and variations. Moreover, because you can place multiple patterns within a Style, they allow you an unlimited number of variations. More importantly, they respond to the groove level.
While groove level can be used in many ways, it is easiest to think of it as an intensity filter. Each pattern within a Style has a groove range in which it is valid. Our melodic line might be simpler at groove levels one through ten, while a more active one is used from 11 to 20. When the Style is choosing the pattern to play, it looks at the current groove level and determines which patterns are valid within the Style. A typical game implementation involves tying groove level to the intensity of the current game situation. If there is a lot of action going on, the groove level raises and the music intensifies, and when the action dies down, the groove level lowers and the music calms down.
Creating Our First Style
Create a new Style by clicking File>New and selecting Style from the menu. In the left-hand menu, open the folder in the Style named Patterns. Double-click on the pattern to open it. Using the same techniques we used in the first tutorial in this chapter, copy the data from our melody pattern to this Pattern Track. You will need to set the pchannel for this part to two, as well. Now select the pattern in the left-hand menu, and press Ctrl+C to copy it into memory and Ctrl+V to paste it. Your Style should now have two patterns called pattern one and pattern two. Open pattern two, and adjust the notes to make the melody into more of an accompaniment Style line. You can use the right-click menu on the mouse to add new notes if you need to. Our accompaniment looks like this:
Our accompaniment pattern.
Rename the Style Piano.
Open our MasterSegment file, and use the right-click menu to delete our current melody Segment Trigger Track. Use the right-click menu to add a Style Track. Right-click on the first bar in the Style Track, and select Insert. Select our Piano Style from the menu.
Press Play on the master Segment and notice that both patterns are chosen from our Style. Also of note is that we do not have to place references to our Style in every measure of the master Segment. This is because a Style Track is assumed to repeat, unlike our Segments, which have a fixed length.
Adding Groove Level
Go back to our Style, and bring up the properties on pattern two. Notice that there is a Low and High setting under Groove Range. This sets which groove levels this pattern is valid. Set these numbers to 1 and 10, respectively. This will make this pattern only viable from groove levels one to ten.
Now select pattern one, and set its groove range from five to 100.
Go back to our master Segment, and use the right-click menu to add a new track. This time, select Groove Track from the menu. Select the first bar in the Groove Track and press Insert.
Play the master Segment, and notice that only pattern two is used. This is because our groove level is set to 1, which is not a valid groove level for pattern one to play. Now set the groove level to 6 in our Groove Track, and play the master Segment. You will notice that both patterns now play. This is because both patterns are valid, so DirectMusic will choose between them every measure.
Set the groove level to 11 in our Groove Track. You will notice that only pattern one plays, because pattern two's groove range is too low to play. Save your project.
The wonderful thing about using groove levels to control your music is that it's very easy to work with and test on the musical end and provides a simple mapping for a game to use that doesn't require your programmers to understand how your music is composed. Often, groove level can be tied to something very simple for a game engine to understand, such as the number of monsters in the area, and the composer can decide what the music should do in these cases.
Once again, we saved a completed version of this section of the tutorial on the companion CD in the folder Unit I\Chapter 5\Tutorial Part Three.
This chapter offered some insight into the basic mechanics of using DirectMusic Producer. While DirectMusic Producer can seem daunting at first, once you become familiar with the interface, you will find it efficient and well designed. Remember to start small and be prepared to build several projects as a learning experience.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment