Return values

What every function gives back, with the exact keys of every struct.

On this page

Functions fall into five groups by what they return. Anything not listed here returns a new audio buffer.

Audio buffers and timelines

FunctionReturns
Almost every function that changes or makes soundA new audio buffer. Methods of the buffer: getChannels(), getSampleRate(), getFrames(), getDurationSeconds(), getPeak(), getRms().
audioTimelineA timeline. timeline.beat( n ) and timeline.bar( n ) turn beats and bars into seconds.
audioAdd, audioPump, audioDuck, audioTrackGainThe same timeline, so calls can be chained.
audioVariationsAn array of audio buffers.
audioMixerA mixer. play( sound, options ) returns a playback, see Realtime playback.

Numbers and text

FunctionReturns
audioFreqFrequency in Hz, with A4 at 440.
audioEncodeThe bytes of the encoded file, as binary data.
audioDecodeAn audio buffer.
audioSave, audioMuxThe absolute path of the file that was written.
audioStorageClearMegabytes freed.
audioVoiceRemovetrue if something was deleted, false if it was not installed.
audioSubtitles, audioMarkersThe text of the file, in the format you asked for.
audioWaveformAn array of numbers from 0 (silence) upwards, 1 is full scale.
audioSpectrumAn array of band levels in dB, lowest frequency first. -120 means nothing.
audioSpectrogramAn array of frames, each an array of band levels in dB.
audioBeatsAn array of times in seconds.

Structs

All keys below are always present unless marked optional.

audioTags( path )

Reading gives every key, with an empty string for a tag the file does not have.

KeyTypeMeaning
formatstringmp3, flac or wav.
title, artist, album, albumArtist, composer, genre, year, track, disc, commentstringThe tag, or "". track and disc can be "3" or "3/12".
coverstruct or null{ mimeType, size, data } with the picture as binary data, null when there is none.
chaptersarrayStructs { start, end, title } in seconds, empty when there are none. end is null when the chapter lasts until the next one starts (FLAC and WAV do not store ends).

audioTags( path, tags )

Writing gives back what happened.

KeyTypeMeaning
pathstringThe file.
formatstringmp3, flac or wav.
writtenarrayThe tags that were stored, in the order title, artist, album, albumArtist, composer, genre, year, track, disc, comment, cover, chapters.
ignoredarrayThe tags this format has no place for. A WAV file ignores albumArtist, disc and cover.

audioHttpResponse( source, request )

KeyTypeMeaning
statusinteger200, 206 (a range), 304 (not modified), 405 (not GET or HEAD) or 416 (range past the end).
statusTextstringThe matching text, such as Partial Content.
headersstructResponse headers: Content-Type, Accept-Ranges, ETag, Cache-Control, Content-Length, and when they apply Content-Range, Last-Modified and Content-Disposition. A 304 has no Content-Type.
bodybinaryThe bytes to send. Empty for 304, 405, 416 and HEAD.

audioInfo( source, levels=false )

KeyTypeMeaning
channelsinteger1 for mono, 2 for stereo.
sampleRateintegerHz.
framesintegerSamples per channel.
secondsnumberLength.
peaknumberHighest sample, 0 to 1 for audio that does not clip. Optional: present for a buffer, and for a file only with levels=true.
rmsnumberAverage level, linear. Optional, same as peak.

A WAV file is described from its header, so a file of any size answers at once. Other formats are decoded.

audioLoudness( audio )

KeyTypeMeaning
integratednumberLUFS, gated: the number streaming services use.
rangenumberLoudness range, LU.
truePeakDbnumberHighest peak between the samples, dBFS.
samplePeakDbnumberHighest sample, dBFS.
momentaryMaxnumberLoudest 400 ms, LUFS.
shortTermMaxnumberLoudest 3 s, LUFS.

Silence, or audio shorter than 400 ms, reads -120.

audioBpm( audio )

KeyTypeMeaning
bpmnumberTempo, 0 if there is no clear pulse.
confidencenumber0 to 1.
beatsarrayBeat times in seconds.

audioFft( audio )

KeyTypeMeaning
frequenciesarrayHz, size/2+1 values.
magnitudesarray1 is a full scale sine.

audioDetectSilence( audio )

An array of structs { start, end, duration } in seconds.

audioSpeakCues( text, voice )

KeyTypeMeaning
audiobufferMono speech.
cuesarrayStructs { start, end, text } in seconds. Pass them to audioSubtitles().
secondsnumberLength.

audioSprite( sounds )

KeyTypeMeaning
audiobufferThe joined sounds.
spritesstructName to { start, end, duration } in seconds.
path, mapPathstringOptional: the files written, when you gave a path.

audioVoices()

An array of structs: id, name, language, quality, license, licenseText, shareAlike, source, sizeMB, installed, status (installed, downloadable or excluded), reasonKind and reason (empty unless excluded).

audioLicenses()

An array of structs: id, name, url, commercial, attribution, shareAlike, summary and voices (how many offered voices use it).

audioSpeechStatus()

home, engineInstalled, engineSizeMB, voicesDir and voices, the ids of the installed voices.

audioVoiceInstall( name )

name, installed and path of what was installed.

audioStorage()

home, totalMB and folders, an array of structs { kind, path, description, exists, sizeMB }.

audioFfmpeg()

KeyTypeMeaning
availablebooleanIs there a working FFmpeg.
sourcestringconfigured, installed or system. Optional: only when available.
path, probePath, versionstringOptional: only when available.
encodersarrayThe encoders it has, from libvorbis, libopus, aac, libmp3lame and flac. Optional: only when available.
platformstringThis computer.
installablebooleanIs there a download for this computer.
autoInstallbooleanMay the module download it by itself.
downloadSizeMBnumberSize of that download.
installDirstringWhere it would be kept.
problemstringOptional: why the ffmpeg setting does not work.

audioFfmpegInstall()

installed, version, path and probePath.

videoInfo( path )

KeyTypeMeaning
path, formatstringThe file and its container.
secondsnumberLength.
bitrate, sizeBytesnumberOverall bit rate and file size.
videostruct or null{ codec, width, height, fps }, null when there is no video.
audiostruct or null{ codec, channels, sampleRate }, null when there is no audio.
streamsarrayThe raw stream list.

Errors

Anything can throw. The types are in Errors.

Edit this page Download Markdown Last updated Oct 16, 2026, 2:03:10 PM Report an issue