Microsoft DirectX 9.0

WAV-Based Segments

DirectMusic can load and play WAV files, but greater flexibility is provided by DirectMusic Producer segments containing wave tracks. A segment can contain any number of wave tracks, and a wave track can contain multiple waveforms.

WAV-based DirectMusic Producer segments can be used to create sound effects and ambient audio that do not sound repetitive. Each part in a wave track can have up to 32 variations, and every waveform in the part is assigned to one or more of these variations. Each time the track plays, one of the variations is selected for each part, and only the waveforms assigned to that variation are heard. Because different parts can play different variations, a two-part wave track could play in up to 1024 different ways. For an example of the use of waveform variations, see the Audio Scripts Sample.

Waveform variations are authored into segments. Applications do not control the selection of variations.

Another advantage of WAV-based segments over WAV files is that the waveforms can be in compressed format. The DirectMusic loader can load compressed waveform audio files in any format supported by the audio compression manager (ACM).

Segments loaded from WAV files are played just like any other segment. They pass through the performance as DMUS_WAVE_PMSG messages and are always played on channel 0 of the audiopath. Although waveforms are not synthesized in the same sense as musical notes, they do pass through the synthesizer and can be manipulated by MIDI controllers.

Waveforms are analogous to band instruments and must be downloaded to the synthesizer before being played. Waveforms are downloaded when the segment's bands are downloaded.

Waveforms can be either static or streaming. Static waveforms are loaded into synthesizer memory all at once. Streaming waveforms are loaded piece by piece as they play. Waveforms saved as DirectMusic Producer files are designated as static or streaming by the author, who also sets the readahead time; that is, the maximum amount of data that is copied into memory at one time. Waveforms from standard WAV files are streamed if longer than 5000 milliseconds, with a readahead of 500 milliseconds.