7 |
<body> |
<body> |
8 |
<h1>play_note()</h1> |
<h1>play_note()</h1> |
9 |
<p> |
<p> |
10 |
Triggers a new note to be played by the sampler. This is like generating |
Triggers a new note to be played by the sampler. This is almost |
11 |
a new MIDI note-on event programmatically. |
like generating |
12 |
|
a new MIDI note-on event programmatically, with the difference though |
13 |
|
that triggering a note programmatically this way does not cause a |
14 |
|
<code lang="nksp">note</code> event handler to be executed for the new note, nor |
15 |
|
will any MIDI specific note-on handling be done (i.e. it will have |
16 |
|
no effect on key switching or on the status of built-in array variable |
17 |
|
<code>%KEY_DOWN[]</code>). |
18 |
</p> |
</p> |
19 |
|
|
20 |
<h3>Function Prototype</h3> |
<h3>Function Prototype</h3> |
38 |
<td><code>??velocity??</code></td> |
<td><code>??velocity??</code></td> |
39 |
<td>Integer Number</td> |
<td>Integer Number</td> |
40 |
<td>Trigger velocity.<br> |
<td>Trigger velocity.<br> |
41 |
[optional, default: 127]</td> |
[optional, default: <code>127</code>]</td> |
42 |
</tr> |
</tr> |
43 |
<tr> |
<tr> |
44 |
<td><code>??offset-us??</code></td> |
<td><code>??offset-us??</code></td> |
45 |
<td>Integer Number</td> |
<td>Integer Number</td> |
46 |
<td>Start offset of the sample to be played in microseconds.<br> |
<td>Start offset of the sample to be played in microseconds.<br> |
47 |
[optional, default: 0]</td> |
<code>-1</code>: Do not override the start offset and use the |
48 |
|
regular start offset as defined by the |
49 |
|
instrument file.<br> |
50 |
|
[optional, default: <code>-1</code>]</td> |
51 |
</tr> |
</tr> |
52 |
<tr> |
<tr> |
53 |
<td><code>??duration-us??</code></td> |
<td><code>??duration-us??</code></td> |
54 |
<td>Integer Number</td> |
<td>Integer Number</td> |
55 |
<td>Length of the note to be played in microseconds.<br> |
<td>Length of the note to be played in microseconds.<br> |
56 |
-1: The note will be stopped when the event |
<code>0</code>: The entire note's sample will be played to its end.<br> |
57 |
handler's note stops.<br> |
<code>-1</code>: The note will be stopped when the event |
58 |
0: The entire note's sample will be played to its end.<br> |
handler's note stops (must only be used with |
59 |
[optional, default: 0]</td> |
<code>note</code> event handlers).<br> |
60 |
|
<code>-2</code>: The note will be stopped when a note-off event was received on the passed <code>??note??</code> number (argument 1).<br> |
61 |
|
[optional, default: <code>0</code>]</td> |
62 |
</tr> |
</tr> |
63 |
</table> |
</table> |
64 |
|
|
65 |
<note class="important"> |
<note> |
66 |
Passing any other value than <code>0</code> for <code>??duration-us??</code> |
You need at least LinuxSampler 2.0.0.svn2 for passing a value |
67 |
is not supported by LinuxSampler yet. |
higher than <code>0</code> for <code>??duration-us??</code>.<br> |
68 |
|
<br> |
69 |
|
You need at least LinuxSampler 2.0.0.svn3 for passing <code>-1</code> for |
70 |
|
<code>??duration-us??</code>.<br> |
71 |
|
<br> |
72 |
|
You need at least LinuxSampler 2.0.0.svn55 for passing any other value than <code>0</code> for |
73 |
|
<code>??offset-us??</code>.<br> |
74 |
|
<br> |
75 |
|
You need at least LinuxSampler 2.0.0.svn56 for passing <code>-2</code> for |
76 |
|
<code>??duration-us??</code>. |
77 |
</note> |
</note> |
78 |
|
|
79 |
<h3>Return Value</h3> |
<h3>Return Value</h3> |
80 |
<table> |
<table> |
81 |
<tr> |
<tr> |
89 |
</table> |
</table> |
90 |
|
|
91 |
<h3>Examples</h3> |
<h3>Examples</h3> |
92 |
<p/> |
<p> |
93 |
|
The following example resembles a simple delay effect. For each note |
94 |
|
being triggered by the musician, the script launches additional notes, |
95 |
|
each one of such additional successive notes with a more and more reduced |
96 |
|
volume.</p> |
97 |
<code> |
<code> |
98 |
on init |
on init |
99 |
{ The amount of notes to play } |
{ The amount of notes to play } |
127 |
end on |
end on |
128 |
</code> |
</code> |
129 |
|
|
130 |
|
<h3>See also</h3> |
131 |
|
<p><code>note_off()</code>, <code>set_controller()</code><p> |
132 |
|
|
133 |
|
<h3>Availability</h3> |
134 |
|
<p>Since LinuxSampler 2.0.0<p> |
135 |
|
|
136 |
|
<note> |
137 |
|
The special value <code>-1</code> for <code>??offset-us??</code> only exists |
138 |
|
with NKSP, it is not available with KSP.<br> |
139 |
|
<br> |
140 |
|
The special value <code>-2</code> for <code>??duration-us??</code> only exists |
141 |
|
with NKSP, it is not available with KSP.<br> |
142 |
|
<br> |
143 |
|
Dynamic, optional arguments are |
144 |
|
only supported by NKSP. If you want to retain compatibility to KSP, |
145 |
|
then you should always pass a value for all arguments of this function. |
146 |
|
</note> |
147 |
|
|
148 |
</body> |
</body> |
149 |
</html> |
</html> |