--- doc/docbase/instrument_scripts/nksp/reference/functions/nksp_change_vol_time_function.html 2017/05/25 15:16:28 3216 +++ doc/docbase/instrument_scripts/nksp/reference/functions/nksp_change_vol_time_function.html 2017/05/25 16:28:34 3217 @@ -41,7 +41,33 @@
None.
None yet.
+
The following example demonstrates a simple, custom volume envelope generator.
+
+on init
+ declare const $time1US := 800000 { 0.8 seconds }
+ declare const $time2US := 1600000 { 1.6 seconds }
+ declare const $time3US := 3000000 { 3 seconds }
+end on
+
+on note
+ { Start the note with a (immediately) decreased volume
+ of -30 dB. }
+ change_vol($EVENT_ID, -30000)
+
+ { Fade the note's volume within 0.8s from -30 db up to
+ its normal volume, that is to 0 dB. }
+ change_vol_time($EVENT_ID, $time1US)
+ change_vol($EVENT_ID, 0)
+
+ { Remain in this stage with 0 dB for 1.6 seconds. }
+ wait($time1US + $time2US)
+
+ { Now fade the note's volume from 0 dB down to -12 dB
+ within 3 seconds. }
+ change_vol_time($EVENT_ID, $time3US)
+ change_vol($EVENT_ID, -12000)
+end on
+
change_vol()
, fade_in()
, fade_out()