# Tempo-based script/automation?



## argitoth (Jul 28, 2013)

I'm trying to create a stutter delay, so the delay turns on and the instrument "turns off".

-Assume the delay is placed in the send effects
-Assume there is a "Gainer" effect controlling volume of the entire instruments

Here's what I'm trying to make happen:

on note, return volume (delay volume) = 0.0, 
wait(1/8 of a beat)
then fade out (to prevent clicks) Gainer volume to -infinity (so turn off the instrument sound after the delay has buffered for the length of its delay)

keep the delay on until:

on release, return volume is -infinity, Gainer volume = 0.0 (so the delay is effectively turned off and the instrument can be heard again)

How do I calculate when to fade out the Gainer?


----------



## argitoth (Jul 29, 2013)

here's my first clue:

32nd delay 1.0 = NI_SIGNAL_TIMER_BEAT,8
32nd delay 2.0 = NI_SIGNAL_TIMER_BEAT,4
32nd delay 3.0 = NI_SIGNAL_TIMER_BEAT,3
32nd delay 4.0 = NI_SIGNAL_TIMER_BEAT,2
32nd delay 6.0 = ?
32nd delay 8.0 = NI_SIGNAL_TIMER_BEAT,1
32nd delay 12.0 = ?
32nd delay 16.0 = NI_SIGNAL_TIMER_BEAT,1 mod 2

Problem is that I can't get 6 and 12 divisions (it's not crucial because this is just for controlling output gain).

It would be better to calculate ms rather than beats. The time between beats = ms. Now the question is, how do I get Kontakt to measure the time between beats?


----------



## argitoth (Jul 29, 2013)

got it. KSP Reference Manual 4 page 110

$DURATION_BAR
$DURATION_EIGHTH
$DURATION_SIXTEENTH
$DURATION_QUARTER_TRIPLET
$DURATION_EIGHTH_TRIPLET
$DURATION_SIXTEENTH_TRIPLET


----------

