/[svn]/doc/docbase/instrument_scripts/nksp/reference/01_nksp_reference.html
ViewVC logotype

Annotation of /doc/docbase/instrument_scripts/nksp/reference/01_nksp_reference.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3601 - (hide annotations) (download) (as text)
Mon Sep 16 16:03:36 2019 UTC (4 years, 7 months ago) by schoenebeck
File MIME type: text/html
File size: 34419 byte(s)
* NKSP: Added recently added built-in functions to reference docs.
* NKSP: Added info about std units and finalness to existing functions.
* NKSP: Added recently added built-in constants ~NI_MATH_E and ~NI_MATH_PI.

1 schoenebeck 2732 <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 schoenebeck 3396 If you are new to NKSP, then you may want to read the
15     <a href="01_nksp.html">NKSP language tour</a> first.
16 schoenebeck 2732 </p>
17    
18     <h2>Built-In Functions</h2>
19     <p>
20 schoenebeck 3265 These are the built-in functions available with the NKSP real-time
21 schoenebeck 2732 instrument script language.
22     </p>
23    
24     <h3>Core Language Functions</h3>
25     <p>
26     Most fundamental NKSP functions, independent from any purpose of being used in a sampler.
27     </p>
28     <table>
29     <tr>
30     <th>Function</th> <th>Description</th>
31     </tr>
32     <tr>
33 schoenebeck 3278 <td><code lang="nksp">abort()</code></td>
34     <td>Stops execution of a script callback.</td>
35     </tr>
36     <tr>
37 schoenebeck 3601 <td><code lang="nksp">acos()</code></td>
38     <td>Arc cosine function.</td>
39     </tr>
40     <tr>
41 schoenebeck 3580 <td><code>abs()</code></td>
42     <td>Calculates the absolute value of a given value.</td>
43     </tr>
44     <tr>
45 schoenebeck 3223 <td><code lang="nksp">array_equal()</code></td>
46     <td>Check whether two arrays are equal.</td>
47     </tr>
48     <tr>
49 schoenebeck 3601 <td><code>asin()</code></td>
50     <td>Arc sine function.</td>
51     </tr>
52     <tr>
53     <td><code>atan()</code></td>
54     <td>Arc tangens function.</td>
55     </tr>
56     <tr>
57 schoenebeck 3297 <td><code>callback_status()</code></td>
58     <td>Returns the current status of a callback (thread).</td>
59     </tr>
60     <tr>
61 schoenebeck 3601 <td><code>ceil()</code></td>
62     <td>Rounds the given real number up.</td>
63     </tr>
64     <tr>
65     <td><code>cos()</code></td>
66     <td>Cosine function.</td>
67     </tr>
68     <tr>
69 schoenebeck 2946 <td><code lang="nksp">dec()</code></td>
70     <td>Decrements the passed integer variable by one.</td>
71     </tr>
72     <tr>
73 schoenebeck 3580 <td><code>exit()</code></td>
74     <td>Stops execution of the current event handler instance.</td>
75     </tr>
76     <tr>
77 schoenebeck 3601 <td><code>exp()</code></td>
78     <td>Calculates e raised by given power.</td>
79     </tr>
80     <tr>
81     <td><code>floor()</code></td>
82     <td>Rounds the given real number down.</td>
83     </tr>
84     <tr>
85 schoenebeck 3580 <td><code>fork()</code></td>
86     <td>Creates new execution instances (threads).</td>
87     </tr>
88     <tr>
89 schoenebeck 2946 <td><code>inc()</code></td>
90     <td>Increments the passed integer variable by one.</td>
91     </tr>
92     <tr>
93 schoenebeck 3601 <td><code>int()</code></td>
94     <td>Short-hand alias function for function <code>real_to_int()</code>.</td>
95     </tr>
96     <tr>
97     <td><code>int_to_real()</code></td>
98     <td>Type cast from integer number to real number.</td>
99     </tr>
100     <tr>
101 schoenebeck 3077 <td><code>in_range()</code></td>
102     <td>Checks whether a value is between two other values.</td>
103     </tr>
104     <tr>
105 schoenebeck 3601 <td><code>log()</code></td>
106     <td>Calculates the natural logarithm of given number.</td>
107     </tr>
108     <tr>
109     <td><code>log10()</code></td>
110     <td>Calculates the logarithm to base 10 of given number.</td>
111     </tr>
112     <tr>
113     <td><code>log2()</code></td>
114     <td>Calculates the logarithm to base 2 of given number.</td>
115     </tr>
116     <tr>
117 schoenebeck 3580 <td><code>max()</code></td>
118     <td>Calculates the maximum value of two given values.</td>
119     </tr>
120     <tr>
121 schoenebeck 2742 <td><code lang="nksp">message()</code></td>
122 schoenebeck 2732 <td>Prints text to the sampler's terminal.</td>
123     </tr>
124     <tr>
125 schoenebeck 3580 <td><code>min()</code></td>
126     <td>Calculates the minimum value of two given values.</td>
127 schoenebeck 3223 </tr>
128     <tr>
129 schoenebeck 3580 <td><code>num_elements()</code></td>
130     <td>Returns the size of the requested array variable.</td>
131 schoenebeck 3223 </tr>
132     <tr>
133 schoenebeck 3601 <td><code>pow()</code></td>
134     <td>Calculates given base raised by given power.</td>
135     </tr>
136     <tr>
137 schoenebeck 3580 <td><code>random()</code></td>
138     <td>Random number generator.</td>
139 schoenebeck 2732 </tr>
140     <tr>
141 schoenebeck 3601 <td><code>real()</code></td>
142     <td>Short-hand alias function for function <code>int_to_real()</code>.</td>
143     </tr>
144     <tr>
145     <td><code>real_to_int()</code></td>
146     <td>Type cast from real number to integer number.</td>
147     </tr>
148     <tr>
149     <td><code>round()</code></td>
150     <td>Rounds the given real number.</td>
151     </tr>
152     <tr>
153 schoenebeck 3580 <td><code>search()</code></td>
154     <td>Search for a certain value within an array.</td>
155 schoenebeck 2732 </tr>
156     <tr>
157 schoenebeck 3580 <td><code>sh_left()</code></td>
158     <td>Calculates a left bit shifted value.</td>
159 schoenebeck 2949 </tr>
160     <tr>
161 schoenebeck 3580 <td><code>sh_right()</code></td>
162     <td>Calculates a right bit shifted value.</td>
163 schoenebeck 2732 </tr>
164     <tr>
165 schoenebeck 3601 <td><code>sin()</code></td>
166     <td>Sine function.</td>
167     </tr>
168     <tr>
169 schoenebeck 3580 <td><code>sort()</code></td>
170     <td>Sort the given array.</td>
171 schoenebeck 2732 </tr>
172     <tr>
173 schoenebeck 3601 <td><code>sqrt()</code></td>
174     <td>Calculates the square root of given number.</td>
175     </tr>
176     <tr>
177 schoenebeck 3580 <td><code>stop_wait()</code></td>
178     <td>Resumes execution of a suspended script callback.</td>
179 schoenebeck 2971 </tr>
180     <tr>
181 schoenebeck 3601 <td><code>tan()</code></td>
182     <td>Tangens function.</td>
183     </tr>
184     <tr>
185 schoenebeck 3580 <td><code>wait()</code></td>
186     <td>Pauses execution for a certain amount of time.</td>
187 schoenebeck 2971 </tr>
188 schoenebeck 2732 </table>
189 schoenebeck 3580
190 schoenebeck 2732 <h3>Common Sampler Functions</h3>
191     <p>
192     Basic sampler related functions, independent from a particular sampler
193     format or sampler engine.
194     </p>
195     <table>
196     <tr>
197     <th>Function</th> <th>Description</th>
198     </tr>
199     <tr>
200 schoenebeck 3580 <td><code>by_marks()</code></td>
201     <td>Returns all events of an event group.</td>
202 schoenebeck 2732 </tr>
203     <tr>
204 schoenebeck 3580 <td><code>change_amp_lfo_depth()</code></td>
205     <td>Modifies the amplitude LFO depth.</td>
206 schoenebeck 3215 </tr>
207     <tr>
208 schoenebeck 3580 <td><code>change_amp_lfo_freq()</code></td>
209     <td>Modifies the amplitude LFO frequency.</td>
210 schoenebeck 2932 </tr>
211     <tr>
212 schoenebeck 3580 <td><code>change_attack()</code></td>
213     <td>Modifies the amplitude attack time of voices.</td>
214 schoenebeck 3336 </tr>
215     <tr>
216 schoenebeck 3580 <td><code>change_cutoff()</code></td>
217     <td>Changes filter cutoff frequency of voices.</td>
218 schoenebeck 3336 </tr>
219     <tr>
220 schoenebeck 3580 <td><code>change_cutoff_attack()</code></td>
221     <td>Modifies the filter cutoff attack time of voices.</td>
222 schoenebeck 3256 </tr>
223     <tr>
224 schoenebeck 3580 <td><code>change_cutoff_decay()</code></td>
225     <td>Modifies the filter cutoff decay time of voices.</td>
226 schoenebeck 2932 </tr>
227     <tr>
228 schoenebeck 3580 <td><code>change_cutoff_lfo_depth()</code></td>
229     <td>Modifies the filter cutoff LFO depth.</td>
230 schoenebeck 3189 </tr>
231     <tr>
232 schoenebeck 3580 <td><code>change_cutoff_lfo_freq()</code></td>
233     <td>Modifies the filter cutoff LFO frequency.</td>
234 schoenebeck 3247 </tr>
235     <tr>
236 schoenebeck 3580 <td><code>change_cutoff_release()</code></td>
237     <td>Modifies the filter cutoff release time of voices.</td>
238 schoenebeck 2932 </tr>
239     <tr>
240 schoenebeck 3580 <td><code>change_cutoff_sustain()</code></td>
241     <td>Modifies the filter cutoff sustain level of voices.</td>
242 schoenebeck 3189 </tr>
243     <tr>
244 schoenebeck 3580 <td><code>change_decay()</code></td>
245     <td>Modifies the amplitude decay time of voices.</td>
246 schoenebeck 3247 </tr>
247     <tr>
248 schoenebeck 3580 <td><code>change_note()</code></td>
249     <td>Change MIDI note number of note.</td>
250 schoenebeck 2936 </tr>
251     <tr>
252 schoenebeck 3580 <td><code>change_pan()</code></td>
253     <td>Changes panning of voices (stereo balance).</td>
254 schoenebeck 2936 </tr>
255     <tr>
256 schoenebeck 3580 <td><code>change_pan_curve()</code></td>
257     <td>Changes the curve type of panning (stereo balance) changes.</td>
258 schoenebeck 2954 </tr>
259     <tr>
260 schoenebeck 3580 <td><code>change_pan_time()</code></td>
261     <td>Changes the duration of panning (stereo balance) changes.</td>
262 schoenebeck 2954 </tr>
263     <tr>
264 schoenebeck 3580 <td><code>change_pitch_lfo_depth()</code></td>
265     <td>Modifies the pitch LFO depth.</td>
266 schoenebeck 3318 </tr>
267     <tr>
268 schoenebeck 3580 <td><code>change_pitch_lfo_freq()</code></td>
269     <td>Modifies the pitch LFO frequency.</td>
270     </tr>
271     <tr>
272     <td><code>change_play_pos()</code></td>
273     <td>Change the sample playback position.</td>
274     </tr>
275     <tr>
276 schoenebeck 2954 <td><code>change_release()</code></td>
277 schoenebeck 3362 <td>Modifies the amplitude release time of voices.</td>
278 schoenebeck 2954 </tr>
279     <tr>
280 schoenebeck 3580 <td><code>change_reso()</code></td>
281     <td>Changes filter resonance of voices.</td>
282 schoenebeck 3362 </tr>
283     <tr>
284 schoenebeck 3580 <td><code>change_sustain()</code></td>
285     <td>Modifies the amplitude sustain level of voices.</td>
286 schoenebeck 3362 </tr>
287     <tr>
288 schoenebeck 3580 <td><code>change_tune()</code></td>
289     <td>Changes the tuning of voices.</td>
290 schoenebeck 3362 </tr>
291     <tr>
292 schoenebeck 3580 <td><code>change_tune_curve()</code></td>
293     <td>Changes the curve type of tuning changes.</td>
294 schoenebeck 3362 </tr>
295     <tr>
296 schoenebeck 3580 <td><code>change_tune_time()</code></td>
297     <td>Changes the duration of tuning changes.</td>
298 schoenebeck 3121 </tr>
299     <tr>
300 schoenebeck 3580 <td><code>change_velo()</code></td>
301     <td>Change MIDI velocity of note.</td>
302 schoenebeck 3121 </tr>
303     <tr>
304 schoenebeck 3580 <td><code>change_vol()</code></td>
305     <td>Changes the volume of voices.</td>
306 schoenebeck 3362 </tr>
307     <tr>
308 schoenebeck 3580 <td><code>change_vol_curve()</code></td>
309     <td>Changes the curve type of volume changes.</td>
310 schoenebeck 3362 </tr>
311     <tr>
312 schoenebeck 3580 <td><code>change_vol_time()</code></td>
313     <td>Changes the duration of volume changes.</td>
314 schoenebeck 3121 </tr>
315     <tr>
316 schoenebeck 3580 <td><code>delete_event_mark()</code></td>
317     <td>Removes an event from some event group.</td>
318 schoenebeck 3121 </tr>
319     <tr>
320 schoenebeck 2936 <td><code>event_status()</code></td>
321     <td>Checks and returns whether a particular note is still alive.</td>
322     </tr>
323     <tr>
324 schoenebeck 3189 <td><code>fade_in()</code></td>
325     <td>Fade the requested note in.</td>
326     </tr>
327     <tr>
328     <td><code>fade_out()</code></td>
329     <td>Fade the requested note out.</td>
330     </tr>
331     <tr>
332 schoenebeck 3194 <td><code>get_event_par()</code></td>
333     <td>Get the current value of a specific note parameter.</td>
334     </tr>
335     <tr>
336 schoenebeck 3580 <td><code>ignore_controller()</code></td>
337     <td>Drops the given MIDI control change event.</td>
338 schoenebeck 3194 </tr>
339     <tr>
340 schoenebeck 2732 <td><code>ignore_event()</code></td>
341     <td>Drops the given event.</td>
342     </tr>
343     <tr>
344     <td><code>note_off()</code></td>
345     <td>Releases the requested note.</td>
346     </tr>
347     <tr>
348 schoenebeck 3580 <td><code>play_note()</code></td>
349     <td>Triggers a new note.</td>
350     </tr>
351     <tr>
352     <td><code>set_controller()</code></td>
353     <td>Creates a MIDI control change event.</td>
354     </tr>
355     <tr>
356 schoenebeck 2732 <td><code>set_event_mark()</code></td>
357     <td>Adds an event to an event group.</td>
358     </tr>
359     <tr>
360 schoenebeck 3580 <td><code>set_event_par()</code></td>
361     <td>Change the value of a specific note parameter.</td>
362 schoenebeck 2732 </tr>
363     </table>
364 schoenebeck 3580
365 schoenebeck 2732 <h3>GigaStudio Format Functions</h3>
366     <p>
367     Sampler format specific functions, dedicated to the individual features
368     of the GigaStudio format engine.
369     </p>
370     <table>
371     <tr>
372     <th>Function</th> <th>Description</th>
373     </tr>
374     <tr>
375     <td><code>gig_set_dim_zone()</code></td>
376     <td>Changes the currently active dimension zone.</td>
377     </tr>
378 schoenebeck 3229 <tr>
379     <td><code>same_region()</code></td>
380     <td>Check whether two keys are mapped to the same region.</td>
381     </tr>
382 schoenebeck 2732 </table>
383    
384     <h2>Built-In Variables</h2>
385     <p>
386     These are the built-in variables and built-in constants available with the
387     NKSP realt-time instrument script language.
388     </p>
389 schoenebeck 2944
390     <h3>Core Language Variables</h3>
391     <p>
392     Most fundamental NKSP built-in variables, independent from any purpose of
393     being used in a sampler.
394     </p>
395     <table>
396     <tr>
397     <th>Variable</th> <th>Description</th>
398     </tr>
399     <tr>
400 schoenebeck 3297 <td><code>$CALLBACK_STATUS_QUEUE</code></td>
401     <td>Built-in constant reflecting the status of a callback to be
402     alive but suspended. See <code>callback_status()</code> for details.</td>
403     </tr>
404     <tr>
405     <td><code>$CALLBACK_STATUS_RUNNING</code></td>
406     <td>Built-in constant reflecting the status of a callback to be
407     alive and currently executing. See <code>callback_status()</code>
408     for details.</td>
409     </tr>
410     <tr>
411     <td><code>$CALLBACK_STATUS_TERMINATED</code></td>
412     <td>Built-in constant reflecting the status of a callback to be
413     not alive. See <code>callback_status()</code> for details.</td>
414     </tr>
415     <tr>
416 schoenebeck 2944 <td><code>$KSP_TIMER</code></td>
417     <td>Preserved for compatiblity reasons with KSP, returns the same value
418     as <code>$NKSP_REAL_TIMER</code> (refer to the latter for details).
419     Note that KSP's <code>reset_ksp_timer()</code> function is not available with
420     NKSP. However when calculating time differences between two time
421     stamps taken with <code>$NKSP_REAL_TIMER</code>, calling such a reset
422     function is not required, because the underlying clock does not stop
423     when it reached its value limit (which happens every 71 minutes), instead the clock
424     will automatically restart from zero and the calculated time difference
425     even between such transitions will reflect correct durations.</td>
426     </tr>
427     <tr>
428     <td><code>$NKSP_PERF_TIMER</code></td>
429     <td>Returns the current performance time stamp (in microseconds) of the
430     script running. You may read this variable from time to time to take
431     time stamps which can be used to calculate the time difference
432     (in microseconds) which elapsed between them. A performance time
433     stamp is based on the script's actual CPU execution time. So the
434     internal clock which is used for generating such time stamps is only
435     running forward if the respective script is actually executed by the
436     CPU. Whenever your script is not really executed by the CPU (i.e. because
437     your script got suspended by a wait() call or got forcely suspended due to
438     real-time constraints, or when the entire sampler application got suspended
439     by the OS for other applications or OS tasks) then the underlying internal
440     clock is paused as well.
441     <note class="important">
442     You should only use this built-in variable for script development
443     purposes (i.e. for bench marking the performance of your script).
444     You should <b>not</b> use it with your final production sounds!
445     It is not appropriate for being used in a musical context, because
446     when an offline bounce is performed for instance, the musical timing
447     will be completely unrelated to the CPU execution time. Plus using
448     this variable may cause audio drop outs on some systems. In a musical
449     context you should use <code>$ENGINE_UPTIME</code> instead, which is
450     also safe for offline bounces.
451     </note>
452     <note>
453     On some systems <code>$NKSP_REAL_TIMER</code> and
454     <code>$NKSP_PERF_TIMER</code> will actually return the same value. So the
455     difference between them is not implemented for all systems at the moment.
456     </note>
457     </td>
458     </tr>
459     <tr>
460 schoenebeck 3294 <td><code>%NKSP_CALLBACK_CHILD_ID[]</code></td>
461     <td>
462     Reflects the callback IDs of all child threads which the current
463 schoenebeck 3295 script callback instance spawned by having called <code>fork()</code> before.
464 schoenebeck 3294 See the latter function for details about this array variable.
465     </td>
466     </tr>
467     <tr>
468     <td><code>$NKSP_CALLBACK_PARENT_ID</code></td>
469     <td>
470     If the current execution thread is a child thread spawned by a <code>fork()</code>
471     call before, then this variable reflects the callback ID of the parent
472 schoenebeck 3295 thread which created this child thread. Otherwise this variable is <code>0</code>.
473     See <code>fork()</code> for more details about this variable.
474 schoenebeck 3294 </td>
475     </tr>
476     <tr>
477 schoenebeck 2944 <td><code>$NKSP_REAL_TIMER</code></td>
478     <td>Returns the current time stamp in reality (in microseconds). You may
479     read this variable from time to time to take
480     time stamps which can be used to calculate the time difference
481     (in microseconds) which elapsed between them. A "real" time
482     stamp is based on an internal clock which constantly proceeds, so this
483     internal clock also continues counting while your script is either suspended
484     (i.e. because your script got suspended by a wait() call or got forcely
485     suspended due to real-time constraints) and it also continues counting
486     even if the entire sampler application got suspended by the OS (i.e. to
487     execute other applications for multi-tasking or to perform OS tasks).
488     <note class="important">
489     You should only use this built-in variable for script development
490     purposes (i.e. for bench marking the performance of your script).
491     You should <b>not</b> use it with your final production sounds!
492     It is not appropriate for being used in a musical context, because
493     when an offline bounce is performed for instance, the musical timing
494     will be completely unrelated to the CPU execution time. Plus using
495     this variable may cause audio drop outs on some systems. In a musical
496     context you should use <code>$ENGINE_UPTIME</code> instead, which is
497     also safe for offline bounces.
498     </note>
499     <note>
500     On some systems <code>$NKSP_REAL_TIMER</code> and
501     <code>$NKSP_PERF_TIMER</code> will actually return the same value. So the
502     difference between them is not implemented for all systems at the moment.
503     </note>
504     </td>
505     </tr>
506 schoenebeck 2949 <tr>
507     <td><code>$NI_CALLBACK_ID</code></td>
508     <td>Reflects the current event handler instance's unique callback ID.
509     For the same event type there may be more than
510     one event handler instances running. Each one of them has
511     its own callback ID. You can get the current event handler
512     instance's callback ID by reading this built-in variable.</td>
513     </tr>
514     <tr>
515     <td><code>$NI_CALLBACK_TYPE</code></td>
516     <td>Reflects the event type of the current event handler. This variable
517     may reflect one of the following built-in constants:
518     <code>$NI_CB_TYPE_INIT</code>, <code>$NI_CB_TYPE_NOTE</code>,
519     <code>$NI_CB_TYPE_RELEASE</code>, <code>$NI_CB_TYPE_CONTROLLER</code>.</td>
520     </tr>
521     <tr>
522     <td><code>$NI_CB_TYPE_INIT</code></td>
523     <td>Built-in constant reflecting an <code>init</code> event handler type.</td>
524     </tr>
525     <tr>
526     <td><code>$NI_CB_TYPE_NOTE</code></td>
527     <td>Built-in constant reflecting a <code>note</code> event handler type.</td>
528     </tr>
529     <tr>
530     <td><code>$NI_CB_TYPE_RELEASE</code></td>
531     <td>Built-in constant reflecting a <code>release</code> event handler type.</td>
532     </tr>
533     <tr>
534     <td><code>$NI_CB_TYPE_CONTROLLER</code></td>
535     <td>Built-in constant reflecting a <code>controller</code> event handler type.</td>
536     </tr>
537     <tr>
538 schoenebeck 3601 <td><code>$NI_MATH_E</code></td>
539     <td>Base of the natural logarithm (approximately being <code>2.71828</code>)</td>
540     </tr>
541     <tr>
542     <td><code>$NI_MATH_PI</code></td>
543     <td>Natural constant relfecting the ratio of a circle's circumference to its diameter (approximately being <code>3.14159</code>).</td>
544     </tr>
545     <tr>
546 schoenebeck 2949 <td><code>$NKSP_IGNORE_WAIT</code></td>
547     <td>If this boolean built-in variable is <code>1</code> then all calls of your
548     event handler instance to function <code>wait()</code> will be ignored.
549     This may for example be the case if another event handler instance
550     resumed your paused script by calling <code>stop_wait()</code> and
551     passing <code>1</code> to the 2nd argument of that function.</td>
552     </tr>
553 schoenebeck 2944 </table>
554    
555 schoenebeck 2732 <h3>Common Sampler Variables</h3>
556     <p>
557     Basic sampler related built-in variables and constants, independent from a
558     particular sampler format or sampler engine.
559     </p>
560     <table>
561     <tr>
562     <th>Variable</th> <th>Description</th>
563     </tr>
564     <tr>
565 schoenebeck 3074 <td><code>%ALL_EVENTS</code></td>
566     <td>
567     Note IDs of all currently active notes of the current sampler part (a.k.a. sampler channel).
568     This may be passed to many built-in functions like <code>note_off()</code>.
569 schoenebeck 3077 This array variable only contains IDs of notes which were launched due
570     to MIDI note-on events. This variable does not contain IDs of child notes
571 schoenebeck 3079 (i.e. notes which were launched programmatically by calling <code>play_note()</code>).
572 schoenebeck 3074 <note>
573     In contrast to KSP this variable is an integer array type, whereas KSP's
574     pendent of this built-in variable is an integer constant (scalar) called
575 schoenebeck 3075 <code>$ALL_EVENTS</code>. Using the latter with NKSP will cause a
576 schoenebeck 3074 parser warning, the behavior will be the same though.
577     </note>
578     </td>
579     </tr>
580     <tr>
581 schoenebeck 2732 <td><code>$CC_NUM</code></td>
582     <td>MIDI controller number that caused the <code>controller</code>
583     handler to be executed (only useful in the context of a
584     <code>controller</code> handler).</td>
585     </tr>
586     <tr>
587     <td><code>%CC[]</code></td>
588     <td>Provides access to all current MIDI controller values. This can be
589     used in any context. Use the respective MIDI controller number as
590     index to this integer array variable. For instance <code>%CC[1]</code>
591     would give you the current value of the modulation wheel.
592     </td>
593     </tr>
594     <tr>
595     <td><code>$EVENT_ID</code></td>
596     <td>ID of the event that caused the current event handler to be executed. In
597     the context of a <code>note</code> handler this would be the event
598     ID of the note, within a <code>controller</code> handler it would
599     be the controller event ID, etc.</td>
600     </tr>
601     <tr>
602     <td><code>$EVENT_NOTE</code></td>
603     <td>MIDI note number that caused a note related
604     handler to be executed (only useful in the context of a
605     <code>note</code> or <code>release</code> handler).</td>
606     </tr>
607     <tr>
608     <td><code>$EVENT_VELOCITY</code></td>
609     <td>MIDI velocity value of the note that caused that note related
610     handler to be executed (only useful in the context of a
611     <code>note</code> or <code>release</code> handler).</td>
612     </tr>
613     <tr>
614 schoenebeck 2937 <td><code>$EVENT_STATUS_INACTIVE</code></td>
615     <td>Constant bit flag used as possible return value by
616     <code>event_status()</code> in case the requested
617     note is not "alive".</td>
618     </tr>
619     <tr>
620     <td><code>$EVENT_STATUS_NOTE_QUEUE</code></td>
621     <td>Constant bit flag used as possible return value by
622     <code>event_status()</code> in case the requested
623     note is still "alive".</td>
624     </tr>
625     <tr>
626 schoenebeck 3194 <td><code>$EVENT_PAR_NOTE</code></td>
627     <td>Constant value symbolizing the "note number" parameter. See
628     <code>get_event_par()</code> and <code>set_event_par()</code>
629     for details.</td>
630     </tr>
631     <tr>
632     <td><code>$EVENT_PAR_TUNE</code></td>
633     <td>Constant value symbolizing the "tune" parameter. See
634     <code>get_event_par()</code> and <code>set_event_par()</code>
635     for details.</td>
636     </tr>
637     <tr>
638     <td><code>$EVENT_PAR_VELOCITY</code></td>
639     <td>Constant value symbolizing the "note velocity" parameter. See
640     <code>get_event_par()</code> and <code>set_event_par()</code>
641     for details.</td>
642     </tr>
643     <tr>
644     <td><code>$EVENT_PAR_VOLUME</code></td>
645     <td>Constant value symbolizing the "volume" parameter. See
646     <code>get_event_par()</code> and <code>set_event_par()</code>
647     for details.</td>
648     </tr>
649     <tr>
650     <td><code>$EVENT_PAR_0</code> to <code>$EVENT_PAR_3</code></td>
651     <td>Four constant values symbolizing the 4 possible user specific
652     parameters, which i.e. might be used to pass data from one script
653     (slot) to another script (slot). See <code>get_event_par()</code>
654     and <code>set_event_par()</code> for details.</td>
655     </tr>
656     <tr>
657 schoenebeck 2732 <td><code>%KEY_DOWN[]</code></td>
658     <td>This can be used in any context to check whether a certain MIDI
659     key is currently pressed down. Use the respective MIDI note number
660 schoenebeck 2936 as index to this array variable (see also <code>event_status()</code>).</td>
661 schoenebeck 2732 </tr>
662     <tr>
663 schoenebeck 3248 <td><code>$NKSP_EASE_IN_EASE_OUT</code></td>
664     <td>Used to select a fade curve with "ease in and ease out" shape.</td>
665     </tr>
666     <tr>
667     <td><code>$NKSP_LINEAR</code></td>
668     <td>Used to select a fade curve with linear shape.</td>
669     </tr>
670     <tr>
671 schoenebeck 2732 <td><code>$VCC_MONO_AT</code></td>
672     <td>Constant identifying the MIDI monophonic aftertouch controller (also
673     called <i title="Amount of force on held-down key.">
674     MIDI channel pressure
675     </i>). This is somewhat different than in the MIDI standard. With
676     NKSP aftertouch is handled like an additional "regular" MIDI CC controller.
677     Therefore use
678     <code>%CC[$VCC_MONO_AT]</code> to obtain the current aftertouch value
679     in the context of a <code>controller</code> event handler.
680     </td>
681     </tr>
682     <tr>
683     <td><code>$VCC_PITCH_BEND</code></td>
684     <td>Constant identifying the pitch bend wheel controller.
685     This is somewhat different than in the MIDI standard. With
686     NKSP pitch bend is handled like an additional "regular" MIDI CC controller.
687     Therefore use
688 schoenebeck 2936 <code>%CC[$VCC_PITCH_BEND]</code> to obtain the current pitch bend wheel value
689 schoenebeck 2732 in the context of a <code>controller</code> event handler.</td>
690     </tr>
691     <tr>
692     <td><code>$MARK_1</code> to <code>$MARK_28</code></td>
693     <td>Used to select one of the available 28 event groups.
694     See <code>set_event_mark()</code> for details.</td>
695     </tr>
696 schoenebeck 2944 <tr>
697     <td><code>$ENGINE_UPTIME</code></td>
698     <td>Returns the current time stamp (in milliseconds) for being
699     used in a musical context. You may read this variable from time to time
700     to take time stamps which can be used to calculate the time difference
701     (in milliseconds) which elapsed between them. These timing values are
702     based on the internal sample rate and thus it can safely be used to
703     perform musical timing related tasks in your scripts. Especially
704     your script will also continue to behave correctly when an offline bounce
705     of a song is performed.
706     </td>
707     </tr>
708 schoenebeck 2732 </table>
709    
710     <h3>GigaStudio Format Variables</h3>
711     <p>
712     Sampler format specific built-in variables and constants, dedicated to the
713     individual features of the GigaStudio format engine.
714     </p>
715     <table>
716     <tr>
717     <th>Variable</th> <th>Description</th>
718     </tr>
719     <tr>
720     <td><code>$GIG_DIM_CHANNEL</code></td>
721     <td>Constant that identifies the <i>stereo dimension</i>.</td>
722     </tr>
723     <tr>
724     <td><code>$GIG_DIM_LAYER</code></td>
725     <td>Constant that identifies the <i>layer dimension</i>.</td>
726     </tr>
727     <tr>
728     <td><code>$GIG_DIM_VELOCITY</code></td>
729     <td>Constant that identifies the <i>velocity dimension</i>.</td>
730     </tr>
731     <tr>
732     <td><code>$GIG_DIM_AFTERTOUCH</code></td>
733     <td>Constant that identifies the <i>aftertouch dimension</i>.</td>
734     </tr>
735     <tr>
736     <td><code>$GIG_DIM_RELEASE</code></td>
737     <td>Constant that identifies the <i>release trigger dimension</i>.</td>
738     </tr>
739     <tr>
740     <td><code>$GIG_DIM_KEYBOARD</code></td>
741     <td>Constant that identifies the <i>keyboard position dimension</i>.</td>
742     </tr>
743     <tr>
744 schoenebeck 3229 <td><code>$GIG_DIM_ROUNDROBIN</code></td>
745 schoenebeck 2732 <td>Constant that identifies the <i>round robin dimension</i>.</td>
746     </tr>
747     <tr>
748     <td><code>$GIG_DIM_RANDOM</code></td>
749     <td>Constant that identifies the <i>random dimension</i>.</td>
750     </tr>
751     <tr>
752     <td><code>$GIG_DIM_SMARTMIDI</code></td>
753     <td>Constant that identifies the <i>start MIDI dimension</i> (a.k.a iMIDI rules).</td>
754     </tr>
755     <tr>
756     <td><code>$GIG_DIM_ROUNDROBINKEY</code></td>
757     <td>Constant that identifies the <i>round robin key dimension</i>.</td>
758     </tr>
759     <tr>
760     <td><code>$GIG_DIM_MODWHEEL</code></td>
761     <td>Constant that identifies the <i>modulation wheel dimension</i>.</td>
762     </tr>
763     <tr>
764     <td><code>$GIG_DIM_SUSTAIN</code></td>
765     <td>Constant that identifies the <i>sustain pedal dimension</i> (a.k.a. hold pedal).</td>
766     </tr>
767     <tr>
768     <td><code>$GIG_DIM_PORTAMENTO</code></td>
769     <td>Constant that identifies the <i>portamento MIDI controller dimension</i>.</td>
770     </tr>
771     <tr>
772     <td><code>$GIG_DIM_SOSTENUTO</code></td>
773     <td>Constant that identifies the <i>sostenuto MIDI controller dimension</i>.</td>
774     </tr>
775     <tr>
776     <td><code>$GIG_DIM_SOFT</code></td>
777     <td>Constant that identifies the <i>soft pedal dimension</i>.</td>
778     </tr>
779     <tr>
780     <td><code>$GIG_DIM_BREATH</code></td>
781     <td>Constant that identifies the <i>breath controller dimension</i>.</td>
782     </tr>
783     <tr>
784     <td><code>$GIG_DIM_FOOT</code></td>
785     <td>Constant that identifies the <i>foot pedal dimension</i>.</td>
786     </tr>
787     <tr>
788     <td><code>$GIG_DIM_PORTAMENTOTIME</code></td>
789     <td>Constant that identifies the <i>portamento time controller dimension</i>.</td>
790     </tr>
791     <tr>
792     <td><code>$GIG_DIM_EFFECT1</code></td>
793     <td>Constant that identifies the <i>effect 1 MIDI controller dimension</i>.</td>
794     </tr>
795     <tr>
796     <td><code>$GIG_DIM_EFFECT2</code></td>
797     <td>Constant that identifies the <i>effect 2 MIDI controller dimension</i>.</td>
798     </tr>
799     <tr>
800     <td><code>$GIG_DIM_EFFECT1DEPTH</code></td>
801     <td>Constant that identifies the <i>effect 1 depth MIDI controller dimension</i>.</td>
802     </tr>
803     <tr>
804     <td><code>$GIG_DIM_EFFECT2DEPTH</code></td>
805     <td>Constant that identifies the <i>effect 2 depth MIDI controller dimension</i>.</td>
806     </tr>
807     <tr>
808     <td><code>$GIG_DIM_EFFECT3DEPTH</code></td>
809     <td>Constant that identifies the <i>effect 3 depth MIDI controller dimension</i>.</td>
810     </tr>
811     <tr>
812     <td><code>$GIG_DIM_EFFECT4DEPTH</code></td>
813     <td>Constant that identifies the <i>effect 4 depth MIDI controller dimension</i>.</td>
814     </tr>
815     <tr>
816     <td><code>$GIG_DIM_EFFECT5DEPTH</code></td>
817     <td>Constant that identifies the <i>effect 5 depth MIDI controller dimension</i>.</td>
818     </tr>
819     <tr>
820     <td><code>$GIG_DIM_GENPURPOSE1</code></td>
821     <td>Constant that identifies the <i>general purpose 1 MIDI controller dimension</i>.</td>
822     </tr>
823     <tr>
824     <td><code>$GIG_DIM_GENPURPOSE2</code></td>
825     <td>Constant that identifies the <i>general purpose 2 MIDI controller dimension</i>.</td>
826     </tr>
827     <tr>
828     <td><code>$GIG_DIM_GENPURPOSE3</code></td>
829     <td>Constant that identifies the <i>general purpose 3 MIDI controller dimension</i>.</td>
830     </tr>
831     <tr>
832     <td><code>$GIG_DIM_GENPURPOSE4</code></td>
833     <td>Constant that identifies the <i>general purpose 4 MIDI controller dimension</i>.</td>
834     </tr>
835     <tr>
836     <td><code>$GIG_DIM_GENPURPOSE5</code></td>
837     <td>Constant that identifies the <i>general purpose 5 MIDI controller dimension</i>.</td>
838     </tr>
839     <tr>
840     <td><code>$GIG_DIM_GENPURPOSE6</code></td>
841     <td>Constant that identifies the <i>general purpose 6 MIDI controller dimension</i>.</td>
842     </tr>
843     <tr>
844     <td><code>$GIG_DIM_GENPURPOSE7</code></td>
845     <td>Constant that identifies the <i>general purpose 7 MIDI controller dimension</i>.</td>
846     </tr>
847     <tr>
848     <td><code>$GIG_DIM_GENPURPOSE8</code></td>
849     <td>Constant that identifies the <i>general purpose 8 MIDI controller dimension</i>.</td>
850     </tr>
851     </table>
852 schoenebeck 3312
853     <h2>Built-In Preprocessor Conditions</h2>
854     <p>
855     These are the built-in preprocessor conditions available with the NKSP realt-time
856     instrument script language.
857     </p>
858 schoenebeck 2732
859 schoenebeck 3312 <h3>Core Language Preprocessor Conditions</h3>
860     <p>
861     Most fundamental NKSP built-in preprocessor conditions, independent from
862     any purpose of being used in a sampler.
863     </p>
864     <table>
865     <tr>
866     <th>Condition</th> <th>Description</th>
867     </tr>
868     <tr>
869     <td><code>NKSP_NO_MESSAGE</code></td>
870     <td>
871     By default this condition is not set. By explicitly enabling this
872     condition with <code>SET_CONDITION(NKSP_NO_MESSAGE)</code> it
873     causes all subsequent <code>message()</code> calls to be ignored
874     and filtered out on preprocessor level. See function <code>message()</code>
875     for details.
876     </td>
877     </tr>
878     </table>
879    
880 schoenebeck 2732 </body>
881     </html>

  ViewVC Help
Powered by ViewVC