What does HISE use for its Midpoint Formula?
-
Hey!
I'm trying to find how I can remake the whole midpoint curve function in HISE (the whole curve skew equation) or figure out how the curve is calculated.. Anyone have ideas?
Thanks!
-
@Casmat Why?
And
Math.pow()
-
@d-healey yeah, my question may be a bit of a stretch since I'm tring to adjust skewing of knobs in scriptnode..
HiseSnippet 2240.3oc6Y07aabbEeVIsxlzoIwIwnA8zB0hVJ.EAtTJxRsvPTeZKXKIBQEEm.zZOZ2gjS4xcVr6PKwFXfhdo8VOma8Ogds2L58BTf9OP9SnW5Y22alc4NqDEMspgcPQDfEz79Xley68l2GqaDK7XIIhXhUoiGDwHVumcyAgxNa0gxCI6sMw58s2mlHYwNZRaNHhljv7IVVSeejfUoYHpe92quIMfF5wxIQHmH3drGw6wk4TaT+g7ffco9ri48Ljd4564IB2RDH5C3YZ6pjHpWWZa1ATTrorIVytiOWJhaJoRVBwZlME9CZ1QbVnV9S3I7SCX3BWRSXizj2UD3iHFoR1pCOvuQ18NgPrrajaElVaE9D68497gzysFenhgStFl1CqoJBuoK.OWS3U0.di.RVFPZFMjtscSuXdjLmChmaYuWH3bZQAytITzxRlpps8VBPhP4h8ncY6FCKFpQkUpVcAG3Wy+qJWNl01QB9Cm64rSXadHaQuXFbOPeT7gm9aYdxJnbnLKlHowREmJtZ00jYZhaQCBNE7cUZ0OzSxEgUlu72TtDfjDQ.awnXdnrR5ozlI2l4wOkEjrqHFCo1k5AFQC95.vFLZ2GwdFKnR04mGNxmC+ChWRjNOiF67vPwot.1ytsfZaI5EIBgEUlSwctBJrYeoTDd0pjxeTJU6UnTshJo8E69X7rTOtPk1oUKzhNmloCvEURgSzLdDMrMqxmsxhfCpVU72vubMk.hCaHP63ZK94nCfGF.lKmLKtiHTIJhyXQPEuLPt.fof9LkCYHxvMbCoLleZeIqRNYzcjo.XwgiYr1WbaROvgg.EwwnQZpsdrXk2phZgy8tmi67kKAjRUCO0SPVUPCTJ0Z4Tw3yRCsaUliERgWg9ysfiLVcuJ87wb0FFGL5K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oMOMJE7AJZMDACh5HB4dHIsDYHcidh9p7.J39.ZxwTd.FV2reBzkh+ggMAgUCvaM8Ir3D0FeCaXxiEgKxTG.u7ACqd7rAMnXk1aaiM9.Amr3E8FFjV.qlwI3VjUiTak.H1SkcBxBh9mFPkpdLXbOr2gorl1nWBcDJtBd+Mk9b1K4DjqGMfbhtwD3xgmBJdJhsQQm0tMhtBf+V.3igILu320X7nzZJSLQL.LDCMbEX31mGlho7RF6SO+BzVtdSIKBeMjR6u7se6ea8lcYmowJw5iscWbokVwcokpszpKu1p0p4RzWI0Gf4B6GgrQeng.HrWkxhXfnYuLhHjKgn5+4WIhTTe5Gu8+Zc82fnYOgP1AdkPtzk6Ub9e0HrHvqiI47eQ6+5cpqiBNhkMayksFDiffanBBbeGGE7yFUTvKd8ty+fueh78EbKVlvwvH9l5cZoY96K7KV+e7z+y5lpJZ05mWWMZTHSU7RkYJeYZZp87GliZHL0zTXjLRExhmGoFaJDc6QU0RtVinY1NxczLuk8WBynn9FVpLP2QstkHtmy8YPI.rWJ2w7Ih+mS5mHNZh+Dw5wlNFFuIIRj.CGZryWfWMSdayj8CKJtlTAovq2tv0yTt5YDMj7l0aPCKrYv5B6z9biYE9t02Q8QZZxfai+gIdvkklGcq2f9vnPpgEcMULmbMSxO.leB7KdEZLc5ItQ5WiuV9reu6qk+1aTj2L8VWJCiM4XOw6D9LV.7ZTgwOxNcn8LpEeNsuHTj0dWti9HFzaZ61rXSrOxKzFRIL0eNkOo9Qr.FMwr5T8GAcyQi2WU17ZYKbesmyXj9qO0VCWGLGfy6D+1ajwFm9+qGabxe8Ao.+9sW7GaCohq4nbkNua7kuMl17swYzi5EKdhmdHc7Q+MUTf6cn5+L2R16iqcF94nswwLwO8F+IddX75mAUeFsN0tF5rz0PmkuF574WCcV4ZnycuF5r5X0AqTmN8.FyCDZripoQKKcyJpvex+Ez7S9xC
In this snippet, I have a knob on the UI and its connected to a scriptnode knob. The scriptnode knob affects gain and gain1 nodes. The problem is the gain1 node.. when mode 2 is enabled, I want to change gain1's min, max, and skew values. and then on mode 1, it to change back to what it is right now. Is there a way to change these values in a node from the ui? Or do I have to add soft bypasses and make 2 gain nodes with the different parameters..
Thanks!
-
@Casmat I think doubling the control in scriptnode would be the easiest solution. Then just hide/show the correct knob on the UI.
-
@d-healey what do you mean?
-
@Casmat Have two knobs on your UI, one for each mode. Only show the one for the currently selected mode. In your scriptnode patch you also have two knobs, and two sets of nodes if necessary. Connect the two knobs on the UI to the two knobs in the scriptnode patch. If you plan to allow the knobs on the UI to be automatable then this might not be a good solution because each would have independent automation.
Another solution is one knob on the UI and when the mode is changed you update its range and change which knob of the scriptnode patch it controls. This solves the automation issue.
-
@d-healey for the second solution where we change the range, even if I change the range in the main knobs in scriptnode, the values dont transfer, just the position of the knob.. I made this new snippet, which will probably be better at showing what I wanted in the first place, sorry! Is this what you were thinking of?
HiseSnippet 2508.3oc6Z8zaabbEeWJMxlzwN1I1HA8zBgBTJ.EBtqTjsZfgn9qsfsrHDUTbBPq8ncGRNkK2YwtCkDafAJ5k1a8XQt0OB8ZuYzyo.En8CP9HjK8r6alYWtyRQQQIHXaDDAXAOu+Ly6898l48lYU8HlKINlEYXVb+9gDCyO.0ne.u85swz.is2vv7VncvwbRjkhzZ8CwwwDOCSyodjffYwoMj+7iqrF1GG3RxHYXb.i5RdJsKkmQsdsmP882B6Q1m1US5EqssKKXclOqGXOSgpZDhc6faQdFVHVAjg4La5Q4rnFbLmDaXN8ZLu9MZyNNPI+AzX5g9Dw.aiFvDoHuEy2SXwBpFq2l56UO0uiMLLQ0yhBSohB2EsC0iNfdVz31RFVYZnGOLKj27lJm4YqadU0LuQXRlZlzzJS5NnFtQzPdFGg8bCz1A.3zDCgccSQIqQg+5Ln0YfDA7JcwcHaEACFnQ4kpVcdK3Wy8EkJEQZYwA7v5gVaFzhFPp3FQ.+PfQQ6d3ui3xKKjSHSkXNNhK4T1VothLQQbcru+g.1UtYu.WNkETdtReaohfkDy7IUBinA7xIqRKBeChK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Uan1cLKjMLo20s8Fzhw.yTQSZiFiTgzitGoFC6s2Do80ALt5aq5TpNYN8fdey4Do8mMN+1Yx76hnj2N9cgOaNR6OeaD47hRnAGHcldhy6OdxP0LNSWYMFqSWr7tiWpGcU+4Gtmh4MPeE9Hh7i+I6l8dxwMYQcsdDApSId6D6w7s0+2S52VObh+15pGBc+HbPbHKlXqOyCwyQm2FDduf7hqHkSJg6sE3d5xUKknljWuVcbPtICFmal1gdh9aCto7Kv0f.di2twtfyhykc.SPO+Xh74es0ULiriN4Gii7.bwM2CQM0D+vYWf+LCl48t+LCd68ziWMukVwTarAU7FXaFbDwG1MJswOBk7L7oTyucZGV.K84bx.58H7HZqVj7W4dTNzpbN1sSFk6VaOhOAGqeCfZpWaP9BDWtXg8E9cEGId8oHk4ZINCv5cBtck7LwS8S5mIdx28AGA99MJ9IH3nXGKITZ8tAKea75xuMVitX2H1KRdLUwl9qKo.9cf7uBthncDisF7AlQhmUV7wznuv0Uju9YP0mQqiykPmEtD5r3kPmO+RnyRWBct+kPmGLVcDUpStWqHmGHTeSYSillplUjo+F+ePOytRj
Just don't know if its the best.. do you think there are ways to make this more efficient?
-
@Casmat That looks good to me, but I'm no scriptnode expert.
-
@d-healey ok thanks a ton David!!
-
@Casmat Just passing by.... Why not use a
control.minmax
node ? You have access to min / max / skew parameters : -
@Matt_SF Ooh, that looks good! Thanks!!
-
Not sure how HISE does it (I didn't look in the source) but here's the function from my math library:
inline function exponentialCurve(min, max, midpoint, alpha) { local a = Math.log((max - min) / (midpoint - min)); local b = Math.log(2); local exponent = a / b; return min + (max - min) * Math.pow(alpha, exponent); } inline function reverseExponentialCurve(min, max, midpoint, value) { local a = Math.log((max - min) / (midpoint - min)); local b = Math.log(2); local exponent = a / b; return Math.pow((value - min) / (max - min), 1 / exponent); }
Basically it's
- set the ratio
- set the divisor, log(2) because you're aiming for the halfpoint
- find the exponent
- exponentiate the alpha to find the correct value in the range, add it to the minimum