Page tree
Skip to end of metadata
Go to start of metadata

ms2beat(ms)

Description

Function to convert a duration in milliseconds to the equivalent number of beats. One beat equals a quarter note. The current tempo is taken into account.

Available in: Processor.

Arguments

msThe duration in milliseconds.number

Return Values

Returns the number of beats (quarter notes) that is the equivalent of the specified duration.

Example

-- print the note length in number of beats
function onRelease(event)
    postEvent(event)
	local noteLength = ms2beat(getNoteDuration(event.note))
    print(noteLength, "beats")
end

1 Comment