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

isOctaveKeyDown(note)

Description

Function to detect whether a key is held or not, regardless of the octave.

Available in: Processor.

Arguments

noteThe note number which specifies the key in the range of 0 to 127.number

Return Values

Example

-- detect whether a key is held, no matter in which octave
function onNote(event)
    print("Note-on:")
    print("Note #: "..event.note..", "..tostring(isOctaveKeyDown(event.note)))
    print("Note #: "..(event.note+7)..", "..tostring(isOctaveKeyDown(event.note+7)))
    print("Note #: "..(event.note + 12)..", "..tostring(isOctaveKeyDown(event.note + 12)).."\n")
end

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

See Also: isKeyDown, isNoteHeld

1 Comment