REF / Music API / Util

Ascene . Agraph . Aengine
Anode . Modulator . Envelope
Songbook . Song . TimeKeeper
Voices . SampleMgr . StreamMgr
Loader . Async . Plot
Random . Rhythm . Util
MIDI . OSC . HID . Piano
Music Theory with Tonal

right-click to navigate to page sections


Util offers a small collection of miscellaneous utility functions.

API

These functions reside within the Util namespace.

Function Description
FromDecibels(dB) Returns a linear gain value from a dB value. eg: -5dB->.5, 0dB->1, 3dB->1.4
LogInterp(pct, x1, x2, ctx=null) Linearly interpolate between x1 and x2 in perceptual (log) space. Used to interpolate frequency and loudness. The optional ctx parameter ({}) can be used to cache calculations for inner-loop usage.
GetFileTimestamp() Returns a standard timestamp string of the form: "2025-03-04_12-16-08" for use in filenames for recordings.
TimeIt(f, num) Runs the provided function, f, num times and returns its average runtime.
async SleepMS(ms) async function that can be awaited.
ParseYaml(str) Returns the object or array that results from parsing the provided YAML string.
home .. topics .. interface .. reference .. examples .. tipjar