Kontakt KSP - listener per beat dillema
- KVRAF
- 4801 posts since 1 Aug, 2005 from Warszawa, Poland
I am using "SIGNAL_TIMER_BEAT" for listener in Kontakt 4 KSP, everything was making sense until I started to check different time signatures. Then I have found out that my timer doesn't work "per beat", as it says in the manual, but "per quarter note", no matter what signature it is. Sonar is my only host that supports non x/4 signatures, so I don't know how to check it... There are two options, Sonar is not passing song position properly to Kontakt (Kontakt reads signature properly), or Kontakt is working "per quarter note" by design. Maybe you know the answer and you can save me the trouble?
- KVRAF
- 24442 posts since 7 Jan, 2009 from Croatia
Yep, listener works per quarter note, as far as I know. I think this was done to ensure note value consistency no matter the time signature.
However, you can still differentiate between different time signature denominators and if you really want, you can make your listener callback do stuff on each subdivision, like so:
This will support all regular denominators from 1 to 32 (1, 2, 4, 8, 16, 32).
However, you can still differentiate between different time signature denominators and if you really want, you can make your listener callback do stuff on each subdivision, like so:
Code: Select all
on init
declare $tickcount
declare $beatcount
set_listener($NI_SIGNAL_TIMER_BEAT,24)
end on
on listener
select ($NI_SIGNAL_TYPE)
case $NI_SIGNAL_TIMER_BEAT
inc($tickcount)
if ($tickcount mod (96 / $SIGNATURE_DENOM) = 0)
inc($beatcount)
message ($beatcount & " beats")
end if
end select
end on- KVRAF
- Topic Starter
- 4801 posts since 1 Aug, 2005 from Warszawa, Poland
Thank you. I thought, it might be so. Now, where is the facepalm, smiley when I need it.
- KVRAF
- 24442 posts since 7 Jan, 2009 from Croatia
Check the post again please, I edited it. 
- KVRAF
- Topic Starter
- 4801 posts since 1 Aug, 2005 from Warszawa, Poland
Thanks, I can figure how calculate this, once I know that 'beat' ain't 'beat' for real. Why didn't they say so in the manual, 'beats' me.
BTW, do you know, if there are limits to size of script in Kontakt? I know limits in array size and number of UI controls, but I wonder about the size of the script itself, or number of variables one can declare.
BTW, do you know, if there are limits to size of script in Kontakt? I know limits in array size and number of UI controls, but I wonder about the size of the script itself, or number of variables one can declare.
- KVRAF
- 24442 posts since 7 Jan, 2009 from Croatia
I know of scripts having several tens of thousands of lines, you should be fine. 
- KVRAF
- Topic Starter
- 4801 posts since 1 Aug, 2005 from Warszawa, Poland
I'm at about 4k lines, but I'm just warming up... Nah, I'm not afraid I will hit the wall anytime soon, I'm just curious, there is no mention of a limit anywhere.
-
- KVRer
- 6 posts since 20 Oct, 2009
Many thanks @EvilDragon !EvilDragon wrote: Fri Jan 24, 2014 8:18 am Yep, listener works per quarter note, as far as I know. I think this was done to ensure note value consistency no matter the time signature.
However, you can still differentiate between different time signature denominators and if you really want, you can make your listener callback do stuff on each subdivision, like so:
This will support all regular denominators from 1 to 32 (1, 2, 4, 8, 16, 32).Code: Select all
on init declare $tickcount declare $beatcount set_listener($NI_SIGNAL_TIMER_BEAT,24) end on on listener select ($NI_SIGNAL_TYPE) case $NI_SIGNAL_TIMER_BEAT inc($tickcount) if ($tickcount mod (96 / $SIGNATURE_DENOM) = 0) inc($beatcount) message ($beatcount & " beats") end if end select end on
Trying to have it create a click track with custom sounds in a instrument, it seems it gets off and doesn't sync exactly with the beat. Any ideas why this might be?
Any help would be appreciated!
Code: Select all
on init
declare $tickcount
declare $beatcount
set_listener($NI_SIGNAL_TIMER_BEAT,24)
end on
on listener
select ($NI_SIGNAL_TYPE)
case $NI_SIGNAL_TIMER_BEAT
inc($tickcount)
if ($tickcount mod (96 / $SIGNATURE_DENOM) = 0)
if ($NI_TRANSPORT_RUNNING = 1)
inc($beatcount)
message ($beatcount & " beats")
play_note (60,127,0,-1)
end if
end if
end select
end onYou do not have the required permissions to view the files attached to this post.
