Audio Effects
App: apps/audio_effects_demo/
A looping music track routed to a mixer group, with a button per effect that swaps the group’s
effect — reverb, echo, chorus, flanger, distortion, a pitch shift, a ring modulator —
plus a button that builds a serial chain (distortion → echo), and a row of direct-path
filter buttons (muffle / thin / clear) that shape the dry signal independently. The engine
builds the OpenAL EFX aux-slot chain (and the direct filter) behind the mixer via group.addEffect(type) +
MixerEffect.setParam and group.setLowPass/setHighPass (engine PLM-154/157 / ADRs 0051/0052). Needs a
device with ALC_EXT_EFX (otherwise the buttons no-op and the music stays dry).
% ./plume3d audio_effects_demoEach button replaces the Music bus’s effect chain with one effect, so you hear each in isolation; the last button stacks two effects into a chain. “Dry (clear)” returns to no effect.
What it does
Section titled “What it does”- Loads
sounds/TheFieldOfDreams.mp3(looping) and routes it toMixer.group("Music"). - Each effect button calls
clearEffects(),addEffect(type)(tuned withsetParam— echodelay/feedback, distortionedge/gain, …), thensetEffectMix(...)so the effect is clearly audible (it ducks the dry so the wet stands out — without it, a parallel wet effect is a whisper under the full-volume music). - The chain button adds two effects (distortion, then echo) to the same group; the engine links them in order.
- The filter buttons call
setLowPass/setHighPass/clearFilter— a dry-path filter that stacks on top of whatever effect is active.
Key pattern
Section titled “Key pattern”import "engine" for Mixer
var music = Mixer.group("Music")
music.clearEffects()var echo = music.addEffect("echo") // any EFX type by nameecho.setParam("delay", 0.2)echo.setParam("feedback", 0.5)
// A serial chain: distortion -> echo on one bus.music.clearEffects()music.addEffect("distortion").setParam("edge", 0.3)music.addEffect("echo").setParam("delay", 0.18)- Mixer —
group.addEffect(type),addReverbPreset,clearEffects,effectCount;MixerEffect.setParamand the per-effect parameter tables. - Audio — the looping music source.
- Gui — the effect buttons.
Related
Section titled “Related”- Example: Audio Reverb — the reverb effect on its own, with live presets.
- Example: Audio Mixer — Music / SFX / Ambience buses with live faders.