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

isKeyDown(note)

Description

Function to detect whether a key with a specific note number is held or not.

Available in: Processor.

Arguments

noteThe note number in the range of 0 to 127.number

Return Values

Example

-- detect if a key is held
function onNote(event)
    print("Note-on:")
    print("Note# "..event.note..", "..tostring(isKeyDown(event.note)))
    print("Note# "..(event.note + 12)..", "..tostring(isKeyDown(event.note + 12)).."\n")
end

function onRelease(event)
    print("Note-off:")
    print("Note# "..event.note..", "..tostring(isKeyDown(event.note)))
    print("Note# "..(event.note + 12)..", "..tostring(isKeyDown(event.note + 12)).."\n")
end

1 Comment