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

getMsTime()

Description

Function to obtain the current song position in milliseconds.

Available in: Processor.

Return Values

When the host is in playback, the function returns a decimal with the milliseconds since the start of the song. The start of the song equals 0 ms. The function returns -1 if the host is not in playback.

Example

-- print the song position in milliseconds
function onNote(event)
	posInSongMs = getMsTime()
	if (posInSongMs ~= -1) then
        print(string.format("%.3f ms", posInSongMs))
    else
        print("Playback is stopped.") 
    end
end

1 Comment