uvi-script
Musical event scripting with Lua
Loading...
Searching...
No Matches
Musical Context
function getBarDuration ()
 return the duration of a bar in ms.
 
function getBeatDuration ()
 return the duration of a beat in ms.
 
function getSamplingRate ()
 return the current audio sampling rate.
 
function getTempo ()
 return the current tempo.
 
function getTimeSignature ()
 the current time signature in the form num,den.
 
function getCC (cc)
 Retrieve the last control change value received for the given cc number.
 
function getTime ()
 get the number of milliseconds elapsed since the script engine start.
 
function getBeatTime ()
 get song position in beats.
 
function getRunningBeatTime ()
 get song position in beats.
 
function getNoteDuration (note)
 return the number of ms since the last note-on for the given note.
 
function isKeyDown (note)
 test wether a note's key is down.
 
function isOctaveKeyDown (note)
 test if a note is down ignoring octave.
 
function isNoteHeld ()
 return true is the note that created this callback is still held.
 

Detailed Description

Functions for querying the current musical context and performance state.

These functions provide access to timing information (tempo, beat position, time signature), MIDI controller values, key states, and other performance context that your scripts can use to make musically intelligent decisions.

Tempo & Duration:

Beat Position:

Note & Key State:

MIDI State:

See also
Math Conversions, Time and Threading, Threading and Timing

Function Documentation

◆ getBarDuration()

function getBarDuration ( )

return the duration of a bar in ms.

Returns
bar duration in milliseconds
See also
getBeatDuration, getSamplingRate, getTempo, getTimeSignature

◆ getBeatDuration()

function getBeatDuration ( )

return the duration of a beat in ms.

Returns
beat duration in milliseconds
See also
getBarDuration, getSamplingRate, getTempo, getTimeSignature

◆ getBeatTime()

function getBeatTime ( )

get song position in beats.

Returns
current song beat position
See also
getRunningBeatTime, getTime

◆ getCC()

function getCC ( cc )

Retrieve the last control change value received for the given cc number.

Parameters
ccthe contron change number in the range 0-127
Returns
the last control change value received

◆ getNoteDuration()

function getNoteDuration ( note )

return the number of ms since the last note-on for the given note.

Parameters
notenote number in the range 0-127
Returns
note duration in milliseconds

◆ getRunningBeatTime()

function getRunningBeatTime ( )

get song position in beats.

From the host if playing and using an internal monotonic clock if not

Returns
current song beat position
See also
getBeatTime, getTime

◆ getSamplingRate()

function getSamplingRate ( )

return the current audio sampling rate.

Returns
sampling rate in Hz
See also
getBarDuration, getBeatDuration, getTempo

◆ getTempo()

function getTempo ( )

return the current tempo.

Returns
tempo in BPM
See also
getBarDuration, getBeatDuration, getSamplingRate, getTimeSignature

◆ getTime()

function getTime ( )

get the number of milliseconds elapsed since the script engine start.

Returns
current script engine time in milliseconds

◆ getTimeSignature()

function getTimeSignature ( )

the current time signature in the form num,den.

local num,den = getTimeSignature()
function getTimeSignature()
the current time signature in the form num,den.
Definition api.lua:723
Returns
time signature numerator
time signature denominator

◆ isKeyDown()

function isKeyDown ( note )

test wether a note's key is down.

Parameters
notenote number in the range 0-127
Returns
true if the note is down false otherwise
See also
isOctaveKeyDown, isNoteHeld

◆ isNoteHeld()

function isNoteHeld ( )

return true is the note that created this callback is still held.

See also
isKeyDown, isOctaveKeyDown

◆ isOctaveKeyDown()

function isOctaveKeyDown ( note )

test if a note is down ignoring octave.

Parameters
notenote number in the range 0-127
Returns
true if the note is down, false otherwise
See also
isKeyDown, isNoteHeld