A named per-app submix returned by datumhue.audio.bus; every instance routed to it with the bus option field sums into it, then runs its chain: filter, delay, reverb, volume. Its effects' tails ring after its members end.
Bus gain, clamped to 0..4 (starts at 1.0). An assignment reads back at once and glides like Audio.volume; the audible volume is master x bus x instance. nil once the bus is removed.
level
number?
read-only
The RMS of the bus's output over the last 1024 frames heard (about 21 ms at 48 kHz), linear, after its effects and volume; nil once the bus is removed.
peak
number?
read-only
The largest absolute sample of the bus's output over the same span as level; nil once the bus is removed.
The bus's filter, or nil with none. Assigning a table merges into it (creating it, with its required keys, when there is none); assigning nil removes it with a 20 ms crossfade.
The bus's echo, or nil with none. Assigning a table merges into it (creating it, with its required keys, when there is none); assigning nil removes it with a 20 ms crossfade.
Example
local blip = { waveform = "square", frequency = 660 }
datumhue.audio.sfx({ blip }, { bus = "music" })
-- A table adds an echo every 0.375 s, each repeat half the last.
music.delay = { time = 0.375, feedback = 0.5 }
-- A later table merges: the time stays, the repeats get quieter.
music.delay = { wet = 0.25 }
print(music.delay.time, music.delay.wet) --> 0.375 0.25-- nil removes it.
music.delay = nil
The bus's reverb, or nil with none. Assigning a table merges into it (creating it, with its required keys, when there is none); assigning nil removes it with a 20 ms crossfade.
Example
local blip = { waveform = "square", frequency = 660 }
datumhue.audio.sfx({ blip }, { bus = "music" })
-- A table adds a large room. The levels left out follow from `space`-- when the reverb is made, and keep their values after that.
music.reverb = { space = 0.8 }
-- A later table merges: the same room, heard more dry.
music.reverb = { wet = 0.25, dry = 1 }
print(music.reverb.wet, music.reverb.dry) --> 0.25 1.0
Ramp the bus gain linearly to volume (clamped to 0..4) over seconds, sample-exact; assigning volume cancels the ramp, and a seconds of 0 or less is an assignment.
Example
datumhue.audio.synth({
waveform = "sine",
looping = true,
bus = "music",
})
-- Fade everything on the bus to silence over 1.5 seconds.
music:volume_to(0, 1.5)
Fade the bus out over 20 ms with every sound routed to it, end those sounds, and free the bus's place among the app's buses. Its handle and its sounds' handles read as gone at once, and their on_end callbacks do not run; audio.bus with its name later makes a new bus.
Example
datumhue.audio.synth({
waveform = "sine",
looping = true,
bus = "music",
})
-- Fade the bus and its sounds out over 20 ms, and free its place.
music:remove()