DatumHueEnterprise v0.0.24datumhue.com
Contents

namespaceAudio7 functions, 5 propertiesUI apps only

datumhue.audio

Synthesis, sound effects, music, sample playback and buses, made as they play: a call costs time in proportion to its notes, not to how long the sound lasts, and every control can move while it plays.

Returns handles
Vec2, Audio, Music, AudioBus

Fields 5

FieldTypeAccessDescription
master_volumenumberread/writeLinear volume over everything the app plays, clamped to 0..4 (1.0 = unchanged); in the root app, the workstation's volume over every app. An assignment reads back at once and glides like Audio.volume; every app shares one limiter, so a loud app makes room for itself.
levelnumberread-onlyThe RMS of what the app played over the last 1024 frames heard (about 21 ms at 48 kHz), linear, after its master_volume; in the root app, of the whole output. 0 before the app has made a sound.
peaknumberread-onlyThe largest absolute sample over the same span as level.
listenerVec2read/writeWhere the app's ear stands, in the units of the at its sounds are played with: every one played without a listener of its own is heard from here. An assignment moves the ear, and their pans and distance gains glide to follow like Audio.volume.
Example
-- The ear follows the player: every sound played with `at` and no
-- `listener` of its own pans and fades as the player walks by.
local player = datumhue.math.vec2(-300, 0)
datumhue.on_update(function(dt)
    player = player + datumhue.math.vec2(100 * dt, 0)
    datumhue.audio.listener = player
end)
latencynumberread-onlySeconds from a sound being made to it being heard: step, slot, position, on_step and playing turning false report heard time, audio.now() - audio.latency.

Functions 7

datumhue.audio.synth

functionUI apps only
datumhue.audio.synth(opts: audio.SynthOptions) -> Audio

Play a tone. A one-shot tone releases after duration; a looping one holds until release or stop. Sounds started in the same callback begin on the same sample.

Example
-- A pad that swells in over a second and holds until released.
local pad = datumhue.audio.synth({
    waveform = "triangle",
    frequency = 110,
    volume = 0.3,
    looping = true,
    envelope = { attack = 1, release = 2 },
})
-- pad:release() fades it out over its 2-second release.

opts audio.SynthOptions options 23 keys, 8 inherited

KeyTypeDefaultDescription
waveform required"sine" | "square" | "triangle" | "sawtooth" | "noise" | Wavetableno defaultOscillator waveform: a named shape or a Wavetable.
frequencynumber440Tone frequency in Hz.
durationnumber0.5Tone duration in seconds; a looping tone ignores it.
volumenumber1Linear volume, clamped to 0..4: the instance gain the handle's volume reads and writes.
pitchnumber1Playback rate, clamped to 0.25..4: the handle's starting pitch.
pannumber0Stereo position, -1 (left) .. 1 (right), clamped; live through the handle's pan. A non-zero pan with at raises.
loopingbooleanfalseHold the tone until release or stop.
busstringno bus; the audible volume is master x instanceRoute through the app's named bus (created on first use); the audible volume is master x bus x instance.
envelopeaudio.Envelope2 ms edgesThe tone's volume envelope.
filteraudio.Filterno filterA filter on the tone, live through the handle's filter.
dutynumber0.5; giving it for any waveform but square raisesPulse width 0..1, clamped; live through the handle's duty.
noise_mode"white" | "long" | "periodic"white noise; giving it for any waveform but noise raisesThe noise generator.
syncnumberno syncHard sync: the cycle runs at this ratio of frequency and restarts at each cycle of frequency.
ringnumberno ring modulationRing modulation by a ±1 square at this ratio of frequency.
start_timenumberthe tone starts nowStart at this audio.now() time; equal times start on the same sample.
From audio.PositionalOptions
atVec2the sound plays centered and unattenuatedWhere the sound stands, in any 2D unit kept consistent with its ear. Pan comes from the horizontal offset (via pan_scale / pan_limit), loudness from the distance curve (falloff_*, max_distance); both follow the handle's at and the ear as they move. Every other positional field requires it.
listenerVec2the sound follows audio.listenerThis sound's own ear, in the units of at; it stays where it is put.
max_distancenumberdistance never silences the soundDistance past which the sound is silent.
pan_scalenumber128 unitsHorizontal offset at which the sound would pan fully to one ear; must be > 0.
pan_limitnumber0.8Cap on the pan's magnitude, 0..1, so a distant source never sits in one ear alone.
falloff_capnumber1Ceiling on the arriving gain.
falloff_gainnumber1Numerator k of the distance curve min(falloff_cap, k / (1 + d / falloff_scale)).
falloff_scalenumber128 unitsDistance at which the curve has halved a unit falloff_gain; must be > 0.

datumhue.audio.sfx

functionUI apps only
datumhue.audio.sfx(notes: audio.SfxNote[], opts?: audio.SfxPlayOptions) -> Audio

Play a sequence of notes once (an array of note tables).

Example
-- A coin pickup: a thin pulse blip, then a higher note sliding up.
local blip = {
    waveform = "square",
    frequency = 988,
    duration = 0.05,
    duty = 0.125,
}
local ring = { waveform = "square", frequency = 1319, slide = 1760 }
-- A little to the left, in a small room.
datumhue.audio.sfx({ blip, ring }, { pan = -0.3, space = 0.2 })

notes audio.SfxNote options 16 keys

KeyTypeDefaultDescription
waveform required"sine" | "square" | "triangle" | "sawtooth" | "noise" | Wavetableno defaultOscillator waveform for this note: a named shape or a Wavetable.
frequencynumber440Tone frequency in Hz.
durationnumber0.1Note duration in seconds, at least 0.001: the note's gate.
volumenumber1Linear volume for this note, at most 4 (clamped); 0 is a rest, which lets the previous note's release ring on.
slidenumberthe pitch holdsTarget frequency in Hz to glide toward over the note.
vibratoaudio.Vibratono vibratoPitch vibrato parameters.
arpeggionumber[]no arpeggioSemitone offsets cycled per arpeggio step; an empty list is no arpeggio.
arpeggio_ticksnumber1; giving it without arpeggio raises1/60 s ticks per arpeggio step, fractions allowed.
envelopeaudio.Envelope2 ms edgesThe note's volume envelope.
pannumber0Stereo position, -1 (left) .. 1 (right), added to the play's pan and clamped.
dutynumber0.5; giving it for any waveform but square raisesPulse width 0..1, clamped.
duty_slidenumberthe duty holds; giving it for any waveform but square raisesTarget pulse width of a linear sweep across the note.
noise_mode"white" | "long" | "periodic"white noise; giving it for any waveform but noise raisesThe noise generator.
syncnumberno syncHard sync: the cycle runs at this ratio of frequency and restarts at each cycle of frequency.
sync_slidenumberthe sync ratio holds; giving it without sync raisesTarget sync ratio of a linear sweep across the note.
ringnumberno ring modulationRing modulation by a ±1 square at this ratio of frequency.

opts audio.SfxPlayOptions options 16 keys, 8 inherited

KeyTypeDefaultDescription
pannumber0Stereo pan, -1 (left) .. 1 (right), constant power with the centre at the sound's own level; live through the handle's pan. A non-zero pan with at raises.
spacenumber0Room size for the reverb tail, 0 (dry) .. 1 (a gymnasium); the tail rings until it has decayed to silence.
mufflenumber0Low-pass amount, 0 (open) .. 1 (through a shut door). Applied before the reverb tail.
volumenumber1Linear gain for this play as a whole, clamped to 0..4, on top of each note's own volume; adjust it live via the handle's volume.
pitchnumber1Playback rate, clamped to 0.25..4: the handle's starting pitch.
busstringno bus; the audible volume is master x instanceRoute through the app's named bus (created on first use); the audible volume is master x bus x instance.
filteraudio.Filterno filterA filter on the notes, live through the handle's filter.
start_timenumberthe notes start nowStart at this audio.now() time; equal times start on the same sample.
From audio.PositionalOptions
atVec2the sound plays centered and unattenuatedWhere the sound stands, in any 2D unit kept consistent with its ear. Pan comes from the horizontal offset (via pan_scale / pan_limit), loudness from the distance curve (falloff_*, max_distance); both follow the handle's at and the ear as they move. Every other positional field requires it.
listenerVec2the sound follows audio.listenerThis sound's own ear, in the units of at; it stays where it is put.
max_distancenumberdistance never silences the soundDistance past which the sound is silent.
pan_scalenumber128 unitsHorizontal offset at which the sound would pan fully to one ear; must be > 0.
pan_limitnumber0.8Cap on the pan's magnitude, 0..1, so a distant source never sits in one ear alone.
falloff_capnumber1Ceiling on the arriving gain.
falloff_gainnumber1Numerator k of the distance curve min(falloff_cap, k / (1 + d / falloff_scale)).
falloff_scalenumber128 unitsDistance at which the curve has halved a unit falloff_gain; must be > 0.

datumhue.audio.music

functionUI apps only
datumhue.audio.music(opts: audio.MusicOptions) -> Music

Play patterns in sequence, each entry one or more patterns together as tracks on one clock. Edit it live through the returned Music.

Example
local bass = { waveform = "triangle", frequency = 110, duration = 0.25 }
local lead = { waveform = "square", frequency = 440, duration = 0.5 }
datumhue.audio.music({
    patterns = {
        { bass, bass, bass, bass },
        { lead, lead },
    },
    -- Pattern 1 (the bass) alone, then patterns 1 and 2 together.
    sequence = { 1, { 1, 2 } },
    looping = true,
    bus = "music",
})

opts audio.MusicOptions options 10 keys

KeyTypeDefaultDescription
patterns requiredaudio.SfxNote[][]no defaultPatterns; each is an array of one or more note tables.
sequence required(integer | integer[])[]no default1-based pattern indices played in order. An entry that is a list plays those patterns together as tracks; the first sets the entry's length. An index outside the patterns raises.
loopingbooleanfalseLoop the sequence.
volumenumber1Linear playback volume, clamped to 0..4: the instance gain the handle's volume reads and writes.
pannumber0Stereo position, -1 (left) .. 1 (right), clamped; each note's own pan adds to it. Live through the handle's pan.
temponumber1The starting Music.tempo.
pitchnumber1Playback rate, clamped to 0.25..4: the handle's starting pitch.
busstringno bus; the audible volume is master x instanceRoute through the app's named bus (created on first use); the audible volume is master x bus x instance.
filteraudio.Filterno filterA filter on the music, live through the handle's filter.
start_timenumberthe music starts nowStart at this audio.now() time; equal times start on the same sample, and a past time joins the music where it would be.

datumhue.audio.play

functionUI apps only
datumhue.audio.play(asset: AudioAsset, opts?: audio.PlayOptions) -> Audio

Play an audio asset. One still loading starts when it arrives; one that failed to load raises.

Example
local click = datumhue.package:dir():read("sounds/click.ogg"):audio()
datumhue.audio.play(click, {
    volume = 0.8,
    pitch = 1.5,
    -- To the right of the app's ear, in your own world units.
    at = datumhue.math.vec2(200, 0),
    max_distance = 800,
})

opts audio.PlayOptions options 16 keys, 8 inherited

KeyTypeDefaultDescription
volumenumber1Linear volume, clamped to 0..4: the instance gain the handle's volume reads and writes.
pannumber0Stereo position, -1 (left) .. 1 (right), clamped; live through the handle's pan. A non-zero pan with at raises.
loopingbooleanfalseLoop playback when true.
pitchnumber1Playback rate, clamped to 0.25..4: the handle's starting pitch.
offsetnumber0Seconds into the clip to start at, in the clip's own time. A negative offset raises; one past the end ends the play at once.
busstringno bus; the audible volume is master x instanceRoute through the app's named bus (created on first use); the audible volume is master x bus x instance.
filteraudio.Filterno filterA filter on the sound, live through the handle's filter.
start_timenumberthe sound starts nowStart at this audio.now() time; equal times start on the same sample.
From audio.PositionalOptions
atVec2the sound plays centered and unattenuatedWhere the sound stands, in any 2D unit kept consistent with its ear. Pan comes from the horizontal offset (via pan_scale / pan_limit), loudness from the distance curve (falloff_*, max_distance); both follow the handle's at and the ear as they move. Every other positional field requires it.
listenerVec2the sound follows audio.listenerThis sound's own ear, in the units of at; it stays where it is put.
max_distancenumberdistance never silences the soundDistance past which the sound is silent.
pan_scalenumber128 unitsHorizontal offset at which the sound would pan fully to one ear; must be > 0.
pan_limitnumber0.8Cap on the pan's magnitude, 0..1, so a distant source never sits in one ear alone.
falloff_capnumber1Ceiling on the arriving gain.
falloff_gainnumber1Numerator k of the distance curve min(falloff_cap, k / (1 + d / falloff_scale)).
falloff_scalenumber128 unitsDistance at which the curve has halved a unit falloff_gain; must be > 0.

datumhue.audio.bus

functionUI apps only
datumhue.audio.bus(name: string) -> AudioBus

Get or create the app's named bus — the same name always returns the same bus. Route sounds into it with the constructors' bus option field. Past 32 buses an app's new bus raises.

datumhue.audio.wavetable

functionUI apps only
datumhue.audio.wavetable(levels: number[]) -> Wavetable

Make a wavetable from levels written in code, each -1..1 (clamped) and held for an equal share of the cycle; the mean is removed. 2..4096 levels; any other count raises.

Example
-- Eight levels, each held for an eighth of the cycle.
local levels = { 0, 0.7, 1, 0.7, 0, -0.7, -1, -0.7 }
local wave = datumhue.audio.wavetable(levels)
-- A wavetable plays wherever a waveform name does.
datumhue.audio.synth({ waveform = wave, frequency = 220 })

datumhue.audio.now

functionUI apps only
datumhue.audio.now() -> number

Seconds on the render clock every sound shares: the earliest time a sound started now can begin. Monotonic; stands still while a browser holds audio suspended.

Types 8

audio.Envelope

options

options 4 keys

KeyTypeDefaultDescription
attacknumber0Seconds to rise from the level sounding to the note's volume.
decaynumber0Seconds to fall from the peak to the sustain level.
sustainnumber1The held level, 0..1 of the note's volume.
releasenumber0Seconds to fall to silence once the gate closes.

Nested in: audio.SfxNote, audio.SynthOptions

audio.Filter

options

options 3 keys

KeyTypeDefaultDescription
kind"lowpass" | "highpass" | "bandpass" | "notch""lowpass"The response.
cutoff requirednumberno defaultCutoff (or centre) frequency in Hz, clamped to 20..min(20000, 0.45 × the sample rate).
resonancenumber00 is a flat passband; 1 is about +26 dB at the cutoff and never self-oscillates.

Nested in: audio.MusicOptions, audio.PlayOptions, audio.SfxPlayOptions, audio.SynthOptions

audio.FilterKind

enum
ValueDescription
"lowpass"
"highpass"
"bandpass"
"notch"

Used by: AudioFilter.kind

Nested in: audio.Filter

audio.NoiseMode

enum
ValueDescription
"white"A fresh random value every sample.
"long"The NES noise channel's long mode: a 32767-step sequence.
"periodic"The NES noise channel's short mode: a 93-step sequence that repeats at the note's frequency.

Nested in: audio.SfxNote, audio.SynthOptions

audio.PositionalOptions

options

options 8 keys

KeyTypeDefaultDescription
atVec2the sound plays centered and unattenuatedWhere the sound stands, in any 2D unit kept consistent with its ear. Pan comes from the horizontal offset (via pan_scale / pan_limit), loudness from the distance curve (falloff_*, max_distance); both follow the handle's at and the ear as they move. Every other positional field requires it.
listenerVec2the sound follows audio.listenerThis sound's own ear, in the units of at; it stays where it is put.
max_distancenumberdistance never silences the soundDistance past which the sound is silent.
pan_scalenumber128 unitsHorizontal offset at which the sound would pan fully to one ear; must be > 0.
pan_limitnumber0.8Cap on the pan's magnitude, 0..1, so a distant source never sits in one ear alone.
falloff_capnumber1Ceiling on the arriving gain.
falloff_gainnumber1Numerator k of the distance curve min(falloff_cap, k / (1 + d / falloff_scale)).
falloff_scalenumber128 unitsDistance at which the curve has halved a unit falloff_gain; must be > 0.

Extended by: audio.PlayOptions, audio.SfxPlayOptions, audio.SynthOptions

audio.SfxNote

options

options 16 keys

KeyTypeDefaultDescription
waveform required"sine" | "square" | "triangle" | "sawtooth" | "noise" | Wavetableno defaultOscillator waveform for this note: a named shape or a Wavetable.
frequencynumber440Tone frequency in Hz.
durationnumber0.1Note duration in seconds, at least 0.001: the note's gate.
volumenumber1Linear volume for this note, at most 4 (clamped); 0 is a rest, which lets the previous note's release ring on.
slidenumberthe pitch holdsTarget frequency in Hz to glide toward over the note.
vibratoaudio.Vibratono vibratoPitch vibrato parameters.
arpeggionumber[]no arpeggioSemitone offsets cycled per arpeggio step; an empty list is no arpeggio.
arpeggio_ticksnumber1; giving it without arpeggio raises1/60 s ticks per arpeggio step, fractions allowed.
envelopeaudio.Envelope2 ms edgesThe note's volume envelope.
pannumber0Stereo position, -1 (left) .. 1 (right), added to the play's pan and clamped.
dutynumber0.5; giving it for any waveform but square raisesPulse width 0..1, clamped.
duty_slidenumberthe duty holds; giving it for any waveform but square raisesTarget pulse width of a linear sweep across the note.
noise_mode"white" | "long" | "periodic"white noise; giving it for any waveform but noise raisesThe noise generator.
syncnumberno syncHard sync: the cycle runs at this ratio of frequency and restarts at each cycle of frequency.
sync_slidenumberthe sync ratio holds; giving it without sync raisesTarget sync ratio of a linear sweep across the note.
ringnumberno ring modulationRing modulation by a ±1 square at this ratio of frequency.

Used by: datumhue.audio.sfx, Music:set_pattern

Nested in: audio.MusicOptions

audio.Vibrato

options

options 3 keys

KeyTypeDefaultDescription
depthnumber5Frequency deviation in Hz.
speednumber4Vibrato LFO rate in Hz.
delaynumber0Seconds before the vibrato begins; it begins at the note's own pitch.

Nested in: audio.SfxNote

audio.Waveform

enum
ValueDescription
"sine"
"square"
"triangle"
"sawtooth"
"noise"

Nested in: audio.SfxNote, audio.SynthOptions

datumhue.com

(c) 2026 Shuusei AB. Quote excerpts of this manual, with attribution to DatumHue, in your own documentation, tutorials, course materials, reviews, and other writing or video. Republishing it in whole or in substantial part needs written permission: support@datumhue.com.

Victor Mono is licensed under the SIL Open Font License 1.1
Copyright (c) 2024, Rune Bjørnerås (https://github.com/rubjo)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Try

    ↑↓ selectEnter openTab filter

    Settings

    Theme
    Text
    Print

    Keyboard shortcuts

    / or Ctrl KSearch
    ↑ ↓ EnterPick a result
    TabNext result filter
    j kNext or previous entry
    [ ]Previous or next page
    yCopy a link to the current entry
    ?These shortcuts
    EscClose

    On this page