Util
offers a small collection of miscellaneous utility functions.
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 await ed. |
ParseYaml(str) |
Returns the object or array that results from parsing the provided YAML string. |