Skip to content

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).

Terminal window
% ./plume3d audio_effects_demo

Each 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.

  • Loads sounds/TheFieldOfDreams.mp3 (looping) and routes it to Mixer.group("Music").
  • Each effect button calls clearEffects(), addEffect(type) (tuned with setParam — echo delay/feedback, distortion edge/gain, …), then setEffectMix(...) 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.
import "engine" for Mixer
var music = Mixer.group("Music")
music.clearEffects()
var echo = music.addEffect("echo") // any EFX type by name
echo.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)
  • Mixergroup.addEffect(type), addReverbPreset, clearEffects, effectCount; MixerEffect.setParam and the per-effect parameter tables.
  • Audio — the looping music source.
  • Gui — the effect buttons.