--- doc/docbase/instrument_scripts/nksp/reference/01_nksp_reference.html 2016/07/13 16:04:36 2943 +++ doc/docbase/instrument_scripts/nksp/reference/01_nksp_reference.html 2016/07/13 16:52:58 2944 @@ -140,7 +140,92 @@ These are the built-in variables and built-in constants available with the NKSP realt-time instrument script language.

- + +

Core Language Variables

+

+ Most fundamental NKSP built-in variables, independent from any purpose of + being used in a sampler. +

+ + + + + + + + + + + + + + + + +
Variable Description
$KSP_TIMERPreserved for compatiblity reasons with KSP, returns the same value + as $NKSP_REAL_TIMER (refer to the latter for details). + Note that KSP's reset_ksp_timer() function is not available with + NKSP. However when calculating time differences between two time + stamps taken with $NKSP_REAL_TIMER, calling such a reset + function is not required, because the underlying clock does not stop + when it reached its value limit (which happens every 71 minutes), instead the clock + will automatically restart from zero and the calculated time difference + even between such transitions will reflect correct durations.
$NKSP_PERF_TIMERReturns the current performance time stamp (in microseconds) of the + script running. You may read this variable from time to time to take + time stamps which can be used to calculate the time difference + (in microseconds) which elapsed between them. A performance time + stamp is based on the script's actual CPU execution time. So the + internal clock which is used for generating such time stamps is only + running forward if the respective script is actually executed by the + CPU. Whenever your script is not really executed by the CPU (i.e. because + your script got suspended by a wait() call or got forcely suspended due to + real-time constraints, or when the entire sampler application got suspended + by the OS for other applications or OS tasks) then the underlying internal + clock is paused as well. + + You should only use this built-in variable for script development + purposes (i.e. for bench marking the performance of your script). + You should not use it with your final production sounds! + It is not appropriate for being used in a musical context, because + when an offline bounce is performed for instance, the musical timing + will be completely unrelated to the CPU execution time. Plus using + this variable may cause audio drop outs on some systems. In a musical + context you should use $ENGINE_UPTIME instead, which is + also safe for offline bounces. + + + On some systems $NKSP_REAL_TIMER and + $NKSP_PERF_TIMER will actually return the same value. So the + difference between them is not implemented for all systems at the moment. + +
$NKSP_REAL_TIMERReturns the current time stamp in reality (in microseconds). You may + read this variable from time to time to take + time stamps which can be used to calculate the time difference + (in microseconds) which elapsed between them. A "real" time + stamp is based on an internal clock which constantly proceeds, so this + internal clock also continues counting while your script is either suspended + (i.e. because your script got suspended by a wait() call or got forcely + suspended due to real-time constraints) and it also continues counting + even if the entire sampler application got suspended by the OS (i.e. to + execute other applications for multi-tasking or to perform OS tasks). + + You should only use this built-in variable for script development + purposes (i.e. for bench marking the performance of your script). + You should not use it with your final production sounds! + It is not appropriate for being used in a musical context, because + when an offline bounce is performed for instance, the musical timing + will be completely unrelated to the CPU execution time. Plus using + this variable may cause audio drop outs on some systems. In a musical + context you should use $ENGINE_UPTIME instead, which is + also safe for offline bounces. + + + On some systems $NKSP_REAL_TIMER and + $NKSP_PERF_TIMER will actually return the same value. So the + difference between them is not implemented for all systems at the moment. + +
+

Common Sampler Variables

Basic sampler related built-in variables and constants, independent from a @@ -227,6 +312,18 @@ Used to select one of the available 28 event groups. See set_event_mark() for details. + + $ENGINE_UPTIME + Returns the current time stamp (in milliseconds) for being + used in a musical context. You may read this variable from time to time + to take time stamps which can be used to calculate the time difference + (in milliseconds) which elapsed between them. These timing values are + based on the internal sample rate and thus it can safely be used to + perform musical timing related tasks in your scripts. Especially + your script will also continue to behave correctly when an offline bounce + of a song is performed. + +

GigaStudio Format Variables