7.9.5. AUDIO-05 — Reverb and Effects
This tutorial covers applying reverb and chorus effects to sounds. A short impulse burst is played dry, then with several reverb presets, then with chorus configurations, and finally with both combined.
7.9.5.1. Reverb Basics
Reverb simulates the acoustic reflections of a physical space. The dasAudio module implements the I3DL2 standard, which defines a set of named presets modelling environments from a small bathroom to a vast cave.
To hear the effect clearly, the tutorial generates a very short (0.1-second) decaying sine burst at 880 Hz. The rapid decay leaves silence for the reverb tail to ring out:
def make_impulse() : array<float> {
let num_samples = MA_SAMPLE_RATE / 10 // 0.1 seconds
return <- [for (x in range(num_samples));
sin(2.0 * PI * 880.0 * float(x) / float(MA_SAMPLE_RATE)) * exp(-float(x) / float(num_samples) * 6.0)
]
}
Without reverb the impulse is a short “tick” that ends abruptly.
7.9.5.2. Applying Presets
set_reverb_preset attaches an I3DL2 reverb to a playing sound,
identified by the sound ID returned from play_sound_from_pcm. The
second argument is a value from the ReverbPreset enumeration:
var samples <- make_impulse()
let sid = play_sound_from_pcm(MA_SAMPLE_RATE, 1, samples)
set_reverb_preset(sid, ReverbPreset.ConcertHall)
Each preset models a different acoustic space with its own decay time, high-frequency damping, and early-reflection pattern.
7.9.5.3. Preset Reference
The ReverbPreset enumeration contains 23 presets:
Preset |
Character |
|---|---|
|
Neutral, medium-sized room |
|
Very small, heavily damped |
|
Average room |
|
Small, bright reflections, short tail |
|
Soft furnishings, moderate decay |
|
Hard surfaces, clear reflections |
|
Large hall, smooth decay |
|
Spacious, warm, long smooth decay |
|
Massive, dark reverb, very long tail |
|
Large open space |
|
Huge metallic space |
|
Damped corridor |
|
Narrow reflective corridor |
|
Hard-walled corridor |
|
Outdoor narrow passage |
|
Diffuse outdoor scattering |
|
Urban reflections |
|
Distant echoes |
|
Large outdoor pit |
|
Open flat ground |
|
Concrete enclosure |
|
Cylindrical metallic tube |
|
Heavy low-pass filter, muffled |
7.9.5.4. Chorus
Chorus adds a modulated delay to simulate multiple detuned copies of the
sound, producing width and shimmer. set_chorus_default applies sensible
defaults; set_chorus accepts a ma_chorus_config for fine control:
// Default chorus
let sid = play_sound_from_pcm(MA_SAMPLE_RATE, 1, samples)
set_chorus_default(sid)
// Custom chorus — slower, deeper
var cfg = chorus_config_default()
cfg.rate = 0.5 // LFO rate in Hz
cfg.depth = 0.8 // modulation depth
cfg.delay_ms = 15.0 // base delay
cfg.wet = 0.7 // wet/dry mix
set_chorus(sid, cfg)
The ma_chorus_config fields are:
Field |
Description |
|---|---|
|
LFO modulation rate in Hz |
|
LFO modulation depth (0.0–1.0) |
|
Base delay in milliseconds |
|
Feedback amount (0.0–1.0) |
|
Wet/dry mix (0.0 = dry, 1.0 = fully wet) |
7.9.5.5. Combining Effects
Reverb and chorus can be applied to the same sound — chorus runs after reverb in the signal chain:
var samples <- make_impulse()
let sid = play_sound_from_pcm(MA_SAMPLE_RATE, 1, samples)
set_reverb_preset(sid, ReverbPreset.ConcertHall)
set_chorus_default(sid)
7.9.5.6. Running the Tutorial
Run from the project root:
daslang.exe tutorials/dasAudio/05_reverb.das
The tutorial plays the impulse dry, with reverb presets, with chorus variations, and finally with reverb and chorus combined.