If you want your Kontakt sample library to support Kontakt 2 as well as later versions, there are some format differences that need to be considered. This article explains an inconsistency in the "play_note" function's sample offset value.
If you use the sample start variable in the "play_note" function, there is an important inconsistency that you need to account for: the conversion ratio between milliseconds (which ENGINE_UPTIME uses) and microseconds (the unit of the sample offset variable) does not equal 1000 as it should, and as how Kontakt 3 and 4 respond. Instead, the ratio is 1081. Basically this means that if you want Kontakt 2 to play a sample starting 1000 microseconds (?sec) in, you have to tell it to start at 1081 ?sec to achieve the correct sample start time.
To account for inconsistencies such as this, you need to make separate K2 and K3/K4 patches. What I like to do is include a constant within the script, like this:
declare kontakt.version := 2
declare kontakt.offset_ratio := 2
select (kontakt.version)
case 2
kontakt.offset_ratio := 1081
case 3 to 4
kontakt.offset_ratio := 1000
end select
In previous versions of Kontakt, you used to be able to detect the Kontakt version within the script, using the differences in effect IDs, but that was changed in the latest release of Kontakt 3. Now you have to change the "kontakt.version" variable manually.
Enjoyed reading this blog article? Here are some related topics with more articles you'll like: Articles, DIY Sampling, Kontakt Scripting