Beginning Game Audio Programming [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Beginning Game Audio Programming [Electronic resources] - نسخه متنی

Mason McCuskey

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید





DIRECTMUSIC IN TRACKED MUSIC TERMS

So, I've just dumped all these new objects and metaphors on you, and you're probably wondering how on Earth you're going to piece everything together. To help out, this section will explain DirectMusic from a slightly different angle—by comparing it to tracked music.

The tracked music (IT, S3M, and so on) hierarchy of objects goes something like this:



    Rows: The "spots" where you can put notes. Most are empty, but some contain notes, volume, and/or effects and commands (for example, G01, which says, "Don't play this note directly, instead slowly slide to it from the last note.")



    Tracks: (also called columns or voices): Tracks are essentially arrays of spaces. Tracks are usually 64 spaces long, but some editors (for example, Impulse Tracker) allow you to change the track lengths for a pattern.



    Patterns: Also known as tables, patterns are the core building blocks of the music. A piece of tracked music consists of at least one pattern, usually more. A 64-row pattern is usually divided up into 4 measures of 16 beats each… put a note on every four rows and you have the most basic quarter note, 4/4 time rhythm; put two notes two rows apart and you have an eighth-note pair (see Figure 11.4).


    Figure 11.4: A sequence of notes in a tracker and in sheet music form.



    Order List: Also known as a pattern list or pattern sequence, this is the list that specifies the order in which patterns should be played.



    Sample list: This is the list of all the digital samples used in the song. Each entry in a sample list contains the name of an instrument, until of course, the song is done and the composer overwrites those names so that they collectively form a few paragraphs of text and/or ASCII art.



    Sample Parameters: Parameters for each sample (default volume and panning).



    Happily, all of these constructs have counterparts inside DirectMusic. Here are the differences between these core tracked music objects and DirectMusic objects.


    Rows Are DirectMusic Notes


    In DirectMusic, there aren't really "rows" as you know them. Instead, each note has a timestamp and a duration attached to it that tells DirectMusic when to play it, and for how long (give or take a few hundred milliseconds, to simulate a human being). The resolution on these timestamps is incredible, making it easy to do weird things like triplets and odd time signatures.

    DirectMusic divides time up into bar, beat, grid, and tick, as well as a fifth optional +/-parameter that specifies how early or late the note can be (in ticks). For example, if I had a note that started on the first bar, first beat, first grid, and 50th tick (yes, an odd note), and I put in a +/− value of 10, DirectMusic would play the note sometime between the 40th and 60th tick. (That was just an example; in real life, 99.9% of your notes are going to fall on tick zero because you hardly ever need that level of fine control). Each note's duration has a similar +/− value to randomize its length.

    Notes also have volumes, only they're called velocities now. Again, there's a +/− value to specify a velocity range.


    Columns Are DirectMusic Parts


    Zooming out one level—tracked music's columns are analogous to DirectMusic parts. You have one part per instrument, so a string quartet would have four parts. In DirectMusic, you can only have one instrument for each part—you can't create one part that contains multiple instrument sounds. This is very different than what you're used to; in tracked music, you overlaid different instruments onto the same track because tracks were a precious commodity, but DirectMusic supports literally hundreds of parts, so there's no need to cram multiple instruments together.


    Patterns Are Still Patterns


    Zoom out again, and you're up to patterns. Tracked music patterns are akin to (drum roll)… DirectMusic patterns! But, they're not exactly the same. In tracked music, patterns are usually short (four measures is usually the maximum, if your song's calm and your tempo is slow), but in DirectMusic you'll usually want your patterns to be several measures long. A good rule is to make your pattern about as long as the background music for any game on an 8-bit console system (for example, the original Nintendo). In other words, something like 30 seconds to a minute—four or eight measures in style A, followed by four or eight measures in style B, then looping back to style A. Of course, there's no rule that says they have to be like that—if you want you could make each pattern a measure, or you could put your entire song into one pattern.

    Good dynamic music should include several different patterns at different "groove levels" (a.k.a. intensity levels).


    Order Lists Are Groove Level Tracks and Style Tracks


    This brings us to the final analogy, and perhaps the most different. In DirectMusic, there's not really such a thing as an order list (or pattern list). Instead, there are two types of tracks living inside a segment. There's a style track, which tells DirectMusic the "pool" of patterns that segment can pick from (remember, a style is really just a collection of patterns), and the groove track, which narrows down the pool of patterns by dictating a groove level.

    For example, let's say your segment's style track is constant, and that it specifies MyCoolStyle.stp as the style for the entire song. Inside MyCoolStyle.stp are two patterns. Pattern A has a groove range of 1–60. Pattern B has a groove range of 50–100. When your segment groove level track specifies a groove level of 1, the only Pattern that can play is Pattern A—Pattern B's groove range is too high for the current groove level. Conversely, if your segment groove level track specifies a groove level of 75, only Pattern B can play. Something interesting happens if you specify a groove level of 55— that's within the range of both patterns, so DirectMusic randomly chooses one to play.

    If you're just starting out and this is too confusing to think about, you could pretend you were writing tracked music by doing the following:



      Give each pattern a unique groove level—not a range, but a single number. This first pattern is groove level 1, the second is groove level 2, and so on.



      Add a style track to your segment and have it always play from the same style (where all your song's patterns are stored).



      Now, you can use the groove level as an order list. In the groove track, specify a new groove level, and the corresponding pattern will play. It's still not exactly the same—unlike in tracked music, your groove track can switch patterns at any time, not just on pattern boundaries—but it's pretty darn close.



      If you want to then get fancy, you can give multiple patterns the same groove level range and DirectMusic will choose between them randomly.



    Actually, I lied. There's more to it than that—when you change the groove level in your segment's groove level track, you can tell DirectMusic what to do when more than one pattern can be legally played. You can tell it to do any one of the following, via the dialog box shown in Figure 11.5:



      Choose one pattern at random, play it, then choose another pattern at random, play it, and so on until the groove level changes. This is the default behavior.



      Choose one lucky pattern at random and loop it continuously until the groove level changes. This is called "Repeat Same."



      Start with the first valid pattern and play all of them in sequence, then loop back to the first one, until the groove level changes. This is called "Sequential from First."



      Start with a random pattern and play it, followed by the next sequential pattern, wrapping around if necessary until the groove level changes. This is called "Sequential from Random."



      Shuffle all legal patterns into a random order, play them in that order, and repeat until the groove level changes. This is called either "Shuffle" or "No repeat," depending on if you want patterns to repeat before all patterns have been played.




      Figure 11.5: The Groove Level Properties dialog.


      Sample Lists Are DLS Collections


      To create anything in tracked music, you must have instrument samples. In DirectMusic, you don't necessarily need to provide your own WAV files. All DirectMusic compositions can use the entire General MIDI sound set by default. The General MIDI sound set contains 127 different instruments, ranging from pianos and violins to special effects and shakuhachis. These high-quality samples are built into DirectX, and you're guaranteed that they will sound the same on all platforms.

      Thanks to this sound set, it's actually quite common to have a DirectMusic score that contains no custom samples. However, the sound set still can't help you when you want to include things like drum loops, lyrics, and wicked guitar licks in your music. That's why DirectMusic supports DLS collections.

      DLS collections are far more advanced than what you're used to in tracked music. Most tracked music formats only allow an instrument to be one sample; in DLS you can have different samples for different note pitches. You can also adjust the ADSR (attack, decay, sustain, and release) of your instruments, both in terms of relative volume and relative pitch. You can also create drum sets. There's a lot of power in there, if you need it.


      Sample Parameters Are Bands


      There isn't really a tracked-music equivalent to a DirectMusic band. That's because you can't share sample lists between different tracked music files—each file embeds its own samples, and that's that.

      But imagine if you could share samples. You'd want each file to use the same samples, but possibly with different volume and panning parameters. For example, in song 1, you might want the default volume of the flute sample to be high, since it's carrying the melody. But in song 2, where the flute is in the background, you'd want its default volume to be much lower.

      That's why DirectMusic has bands. In DirectMusic, it's not only possible, but quite common, for two different songs to share the same samples. At the very least, everybody shares the General MIDI sound set, so you need a place where you can say, "Okay, for this song, take that shakuhachi, make it loud, and make it come mainly out the left speakers." Another song might want it at half-volume played from the left speaker; bands provide that flexibility.


      Summary: DirectMusic Is More Than a Tracker


      Many concepts are similar in DirectMusic and tracked music, and I provided this section to give all of you tracked music pros a foundation on which to stand. That being said, do not limit yourself to thinking of DirectMusic as just another tracker. Writing dynamic music using DirectMusic and writing tracked music are very different, both in terms of concept and process. Take the time to learn the DirectMusic way of doing things, and it will pay off with better dynamic music for your games.

/ 127