1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

Solved How to Retrieve Engine ADSR Values in ms

Discussion in 'Scripting Workshop' started by Oneiroi, Oct 6, 2021.

  1. Oneiroi

    Oneiroi NI Product Owner

    Messages:
    30
    I need a way to store the value of the engine Release time in my script. However, I need the value in milliseconds, not the 0-1000000 scale. As I understand it, it's possible to retrieve a string containing the value with the function
    Code:
    get_engine_par_disp($ENGINE_PAR_RELEASE,$grp_number,$ahdsr_idx,-1)
    But afaik Kontakt's scripting language can't convert a string to a float or int. So do I have to figure out the math formula for converting the 0-1000000 scale to actual time values myself? Any other way to do this?
     
  2. corbo-billy

    corbo-billy NI Product Owner

    Messages:
    652
    You can test:

    Code:
    set_text($yourlabel,get_engine_par_disp($ENGINE_PAR_RELEASE,$grp_number,$ahdsr_idx,-1) & " ms ")
     
  3. Oneiroi

    Oneiroi NI Product Owner

    Messages:
    30
    Sorry, perhaps I wasn't being clear enough...I'm not trying to display some text, but trying to retrieve the actual time value of the engine release (either in microseconds or milliseconds, whatever...). I've got a knob that controls the Release time of all groups, but this knob's values are scaled from 0-1000000 and I can see how many ms that corresponds to by using the get_engine_par_disp function, but I want to actually store that value in a variable and use it in my script.
     
  4. corbo-billy

    corbo-billy NI Product Owner

    Messages:
    652
    You can use set_knob_label _
     
  5. Oneiroi

    Oneiroi NI Product Owner

    Messages:
    30
    Once again, I'm not trying to display anything with this value...I want to use it within my script for determining the length of a while loop in the release callback.
     
  6. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Koala library has a couple of functions for converting envelope engine parameters into real-world time units.
     
  7. Oneiroi

    Oneiroi NI Product Owner

    Messages:
    30
    Oh, interesting! I've never used the Koala library and for now, I've stuck with coding KSP without any compiler (it's fine for now, might want to look into that one day if I get into bigger scripts). Would you be so kind as to show me what those functions would return in Kontakt's native language? I'm looking to get the Release time specifically.