Value output from scriptnode
-
Is it possible to return a value from scriptnode? Let's say for example you have an envelope follower that modulates a knob, and you want that value to update something in the UI to animate or pass on to other processors?
-
@audiolyf I think this is what global cables are for.
-
Got this to work and it works fine in HISE, but on a compiled plugin it doesn't seem to trigger the callback when the UI is closed. @DanH I saw you were messing with the global cables a while back too, did you get it to work out?
@Christoph-Hart Are global cables only good for changing visual things in the UI and is there a better approach for this?
In my example it's of course an unnecessary way of modulating the saturation through scriptnode, but there is all types of fun to be had with making more complex modulation signals with scriptnode and using those with outside processors, so I'm dying to know if I'm using it in the wrong way and if there is a way around it or if there is a better practice to achieve my desires...
HiseSnippet 1790.3oc6Y07aaTDEeVaOtXmRghpJbbUDGbkBVwPofTAEm37AQTmZEmlxspI6NwYj2cmkYGmDCh68Fhi8VOwe.bCt.+IfD23.Ggq8DWKuY1c8tq85zDmjBph8Pjm2LuY9MuO9My7RGA2hFDvEHiJ6LzmhLtJt6PO4AsNfv7PatJx3Z31j.IUXFJZkg9jf.pMxvn3FJAFUJgzeOaoUHNDOKZhHDZWNyhdOlKSlHsSyOm43rNwltCyM0nucyMs3ds3N7A.dJhWD4Sr5S5Q2hnFVALxn7Z1LIWzURjz.jQoU31C6d.+HuvwuKKfsmCU0nApKLQghWm6XqPr52nVGvbr6DuuCPHCbmDqPwPqvMvsY1rQxSrFuotCyDMRaOLJjEdEy.uFSCd4.IiTPpTHjtNtqkf4KS5Qgm4va5ANm8IfYOMTBGKpvmT.2hCivSV2kzmtt.ZLRiZ2YwEWvD9ysta0pfoOPZdHQX1y07SMWyqGyiVuGUtgCeOhy17ARlWu1DOvgHpAZjnfEA1UfN8bUiukpUs40B6MX37Ymbed.Sx3dvv0AZJMVa+8oVxZyG227Yl8tD4.AALqMxSmjd0KDyyAfs49C7rzqBDOovA3.85QqcHwY.8VU+5pURTqd.UtrTJX6MPRqs3Bgi4tU+F.0JUqKn8XpDfVDGm8f.xZYlyEL2m3D.JjZI2hKo22qldgh2SiuLMpundQLGWu82+jUbwbT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hGwSnZ5b5omhGcNXlT6HtJz3v+J3t9TXWewedQhpO8uc9yl+TyYG7YN1Yhsvb3UYhn44hOSbF8A4bQfTbKSrGfWCnNFqCO3xeKjEymosPHkDZENuuKQea5y8KeuVXmyg6BWfTW1D80euots4CIGRM2fBWsTWDjSnrd+5osrd9m5x5ceKIr76HHdAviyxZnotrc3dp8XhvGDPWWP+xsUbbok2hSD410yVZcXSlqNQE9A7HwOuHk6q3L8F0rUQH03y4Aqktrp03K0RQb9qbxESoQqDiwtL0S.Vy6PpCjjnw3aAYE6S.hgXoYCxay83wO7LIBXapL5Pmzmuk2FZYojX0OQxMZtM0gRRGM+tMuGDERDs0Wk3x1VbR9q2AGBWSUlo4qFU7p3+WwqqLhhOtZ1nv6KlTc6rE8ZD2WrI62+9+XoGRkYnB+k2f9WK0QPydL.XD3AxwkMNi4ken7aiS1E+GHR9kQw1dUYMbIVB9ihdVtxm+ZZIfs0S+O3qBtspsYCzggWrBqJuGxEND7QVVpLr2C7A4qy6OC57AyfN2dFz4CmActyLnyGMC57wmnNp6eD8.NUNFHnyZg0IyXMOcUTUoan+A7H+YDK
-
@audiolyf it depends on whether you assign the callback as synchronous or asynchronous. If it's asynchronous, it will assume that it's for the UI and not execute it if no interface is shown (otherwise Cubase will freeze with multiple instances lol).
HiseSnippet 1790.3oc2YEzaaaCEVJ1JoIoancnnXGIJ1A2gTW61ttATLTm3D2Zr5DiXmztSYLRz1DQhTihJIdC65vNsct25ugca25OfcXG10AreB8eP2ijx1RIttNtsAsSAHQju2i7iO9de7QklBtKIJhKrrWrc+Phk8EcZ0mI6UsGlxrputk8G6z.GIIBjoq05GhihHdV114dfpC6Eyaoedw8WC6iYtjQcYYsKm5RdDMfJG0ayJeC02uF1izlFjR66TotKmUk6yiA7jyojUH18.bWxlXkZy4XYO+FdTIWzRhkjHPm03d8a0ieDyn+tzH599DUixVsfAxzsU0dTeulCVqQVV1NMGsxyYV4WwoA0iNr+QdfKoEfFYQZef8bSBRkOCPxNEjx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bfCpL3ICbuRJ3NTiyK.NWJ.Nui.RHxBtkAvIHE0BNCXJeZLYMh4pMV.EMDkPkyHtl.EMJp6opetqtXJS0QVMwvDSfiPUxVvw.e0LAosGO3Lg0oQgP17Zw.qjgyHSOJ+.yib7f.6MfbSO3bGs4CB1GNQJ6yMrE3SZPYIdMM65yd5S+i62.eb59rrp7aUZIIgJ5iz505.xQFuY5yOL6JMIBJ2SWSepwJ9u+ym8qUrl..zOmB.vvdB.ned0.XYmGw4g.SjPZcpg+bX9mGN1URrN0nXkJd7DACYhKupivvAVLiNupPzEm+2eH6km4TmTwnIHERhSJcerg0YCjrS4GW3ciebPRwoFlUik7.vEqqQHCrx1XMN+f.rlc+MtNqO1HbYmV.Yl91KZl2qpaidL9P3tKDflSUdS4Ib43+ZZubb3Te43sbkvz2VfYQgvMJx3bIAz1blZMNpychfqBR99sUauo6uJGKFqnWb+Zvhbr1zBKiE53jAm1kpPsbYqIH+zUSP1ZVSo+XJgJ+6paume5pp60Tl+6+0omoHzEGfQyEI2fcHwGRRzX7SfrhN3Xe4fdyFj2.tO9f5fFEArMAJhqaWR1T6wsff6pB2hbTOWox1DeBNcz7mU4QPTHVzPyhNS9hy9GdYr6WepiAtHUlI5MYe6bMLah20J2TcWq253c1u20TxlLBJu1s7KL7CeN76nj7gOS+wodUb6e2t+7ce95Dn1rzNvGS8TGoOniusRV1++8eVammWGxnDR3lDXwIc+4daEZmepiQTKoObhoUzRfK+CI.qCI9vAvWxoI98g.hyiuKv+Wli.rqfumq4S1nR+uftGv2xz+GTVzogpMpr0glZqcTezAq.n9n8bcUju2.1CFuM2ZFr41yfM2YFr4KlAat6LXyWNC17USzFUooIWqQkiAczbCys3s2fotRlNcy5+.HoTW1M
const var rm = Engine.getGlobalRoutingManager(); const var c = rm.getCable("my_cable"); const var SimpleGain1 = Synth.getEffect("Simple Gain1"); // This will be executed synchronously on the audio thread inline function onSync(value) { SimpleGain1.setAttribute(0, Engine.getDecibelsForGainFactor(value)); // GAIN }; // This will be executed on the UI Thread, so if you close the UI, the panning will stop modulating inline function onAsync(value) { SimpleGain1.setAttribute(3, value * 200 - 100); // PAN } // Protip: use the inbuilt constants for defining the notification type c.registerCallback(onSync, SyncNotification); c.registerCallback(onAsync, AsyncNotification);
-
@Christoph-Hart Thanks for the explanation! Why doesn't it ever update when it's set to synchronous though?
-
@audiolyf are you using the master branch? I think I've fixed that on develop a few months ago.
-
@Christoph-Hart Ah that's probably it then! Develop but a March build
-
@Christoph-Hart Worked with the latest develop branch! Thank you so much for the input. It sounds like the update rate is waaay higher? Typically a good thing I guess, but I'm experimenting with sample start modulation and getting a very different sound from the asynchronous one (pretty cool but not what I'm after).
Is there a way to limit it somehow so it doesn't update quite as frequently? Tried throwing the global cable in a fix256 block as a wild guess but that didn't do anything. -
@audiolyf the update rate is determined by the block size of the common container between source and target and yes you can control that using a fixblock container (but you need to put both the global cable node and the mod source in the fixblock container). If you enable CPU profiling (the percentage icon in the scriptnode workspace), you will also see a number that shows the sample update rate for each cable.
-
@Christoph-Hart You're a legend man, thanks. Having a lot of fun with this. Have a great weekend!
-
@Christoph-Hart this is interesting, I was following the docs and using a timer to get the cable value and update any elements of my project - works fine but this seems a more efficient and accurate method. How can I get .setRangeWithSkew into these callbacks for use with Frequency etc?
I've tried
Knob1.setValue(value.setRangeWithSkew(20, 20000, 1000); Console.print(value);
No errors but no activity either!
-
Am I being super dumb about this?!
-
Ok a bit more context, snippet below and callback too. I just want to convert the cable value into Frequency (or anything else but using the setRangeWithSkew function).
inline function onSync(value) { FREQ.setValue(value.setRangeWithSkew(20, 20000, 1000)); SimpleGain1.setAttribute(0, Engine.getDecibelsForGainFactor(value)); // GAIN };
HiseSnippet 2059.3oc2Y8zabbaEmiVMxQRoBIAFAo2XT6gUEJJZcbSBfQgW8u0dQsjWqUVN8jA0Lb0xnYImxgij1TTfdLHGRNFja4yPu0a9CPOTfVfdoeHx2fz2iblclQZkxFYGgnHAHs7w2i7Ge78Wtczp.dRhRS7lcugwbh2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ughoG6Te28aAGxwJSWlIUasSxyEVpifZujMF03Gp6fWoOW50Z4ou7cn+p40cmMGit2SaK4w7Hvuvhw2BbD5wRiL4TqZWusRpxKLp3ReWNTU2gGxq5MOtCzZFCK3nBJ2t4t7HNqrA7us4i.COltZqo+nzEM9Q+R2i895c7cvkhNizeY7xJ0to8xJuZL4esQeSSidB4rNFK+M.bggvWZ369hM4PwXkUZOSDh4vyI7mZVMHO8u8t+lWzF7hzlNXuzmUkW659oSto8JDXnHPkeSBvVShaN.9M76v94fAw0wiC7Kk8X.KPqddf6caP2+WyRAzsR6WY8r9aiioMx+pU7wWd.+9EDOOH.C39dvcv3k4NWAY9fqfL28JHyu+JHyGdEj4itBx7wWpLX4nYcuf9X.gNa4Za2aKI14k0ci7+AZE2.dC
Someone throw me a bone!
-
@Christoph-Hart still trying with this... How can I convert a GlobalCable's value to something else (frequency for example) whilst using the Cable's callbacks? Or is it not possible?
HiseSnippet 2057.3oc2Y8zabbaEmiVMxQRoBNAFAI2HDJJVWnHq0wMI.AAd0+V6EwRdsVY4zdwfZFtZIzrjS3vQRaBZgOlCEIGKxs7Yn2ZQOjO.8PAZ+XzBjy8R56QNyNyHsRUYisgbVCXs7w2i7Ge78Wtczp.dRhRS7lc2gwbh2q62cnzze89LgjzdCh2B9awRLbM0QZsgwrjDdHwyq18PBdyNMw946u6ZrHlLfWPhP1SIB3OPLPXJn1o4mHhhZwB46JFTh66zrcfRttJRkB3ol+JjXVvgrC3ayP1lxm3MylgBiR20vL7Dh2zqoBG1su5Xoi+8DIh8i33fFjtvB4H2REEhHFoRVuuHJrS94NgP776TnEp4zB2veKQnXD8Bsw0sSPKjnr9vappvqVE30nL7VoD7FCj7JAoocP5M76FnEwlhYP7LueaIb4ziAp8xPwwKYp+VM+0U.GRyxCXGxaogAijn96uxJKQg+6lezbyAp9DC8HllpGP+X5lxCDR9xGvM2KRsOKZGUpQHOXKlDtPz0AIJDH.3WO.4ccFb9pu3fgOM.+1hUW3thAwQbzpoAHg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
-
Yeah, you need to ignore the function argument and call
Cable.getValue()
to obtain the scaled value:inline function changeFreq(value) { // FREQ.setValue(value); // won't work FREQ.setValue(freqCable.getValue()); } const var freqCable = rm.getCable("my_cable"); freqCable.setRangeWithSkew(20, 20000.0, 1500.0); freqCable.registerCallback(changeFreq, SyncNotification);
But this is counterintuitive so I'll change that so that it will call the function with the scaled value once you've called a
setRange()
function (because chances are high you'll want to use the scaled value and you can still get the normalized value withfreqCable.getValueNormalized()
. -
@Christoph-Hart aha, excellent, thank you :)
-
Alright I've changed this so that the
value
argument will be converted using the provided range, but this will obviously break projects that do not assume this (eg. your snippet will totally blow up trying to set the gain output to +20000dB lol).Given that it's a rather new function and nobody seems to have complained about the range not being used correctly until now I think it's reasonable to just introduce this breaking change.
-
@Christoph-Hart Great, would you mind updating how the function should look with .setRange() please?
-
inline function changeFreq(value) { FREQ.setValue(value); // will work // FREQ.setValue(freqCable.getValue()); // will work too }