Skip to main content

Audio Mixer

Central volume bus for a game: one master level, a mute, three channel levels, ducking and fades, published as three volumes for your Sound nodes. Browser only; it never reaches the RGS.

Wire Music Volume, SFX Volume and Voice Volume into the volume input of your Sound nodes. Each is master × that channel's level × the duck factor, all in 0..1, and 0 while Muted is true. The level inputs are clamped to 0..1, and the defaults are 1 everywhere and unmuted, so the bus starts transparent.

Fire Duck to pull every channel down to Duck Level (default 0.3) over Duck Time (ms) (default 250) for a big-win voice-over or a dialog, and Unduck to restore over the same time. Duck Active reports the state; a Duck while ducked, or an Unduck while not, does nothing. Changing Duck Level while ducked re-ramps to the new level.

Any other change (master, mute, a channel level) ramps over Fade Time (ms); the default 0 applies it immediately. Changes made in one update are merged into a single ramp, and the most recent change decides its length. A new change restarts the ramp from the current values, so nothing jumps. A change that leaves the targets where they are produces no ramp and no signal.

Changed fires on every value update, including each frame of a ramp, so it can kick a Sound node that only re-reads its volume on a signal. Ramps are linear and run on the browser's animation frames, or a timer where none exists; they are cancelled when the node is deleted.

Inputs​

Levels​

DataDescription
Master (number)Overall level, 0..1, multiplied into every channel. Default 1.
Muted (boolean)True silences every channel (all volumes 0), ramping over Fade Time. Default false.
Music (number)Music channel level, 0..1. Default 1.
SFX (number)Sound-effects channel level, 0..1. Default 1.
Voice (number)Voice channel level, 0..1. Default 1.
Fade Time (ms) (number)Length of the ramp for master, mute and channel changes, ms. Default 0 = immediate.

Actions​

SignalDescription
DuckLowers every channel to Duck Level over Duck Time; ignored while already ducked.
UnduckRestores the channels over Duck Time; ignored while not ducked.

Ducking​

DataDescription
Duck Level (number)Factor applied to every channel while ducked, 0..1. Default 0.3.
Duck Time (ms) (number)Length of the duck and unduck ramps, ms. Default 250; 0 is immediate.

Outputs​

Volumes​

DataDescription
Music Volume (number)master × music × duck factor, 0 while muted; wire it to the music Sound nodes.
SFX Volume (number)master × sfx × duck factor, 0 while muted; wire it to the effect Sound nodes.
Voice Volume (number)master × voice × duck factor, 0 while muted; wire it to the voice Sound nodes.

State​

DataDescription
Duck Active (boolean)True between Duck and Unduck.

Signals​

SignalDescription
ChangedFires on every volume update, including each ramp frame.

Usage​

  1. Wire Music Volume, SFX Volume and Voice Volume into the volume inputs of the matching Sound nodes.
  2. Wire the settings sliders into Master, Music, SFX and Voice, and the mute toggle into Muted; set Fade Time (ms) above 0 for smooth changes.
  3. Fire Duck when a voice-over or a dialog starts and Unduck when it ends.
  4. If a Sound node only applies its volume on a signal, drive that signal from Changed.
note

A mute is a ramp to 0 over Fade Time (ms). With a fade set, sound keeps playing for that long after Muted turns true; leave the fade at 0 for an instant mute.