Microsoft DirectX 8.1 (Visual Basic)

DLSEffects

Description

The DLSEffects sample shows how an application can use DLS instruments for sound effects, and how to send MIDI messages.

Path

Source: (SDK root)\Samples\Multimedia\VBSamples\DirectMusic\DLSEffects

Executable: (SDK root)\Samples\Multimedia\VBSamples\DirectMusic\Bin

User's Guide

Click the buttons labeled C3 to C10 to play a vocal effect. Click On to play the heartbeat effect continuously, and vary the pitch by using the Note and Pitch Bend sliders. Set the velocity (volume) of notes by using the slider on the right. Changes in velocity apply only to sounds started after the change is made.

Programming Notes

The DLS instruments are taken from Boids.dls. That collection contains only a single instrument, called Vocals, which is based on different wave samples for different regions, or ranges of notes. For example, the first speech sound is used when any MIDI note between C3 and B3 is played. The speech sounds are played at the original pitch only when the note is the lowest one in the region.

One of the samples, called Heartbeat, is valid for the range B7-B8. Because this is not a speech sample, the pitch can reasonably be varied. This is done by playing various notes within the range, as determined by the slider setting.

Heartbeat is also the only sample in the DLS collection that is based on a looped wave, so that it can be played continuously as long as the note is on. The other samples play only once regardless of the duration of the note.