1 |
<html> |
2 |
<head> |
3 |
<meta name="author" content="Christian Schoenebeck"> |
4 |
<title>NKSP Reference</title> |
5 |
<urlpath>Reference</urlpath> |
6 |
<navpath>Reference Manual</navpath> |
7 |
<meta name="description" content="Reference documentation of the NKSP real-time instrument script language."> |
8 |
</head> |
9 |
<body> |
10 |
<h1>NKSP Reference</h1> |
11 |
<p> |
12 |
This document gives you an overview of all built-in functions and built-in |
13 |
variables provided by the NKSP real-time instrument script language. |
14 |
</p> |
15 |
|
16 |
<h2>Built-In Functions</h2> |
17 |
<p> |
18 |
These are the built-in functions available with the NKSP realt-time |
19 |
instrument script language. |
20 |
</p> |
21 |
|
22 |
<h3>Core Language Functions</h3> |
23 |
<p> |
24 |
Most fundamental NKSP functions, independent from any purpose of being used in a sampler. |
25 |
</p> |
26 |
<table> |
27 |
<tr> |
28 |
<th>Function</th> <th>Description</th> |
29 |
</tr> |
30 |
<tr> |
31 |
<td><code>message()</code></td> |
32 |
<td>Prints text to the sampler's terminal.</td> |
33 |
</tr> |
34 |
<tr> |
35 |
<td><code>exit()</code></td> |
36 |
<td>Stops execution of the current event handler instance.</td> |
37 |
</tr> |
38 |
<tr> |
39 |
<td><code>wait()</code></td> |
40 |
<td>Pauses execution for a certain amount of time.</td> |
41 |
</tr> |
42 |
<tr> |
43 |
<td><code>abs()</code></td> |
44 |
<td>Calculates the absolute value of a given value.</td> |
45 |
</tr> |
46 |
<tr> |
47 |
<td><code>random()</code></td> |
48 |
<td>Random number generator.</td> |
49 |
</tr> |
50 |
<tr> |
51 |
<td><code>num_elements()</code></td> |
52 |
<td>Returns the size of the requested array variable.</td> |
53 |
</tr> |
54 |
</table> |
55 |
|
56 |
<h3>Common Sampler Functions</h3> |
57 |
<p> |
58 |
Basic sampler related functions, independent from a particular sampler |
59 |
format or sampler engine. |
60 |
</p> |
61 |
<table> |
62 |
<tr> |
63 |
<th>Function</th> <th>Description</th> |
64 |
</tr> |
65 |
<tr> |
66 |
<td><code>play_note()</code></td> |
67 |
<td>Triggers a new note.</td> |
68 |
</tr> |
69 |
<tr> |
70 |
<td><code>set_controller()</code></td> |
71 |
<td>Creates a MIDI control change event.</td> |
72 |
</tr> |
73 |
<tr> |
74 |
<td><code>ignore_event()</code></td> |
75 |
<td>Drops the given event.</td> |
76 |
</tr> |
77 |
<tr> |
78 |
<td><code>ignore_controller()</code></td> |
79 |
<td>Drops the given MIDI control change event.</td> |
80 |
</tr> |
81 |
<tr> |
82 |
<td><code>note_off()</code></td> |
83 |
<td>Releases the requested note.</td> |
84 |
</tr> |
85 |
<tr> |
86 |
<td><code>set_event_mark()</code></td> |
87 |
<td>Adds an event to an event group.</td> |
88 |
</tr> |
89 |
<tr> |
90 |
<td><code>delete_event_mark()</code></td> |
91 |
<td>Removes an event from some event group.</td> |
92 |
</tr> |
93 |
<tr> |
94 |
<td><code>by_marks()</code></td> |
95 |
<td>Returns all events of an event group.</td> |
96 |
</tr> |
97 |
</table> |
98 |
|
99 |
<h3>GigaStudio Format Functions</h3> |
100 |
<p> |
101 |
Sampler format specific functions, dedicated to the individual features |
102 |
of the GigaStudio format engine. |
103 |
</p> |
104 |
<table> |
105 |
<tr> |
106 |
<th>Function</th> <th>Description</th> |
107 |
</tr> |
108 |
<tr> |
109 |
<td><code>gig_set_dim_zone()</code></td> |
110 |
<td>Changes the currently active dimension zone.</td> |
111 |
</tr> |
112 |
</table> |
113 |
|
114 |
<h2>Built-In Variables</h2> |
115 |
<p> |
116 |
These are the built-in variables and built-in constants available with the |
117 |
NKSP realt-time instrument script language. |
118 |
</p> |
119 |
|
120 |
<h3>Common Sampler Variables</h3> |
121 |
<p> |
122 |
Basic sampler related built-in variables and constants, independent from a |
123 |
particular sampler format or sampler engine. |
124 |
</p> |
125 |
<table> |
126 |
<tr> |
127 |
<th>Variable</th> <th>Description</th> |
128 |
</tr> |
129 |
<tr> |
130 |
<td><code>$CC_NUM</code></td> |
131 |
<td>MIDI controller number that caused the <code>controller</code> |
132 |
handler to be executed (only useful in the context of a |
133 |
<code>controller</code> handler).</td> |
134 |
</tr> |
135 |
<tr> |
136 |
<td><code>%CC[]</code></td> |
137 |
<td>Provides access to all current MIDI controller values. This can be |
138 |
used in any context. Use the respective MIDI controller number as |
139 |
index to this integer array variable. For instance <code>%CC[1]</code> |
140 |
would give you the current value of the modulation wheel. |
141 |
</td> |
142 |
</tr> |
143 |
<tr> |
144 |
<td><code>$EVENT_ID</code></td> |
145 |
<td>ID of the event that caused the current event handler to be executed. In |
146 |
the context of a <code>note</code> handler this would be the event |
147 |
ID of the note, within a <code>controller</code> handler it would |
148 |
be the controller event ID, etc.</td> |
149 |
</tr> |
150 |
<tr> |
151 |
<td><code>$EVENT_NOTE</code></td> |
152 |
<td>MIDI note number that caused a note related |
153 |
handler to be executed (only useful in the context of a |
154 |
<code>note</code> or <code>release</code> handler).</td> |
155 |
</tr> |
156 |
<tr> |
157 |
<td><code>$EVENT_VELOCITY</code></td> |
158 |
<td>MIDI velocity value of the note that caused that note related |
159 |
handler to be executed (only useful in the context of a |
160 |
<code>note</code> or <code>release</code> handler).</td> |
161 |
</tr> |
162 |
<tr> |
163 |
<td><code>%KEY_DOWN[]</code></td> |
164 |
<td>This can be used in any context to check whether a certain MIDI |
165 |
key is currently pressed down. Use the respective MIDI note number |
166 |
as index to this array variable.</td> |
167 |
</tr> |
168 |
<tr> |
169 |
<td><code>$VCC_MONO_AT</code></td> |
170 |
<td>Constant identifying the MIDI monophonic aftertouch controller (also |
171 |
called <i title="Amount of force on held-down key."> |
172 |
MIDI channel pressure |
173 |
</i>). This is somewhat different than in the MIDI standard. With |
174 |
NKSP aftertouch is handled like an additional "regular" MIDI CC controller. |
175 |
Therefore use |
176 |
<code>%CC[$VCC_MONO_AT]</code> to obtain the current aftertouch value |
177 |
in the context of a <code>controller</code> event handler. |
178 |
</td> |
179 |
</tr> |
180 |
<tr> |
181 |
<td><code>$VCC_PITCH_BEND</code></td> |
182 |
<td>Constant identifying the pitch bend wheel controller. |
183 |
This is somewhat different than in the MIDI standard. With |
184 |
NKSP pitch bend is handled like an additional "regular" MIDI CC controller. |
185 |
Therefore use |
186 |
<code>%CC[$VCC_PITCH_BEND]</code> to obtain the current aftertouch value |
187 |
in the context of a <code>controller</code> event handler.</td> |
188 |
</tr> |
189 |
<tr> |
190 |
<td><code>$MARK_1</code> to <code>$MARK_28</code></td> |
191 |
<td>Used to select one of the available 28 event groups. |
192 |
See <code>set_event_mark()</code> for details.</td> |
193 |
</tr> |
194 |
</table> |
195 |
|
196 |
<h3>GigaStudio Format Variables</h3> |
197 |
<p> |
198 |
Sampler format specific built-in variables and constants, dedicated to the |
199 |
individual features of the GigaStudio format engine. |
200 |
</p> |
201 |
<table> |
202 |
<tr> |
203 |
<th>Variable</th> <th>Description</th> |
204 |
</tr> |
205 |
<tr> |
206 |
<td><code>$GIG_DIM_CHANNEL</code></td> |
207 |
<td>Constant that identifies the <i>stereo dimension</i>.</td> |
208 |
</tr> |
209 |
<tr> |
210 |
<td><code>$GIG_DIM_LAYER</code></td> |
211 |
<td>Constant that identifies the <i>layer dimension</i>.</td> |
212 |
</tr> |
213 |
<tr> |
214 |
<td><code>$GIG_DIM_VELOCITY</code></td> |
215 |
<td>Constant that identifies the <i>velocity dimension</i>.</td> |
216 |
</tr> |
217 |
<tr> |
218 |
<td><code>$GIG_DIM_AFTERTOUCH</code></td> |
219 |
<td>Constant that identifies the <i>aftertouch dimension</i>.</td> |
220 |
</tr> |
221 |
<tr> |
222 |
<td><code>$GIG_DIM_RELEASE</code></td> |
223 |
<td>Constant that identifies the <i>release trigger dimension</i>.</td> |
224 |
</tr> |
225 |
<tr> |
226 |
<td><code>$GIG_DIM_KEYBOARD</code></td> |
227 |
<td>Constant that identifies the <i>keyboard position dimension</i>.</td> |
228 |
</tr> |
229 |
<tr> |
230 |
<td><code>$GIG_DIM_ROUNDROBIN"</code></td> |
231 |
<td>Constant that identifies the <i>round robin dimension</i>.</td> |
232 |
</tr> |
233 |
<tr> |
234 |
<td><code>$GIG_DIM_RANDOM</code></td> |
235 |
<td>Constant that identifies the <i>random dimension</i>.</td> |
236 |
</tr> |
237 |
<tr> |
238 |
<td><code>$GIG_DIM_SMARTMIDI</code></td> |
239 |
<td>Constant that identifies the <i>start MIDI dimension</i> (a.k.a iMIDI rules).</td> |
240 |
</tr> |
241 |
<tr> |
242 |
<td><code>$GIG_DIM_ROUNDROBINKEY</code></td> |
243 |
<td>Constant that identifies the <i>round robin key dimension</i>.</td> |
244 |
</tr> |
245 |
<tr> |
246 |
<td><code>$GIG_DIM_MODWHEEL</code></td> |
247 |
<td>Constant that identifies the <i>modulation wheel dimension</i>.</td> |
248 |
</tr> |
249 |
<tr> |
250 |
<td><code>$GIG_DIM_SUSTAIN</code></td> |
251 |
<td>Constant that identifies the <i>sustain pedal dimension</i> (a.k.a. hold pedal).</td> |
252 |
</tr> |
253 |
<tr> |
254 |
<td><code>$GIG_DIM_PORTAMENTO</code></td> |
255 |
<td>Constant that identifies the <i>portamento MIDI controller dimension</i>.</td> |
256 |
</tr> |
257 |
<tr> |
258 |
<td><code>$GIG_DIM_SOSTENUTO</code></td> |
259 |
<td>Constant that identifies the <i>sostenuto MIDI controller dimension</i>.</td> |
260 |
</tr> |
261 |
<tr> |
262 |
<td><code>$GIG_DIM_SOFT</code></td> |
263 |
<td>Constant that identifies the <i>soft pedal dimension</i>.</td> |
264 |
</tr> |
265 |
<tr> |
266 |
<td><code>$GIG_DIM_BREATH</code></td> |
267 |
<td>Constant that identifies the <i>breath controller dimension</i>.</td> |
268 |
</tr> |
269 |
<tr> |
270 |
<td><code>$GIG_DIM_FOOT</code></td> |
271 |
<td>Constant that identifies the <i>foot pedal dimension</i>.</td> |
272 |
</tr> |
273 |
<tr> |
274 |
<td><code>$GIG_DIM_PORTAMENTOTIME</code></td> |
275 |
<td>Constant that identifies the <i>portamento time controller dimension</i>.</td> |
276 |
</tr> |
277 |
<tr> |
278 |
<td><code>$GIG_DIM_EFFECT1</code></td> |
279 |
<td>Constant that identifies the <i>effect 1 MIDI controller dimension</i>.</td> |
280 |
</tr> |
281 |
<tr> |
282 |
<td><code>$GIG_DIM_EFFECT2</code></td> |
283 |
<td>Constant that identifies the <i>effect 2 MIDI controller dimension</i>.</td> |
284 |
</tr> |
285 |
<tr> |
286 |
<td><code>$GIG_DIM_EFFECT1DEPTH</code></td> |
287 |
<td>Constant that identifies the <i>effect 1 depth MIDI controller dimension</i>.</td> |
288 |
</tr> |
289 |
<tr> |
290 |
<td><code>$GIG_DIM_EFFECT2DEPTH</code></td> |
291 |
<td>Constant that identifies the <i>effect 2 depth MIDI controller dimension</i>.</td> |
292 |
</tr> |
293 |
<tr> |
294 |
<td><code>$GIG_DIM_EFFECT3DEPTH</code></td> |
295 |
<td>Constant that identifies the <i>effect 3 depth MIDI controller dimension</i>.</td> |
296 |
</tr> |
297 |
<tr> |
298 |
<td><code>$GIG_DIM_EFFECT4DEPTH</code></td> |
299 |
<td>Constant that identifies the <i>effect 4 depth MIDI controller dimension</i>.</td> |
300 |
</tr> |
301 |
<tr> |
302 |
<td><code>$GIG_DIM_EFFECT5DEPTH</code></td> |
303 |
<td>Constant that identifies the <i>effect 5 depth MIDI controller dimension</i>.</td> |
304 |
</tr> |
305 |
<tr> |
306 |
<td><code>$GIG_DIM_GENPURPOSE1</code></td> |
307 |
<td>Constant that identifies the <i>general purpose 1 MIDI controller dimension</i>.</td> |
308 |
</tr> |
309 |
<tr> |
310 |
<td><code>$GIG_DIM_GENPURPOSE2</code></td> |
311 |
<td>Constant that identifies the <i>general purpose 2 MIDI controller dimension</i>.</td> |
312 |
</tr> |
313 |
<tr> |
314 |
<td><code>$GIG_DIM_GENPURPOSE3</code></td> |
315 |
<td>Constant that identifies the <i>general purpose 3 MIDI controller dimension</i>.</td> |
316 |
</tr> |
317 |
<tr> |
318 |
<td><code>$GIG_DIM_GENPURPOSE4</code></td> |
319 |
<td>Constant that identifies the <i>general purpose 4 MIDI controller dimension</i>.</td> |
320 |
</tr> |
321 |
<tr> |
322 |
<td><code>$GIG_DIM_GENPURPOSE5</code></td> |
323 |
<td>Constant that identifies the <i>general purpose 5 MIDI controller dimension</i>.</td> |
324 |
</tr> |
325 |
<tr> |
326 |
<td><code>$GIG_DIM_GENPURPOSE6</code></td> |
327 |
<td>Constant that identifies the <i>general purpose 6 MIDI controller dimension</i>.</td> |
328 |
</tr> |
329 |
<tr> |
330 |
<td><code>$GIG_DIM_GENPURPOSE7</code></td> |
331 |
<td>Constant that identifies the <i>general purpose 7 MIDI controller dimension</i>.</td> |
332 |
</tr> |
333 |
<tr> |
334 |
<td><code>$GIG_DIM_GENPURPOSE8</code></td> |
335 |
<td>Constant that identifies the <i>general purpose 8 MIDI controller dimension</i>.</td> |
336 |
</tr> |
337 |
</table> |
338 |
|
339 |
</body> |
340 |
</html> |