How to Modulate Gain with a Table in ScriptNode?
-
Does anyone know how I would…
- When a note-on occurs, the Gain Node is modulated by the Table.
- The user can set the duration it takes to go from the beginning to end of the table.
This is how far I've gotten…
-
-
HiseSnippet 1317.3ocuX0rbhaDDdDFgiwNaksxt24n2JtnfXu+3JGVa9KgxKXJKVW6dxYrz.LERynHMXa1T4dtky6s7Hjq4leGxKRdCR5YFAHYgYMT1VtJP8OSquomt+ZY5DvsIgg7.jwFcG6SPFaYZMlIFTc.lxPMqgLdhYKbnfDTPqpxXebXHwAYXr1OJUXrQVj55eeaErKlYSloBgNkSsIui5QEyz14finttMvNjtTuXdu2AMs4rpbW9H.OqYVB4isGh6SZiktkwDYjqtCUvCrDXAID7oB2Yr0.9kLs+mRCom6RjBkQVPfzpQUGPcc5LYuFhPFY6Lamuldm+LyVTG5T8yx.eixPgYqHdNvHyhfT4k.RFwfTVMjdpokc.0WLyhDOaZ1jAGH8vPpNNTz9hLt1rJGbfIJ5gGRZD.BSWv1upTocJ.e7hen2HlsfxYE3r1bA4X11uH+ulei7+V9B2zTudy0l7wDvccIAy0r7zMXQKba1HuyIA6T3Br6HxTGgsexbZt6VN0Vuqi4Hm0jQEG6Shjavccj4J48oOAPQoM3t22rFVfkGJQ5.+7IABpDNF0HW.U05inMLqQBGJ39PccpyOnxg6LxEKRVNI6ahL.4iDmgxCJVHULNde0RTiUZg0X2UH9TyNTg8f4iwLyAiPl5g.iQclesY8d8H1hY.LqYiOrpsgkV51v7QsgvyT9v2JRrPiOTdtMf+t4rhc+.hONfzk2wEOd6PrmuK4D.i6T3bWt8PK5mHo6P70PnhzissGfYLha3pzHk6dhbBcBejfx52BKBnWgLLaOxyBnosIUiPGnyHirGRKWRJKqKrHLGkv+AWQFKKkMhLVdhwXsesIhK4ACUGGQ2iLVWm6CUI4y5cUYzgtt7Kqx87oQUovYfRWGt6X+AbF0VpR6wDjdnGeD7Phf6OgC6hotxxZqQg.QgywLKvY0XLi0NkDDpB75lkJB+Ak4s4NfIyFXaHwNtCVLP1uH4dfhSRPQ6oEoIvZ75DYHlLlSmk.H5I25pgbqEirQWOJkftsL5n1L7ToUarK5T44sD7HYLktOAe5AEdvfKMfRf2mGCuyb4wBhFwfXdSOtybP3yhivId7XAvrw.XNUNLI3dhBbPemJ4c+AqbRtXxD.kClSHHHzLV3t3f9DQXzXIFwVWzqNxa5HWQ.vuf5fguHv.esNcTlpT1MmX+oVSh82lv9KfTTYXI1bYiu4lGrktCzeWMY1ZMZnOvJVYDvtq4dSnQlUXNjqlPPTG33bf42pkOgzH99BRuSjfMVKJKJSplR8me9y+8aaguJtND5f+3.KAwWRCG2OqgjK0oj3yg0kNcHATti5UWSEKzB.f5JE.fvdC.nttc.ro463befQOPfREp3O+0eXd9QETohxgiDbOvhyzVonJr0MEX4PlDkXaYB9Nnn1xp1.cy5otxnEN8tEW+T2bu2TL40EGeja6i1eW+2+KutpR9xO8w962Qb9d6pkgO58cRW2WKun9JeBd3b6qTFtO6qtU5f9RVyTzAftG5NwEHjHG0OEweTNp+Rx2mIQN5VIElSOwGuNcOAT+eWHEtt+e87ClzS.3MUTR1SrzbC2Uxoe9aq8OQbCVdbtX.7lZ2DL68k3ltOxCaYdBIjHzQIUrRVGTgyG5gUuj2p8ua8X7JodX6.9YQS6kESekRCTTwT+lDaX1RJWnL5hatakuZvY11ICUpE98q5B2cUW3dq5Be4ptvWspK70q5BeyWdgxeRmn1SIqIz80otlNynNSN8Pw5f9efqsiyv
-
@Christoph-Hart Thanks so much, mate!!!!
-
-
@Christoph-Hart @aaronventure Thanks again for this, especially while you're away. I can't seem to get it working, though. (It's in my sampler's module tree.)
Clipping
The signal is heavily-clipped.
Duration
I can't seem to match the duration of the envelope to the duration of the sample? (Or, perhaps they are matched, and it's too fast to animate.) I'm guessing the the ramp simply fire the table envelope, and that its timing is irrelevant?
If I get it working, I'll package it up as nicely-commented HISE snippet. A custom-envelope dynamic processor seems cool.
-
@clevername27
I tried the snippet here and I get no clipping. But I can see in your screenshot that your table is nearly flat at 50%, so naturally the modulation signal can go over that value.BTW, it's better to put modulators and modulation processors into a
container.modchain
to get a more accurate modulation signals.The duration parameter of the
core.ramp
sets the duration of the modulation, independently of the sample duration. You can increase the max value of that parameter of course.
You could also fetch the sample length value and set the duration accordingly :HiseSnippet 2603.3oc0Y0saabbEdWIs1VLpAIstn8lBLfn.kNVllqD0e0MnThRJQnVVrhJNI0vPXztCIGnk6rX2gRhMvn8xbceRJPeAx6PeE5c8l9FjdNyr+Rtx5mH6zJCXqyLm4b9lyb9ccmPgCKJRDZXV4nwALCyEr5N1WNn8.J22XusML+oVcoCC7Xgjc7Oi4I.l1Zb.MJh4ZXZN6mg7YN+bFpe9O+9sndTeGV1RFFuTvcXOmOjKyVsSq+.2yaWpK6H9vbb2r0dNB+1BOwH.SyZ0vHf5bJsO6ETjsYrL9bZz.CyOwx0tocu0cnqttcykbbVZ80VZi0bXzd8XqZuxZMWuWydTmFKYXducb4RQXWIUxhLLmaKg63tCDm6qUvK4Q7S7XHgsQWPy5k2U34hWQbUi1C3dtcRLVQFFlVcxLcypMcOzZetKOc8LS3Go1fjch7FPyYJBuYK.O67vqQN3UBjLyAo4zP5is55DxCjY6f34Cr1yWxBAySw2RMuFy7usrZK.N7k0GROksaHPjdhZq1nwhD3udzypTAdqhjj1hgmH1RbgM4SIIGrOSBKGH7AhZUS4nJbJ8g1eyNcA9ictP90+59zfmyij0xDeLKnzU9lY7FVqZxlYBVeK18qJv+NfagC.D8lDXW7.U39dbeFo2HeGIW3S1EbJSgQz9L+Q0dTkuox7o3udDCjBWxFFUcQRUTHyWY9dhvZbPcMdFgS9cpqVcOlee4.XgG+3GUYdPF4DB00cOPD0PFeE+0nPdSk2ToLsWBHw3iXIgV6PgWMmDS8hjyndiXJPmXZp6IntoxUqTEWOwFU8adVkBWuXY1l54cBD6UaZ0gfpxSeJ4KYDeFykHEjQQLBkbRHnIGZD3pfK1iIcFPjCXjHk1IZahFhKRNg4Pwyw6QNmQbE.m7HB2WchgvsmzdqE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zRKsVi0Vq45MsWtwFogq.LmHzrPzagb.2+xyA7.Lq0MDVHCK2vtwx.Carw5M2XsF1wIo5NTHj3+4FY0mVpwTYohWz38ukaAqCYQrXbTP3kmG8x7tA+wbXGkLLjQ1md23tu5SJ+e+e4eMmwe6ezprj0kWrIeFhaVeAEJ2cqBH2RHNcHU0K9s5igecG+7Ci+PjDcIx+2dV4ErTe5LB9kN+wBpuOlHKYzS7IO920Uemk4iUnUeIcOFLdR9OKPDT0AgDjp88BJGRcBEGG26Nh0GnVAPoupnv7V6izjo++2w.6l+XGmhhZpCtzs8fKeaOXya6AW41dvUusGbsa6AW+pOH9IYiKRh45f9U6ri1AzbmTGvYM9urhleDB
(The code in this snippet assumes all samples in your samplemaps have the same length)
-
@Matt_SF Thank you for your reply, and for taking the time to code a Network. So far, I've been to get this to work. Follow-up suestions, if I may:
Module Tree Implementation
Could this be implemented in the
Module Tree
by assigning aTable Envelope
to modulate the amplitude of aSimpleGain
(and sett the attack potion to0
)?Modchain Node
I'm a little confused about the container.modchain Node…
Why wouldn't modulation simply be made more accurate in
ScriptNode
. Why the need for a "Make this Accurate" flag?At least in my reading of the docs, it seems that this
Container Node
is only to prevent modulation signals from being audible, which appears to be a work-around for for the visual ScriptNode topology being restricted to a single, directed signal graph?This (seemingly) makes HISE's
ScriptNode
visual hierarchy confusing, as I guess the audio signal simply "pick up" further down the tree after theContainer Node
. (I'm guessing this is simply to save development time. In MAX and PD, you would simply create an independent hierarchy for the modulation path, but those projects have many developers.) -
-
@clevername27 said in How to Modulate Gain with a Table in ScriptNode?:
This (seemingly) makes HISE's ScriptNode visual hierarchy confusing, as I guess the audio signal simply "pick up" further down the tree after the Container Node.
Yeah but keeping it "inline" allows to live in the right block that is currently treated. In other words it prevents from sending a mod signal up in the chain (so back in time). This way you're kinda forced to respect the up->down left->right signal paradigm.
Keep in mind the modchain may not need the signal itself, but it still need to know where we are in the buffer to sync everything up
-
Keep in mind the modchain may not the signal itself, but it still need to know where we are in the buffer to sync everything up
Ah! That makes sense. I'm now sure where MAX/PD comes down on that, but I see the logic and application here.
I'm still confused why…
-
...there's a need to enclose modulations in a
mod.chain
block; if that block is needed for effective modulations, when why wouldn't that be internal? -
...why the
pma
block? (The documentation doesn't explain what it does.)
(I'm asking all these questions because I'm guessing at some point, other developers will have the same questions, and they can search the forum to find this message. But I'll no more questions in this thread; promise. )
-
-
@clevername27 said in How to Modulate Gain with a Table in ScriptNode?:
why wouldn't that be internal?
What do you mean by internal? The modchain separates the mod signal from audio signal. But some nodes can do both so you don’t want them to blend. For instance an oscillator. And having a dedicated container makes things tidier, at least to me…
- ...why the
pma
block?
I’d say why not?
It does what thebipolar
does but without theadd
parameter. I thinkadd
could have been added tobipolar
And get rid of thepma
but since the latter is older, it might be for breaking compatibility reasons… but yeah, we have two different controls that could’ve been one unique node… - ...why the
-
@ustk Got it - thanks!
-