Writing Docs Gigedit SFZ Instrument Scripts NKSP Language NKSP Reference


Triggers a new note to be played by the sampler. This is almost like generating a new MIDI note-on event programmatically, with the difference though that triggering a note programmatically this way does not cause a note event handler to be executed for the new note, nor will any MIDI specific note-on handling be done (i.e. it will have no effect on key switching or on the status of built-in array variable %KEY_DOWN[]).

Function Prototype

play_note(note, [velocity], [offset-us], [duration-us])


Argument Name Data Type Description
note Integer Number Note number (absolute pitch).
velocity Integer Number Trigger velocity.
[optional, default: 127]
offset-us Integer Number Start offset of the sample to be played in microseconds.
[optional, default: 0]
duration-us Integer Number Length of the note to be played in microseconds.
-1: The note will be stopped when the event handler's note stops (must only be used with note event handlers).
0: The entire note's sample will be played to its end.
[optional, default: 0]
You need at least LinuxSampler 2.0.0.svn2 or higher for passing a value higher than 0 for duration-us, and you need at least LinuxSampler 2.0.0.svn3 or higher for passing -1 for duration-us. Passing any other value than 0 for offset-us is not supported by LinuxSampler yet.

Return Value

Description Data Type
Note's event ID of the new note that has been triggered. This event ID can be used to control the note during its life time. Event ID Number


Document Updated:  2016-07-12  |  Author:  Christian Schoenebeck