/[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 3679 - (hide annotations) (download) (as text)
Fri Dec 27 23:31:04 2019 UTC (4 years, 3 months ago) by schoenebeck
File MIME type: text/html
File size: 34824 byte(s)
* NKSP: Added recently added built-in functions msb() and lsb() to reference
  docs.

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

  ViewVC Help
Powered by ViewVC