Platform SDK: DirectX |
This topic pertains only to application development in Visual Basic. See DirectMusic C/C++ Samples.
The DLSEffects sample application shows how an application can use DirectMusic and DLS files for sound effects other than music.
Source: (SDK root)\Samples\Multimedia\VBSamples\Dmusic\Src\DLSEffects
Executable: (SDK root)\Samples\Multimedia\VBSamples\DMusic\Bin\DLSEffects.exe
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 effects started after the change is made.
This application demonstrates the use of downloadable sounds for sound effects, and how to send MIDI notes.
The DLS instruments are taken from Boids.dls. That collection actually contains only a single instrument, called Vocals. However, the instrument is based on different wave samples for different "regions" or ranges of notes. For example, the first speech sound is used when any note between C3 and B3 is sent. The speech sounds are played at the correct 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 vocal 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. Hence it can be played continuously for up to the maximum duration of a note. The other samples will play only once regardless of the duration of the note sent.