Scripting dynamics = value inconsistency



  • Using the latest scriptnode.
    I'm trying to script the threshold control of the dynamics, but the value of my knob is inconsistent with the value on the dynamics module. Depending on how fast you turn the knob, it'll give you a different value when it's supposed to reach the 0dB point.
    Here's an example. Turn the knob and compare to the compressor module threshold.

    HiseSnippet 1024.3ocuV0saaTDEdl3L.dKthVw8rJhKbjJQqKskJUgparcPVkjZEGpnRHJi2cb7nL6Lq1c1RMUQhWivU7ZvUj2BdLnuAvY1em3rJMXI5d247cNy4al4b9lcRrxmkjnhQ31GsLhgveLY5RodwfETtDMdHBeSx9zDMK1M20tKinIIr.DF25aLNvs2Dk881GuKUPk9rZWHzyUbe12xC45ZuS5+TtPrGMfcDOzJ560eruRNPITo.eZQ7PQT+SnGyNfZBaCBB+AiB3ZU7TMUyRP3M2UErb5B0OKyi+47D9LAyXzCMEVnb26oDAFFa7hFrfKBlTtuSPvpLo9TnU9ovmR1mGvq7WeZ7IY.t0YXedf23pnWu2M87ZhdXK5sYN8tEYpeLORWiX31MHikvE0bJbEXSq7XQa7WXx.EDgTuSH8D1dwfQUFcefm2cbuum21OpiSGG3hHQ69JZr6vkRZH2Oom6W6l0ZrywL8n4yY95taUAtkIs5jdpTMyjPY8fTFnBiTRvn6VYnakWnNNbofKYtySk9ZtR5dzhXVxB3LwsqeYN2AVUQJa6NNuoiiawGeta2R2FaKnJdsSBS+DsNlOKUC6wx04QYQdpyoYbHiOlHMzMVIFPEhYPqW2JpX3ZEAUxCTZ1yjc214MNscN0wcUn4yaDqX4Er3FgMSCwWUhckogyXwkahx.g1hK12ciqWeme9kiUfJ4XIW+rHVgs8fS4ttD0CUsYscUuGs8ls0ZHrZWWtwGUz7XFAJBGBUmM.byhAfoBd.KFwAN9gjrqQT1YisDD56FOjpokKCrhPUhXwZt4rBOj8JPhJetpMYHK4DsJJK1hdOD14cVzWWWvep+xJie8G6GxCBDrIpDt4trNr6dNHpFMk+KYb82Ny78GONzVP8EmGRes8NIIc9bN3gPbC1EEpBJnrOeFS.5pWRm.TqTAoBp9hRXFc6B.Cmr0JL5ARfqKs00+Onq4cskcutz8VjIbs+hl46FMvW3h9+a9V7JQGRtNXMY2jr22+d9IgamyEGRolWwaAURfq7jslMRRgRFXehYbWI1sJ.neBhg1MDFuGxDLZh0j1K5aFYhynUCknFrgB81+rF9Pysrc0pgVkIetUIafOY+2AqIxTfrJS98yN6yNu.6x65BfKVH2e3uGYwh8gGVSiZnTWF.25hsFstdsFMzYdnJUykGuOEdmyHObPZ3T3en7YPioTxDvhSvaXtCxs8L1FJLkICxL9G3q.rmwFW.1qD78RMBo9wpW5mq0a5y+nLOv9Vl8GfsgeEErcqD4IDuc7PfDK+k99louu.lbaNm6tF47kqQN2aMx49qQNOXMx4qVibd3Uli4mgeRpVElqLCNlLJ6wVLtZpC2B8uYmCTDA


  • Figured it out.. if I remove the if (value) statement, it works as expected

    inline function Threshold (component, value)
    {
    if (value)
    {
    Dynamics1.setAttribute(6, value);
    }
    };

    Knob1.setControlCallback(Threshold);



  • Yes why do you had that if in the first place? Also, MAGIC NUMBER ALERT!!! 😉



  • @Christoph-Hart yeah;

    MAGIC NUMBER == BAD!

    • do we have a list somewhere of all the Global Constants, I ask because I recently needed to do something to the sample properties and I couldn't find anything so had to use a magic number....??


  • @Christoph-Hart said in Scripting dynamics = value inconsistency:

    Yes why do you had that if in the first place?

    In my defense, it was 4am 🙃 🙃 😵

    Also, MAGIC NUMBER ALERT!!!
    I've been taking them from the module browser. Should I be calling them differently?



  • @dustbro there really really should be a set of constants you use, its just finding where these are documented thats sometimes the problem...

    so

    Dynamics1.setAttribute(Dynamics1.Threshold,value)



  • @Lindon Most are documented in the module browser. Just right click the module name. You can also use the auto-complete in your script to bring up a list of constants.

    c1fb1ded-5441-4d6c-9669-5c81a6321a49-image.png



  • I have the Module Browser permanently displayed, so it's quick to find what I need, but this might not be the best coding style. Will work on that... I promise...



  • Yes, module browser is useful for this, but the new documentation will contain a searchable reference for all modules including parameter IDs etc.

    Meanwhile, I actually prefer the autocomplete window to give me the Parameter IDs.



  • @d-healey well on this very subject...

    first I have no idea how to open this module browser - where is it?

    and second can anyone tell me the correct association between the values returned by the autocomplete for

    Degrade1.setAttribute(Degrade1.???????)

    and the names on the Degrade knobs?

    which say

    Harmonics
    Bit Crush
    Gain
    Sample rate
    Post Filter

    whilst autocomplete says:
    Headroom
    Quant
    Rate
    PostFilt
    NonLin
    DryWet



  • @d-healey said in Scripting dynamics = value inconsistency:

    You can also use the auto-complete in your script to bring up a list of constants

    The autocomplete doesn't work when you're iterating thru an array, that's why I started using the Magic Numbers. Much easier to type 🤡



  • @Lindon You need to add it to the interface. I have plans for a video on the subject but no-one was interested 😞
    da5ee494-0971-457c-b1e2-395e4b068e47-image.png

    @dustbro

    Whatchu talkin bout?

    21fd8657-18bc-43f5-be7d-d2cbdf4b7dd5-image.png



  • @d-healey well this now gets sillier and sillier...

    add a degrade fx to you project and it shows you a set of buttons with these names:

    Harmonics
    Bit Crush
    Gain
    Sample rate
    Post Filter

    Create a variable for the fx and press <esc> to get autocomplete and it shows you these attributes:

    Headroom
    Quant
    Rate
    PostFilt
    NonLin
    DryWet

    Open a module browser and right lick on Degrade and it shows you this set of parameters;

    1. Threshold
    2. Output
    3. Attack
    4. Release
    5. Knee

    Unless I'm doing something completely daft(not outside the bounds of possibility) I think this is broken.



  • No, what he meant was that it will not be able to parse the iterator variable as array expression and detect it as object.

    This is true, but it works for standard array syntax (actually pressing escape kind of "runs" a little script that is able to evaluate some basic expressions to receive the object, but it fails with every scoped variable like iterators or local variables).

    autocomplete.gif



  • I really need to remove these old modules, I haven't used them for years and they are completely broken.

    There are bit crush and sample reduction nodes available in scriptnode, which should work better and more consistently.



  • @Lindon I just worked out the documentation is OFF by one press degrade to get the params for the limiter, press Chorus to get the params for the degrade FX...

    now can anyone (@Christoph-Hart ) tell me how those are mapped to the knobs in the FX?



  • @Christoph-Hart but I'm under a tight deadline and I dont have the time to learn scriptnode now, so I'd like these to work,



  • @Christoph-Hart @d-healey When I used the method in Christoph's video (with [i] ) the popup doesn't work.
    so if I type something like myList[i]. = no popup



  • @Lindon said in Scripting dynamics = value inconsistency:

    now can anyone (@Christoph-Hart ) tell me how those are mapped to the knobs in the FX?

    You can add a knob with its callback, then you test the attributes from 0 to 5 while you look at what is moving in the module...



  • @dustbro I can confirm it does not work for me either on arrays with [i]


Log in to reply
 

8
Online

502
Users

1.8k
Topics

13.6k
Posts