How to use KeySwitch to trigger sampling?
-
@ulrik said in How to use KeySwitch to trigger sampling?:
if I understand you right, you want to fade between several sound sources.
Make the Gain knob smooth the gain?
hey guys, i want to make the value of this knob smoothly gain from -100 to 0 (-100, -99, -98...-2,-1,0) instead of going directly from -100 to 0, how should ...
Forum (forum.hise.audio)
-
@ulrik Thanks for the help. I implemented this function using a timer loop, but I think the CPU pressure will be very high.
-
@CatABC I fiddled some more, this is a better solution, using eventData envelopes, it's easier to set the smoothing in the fades
And I don't think it will consume much cpu, it's only the extra voices
HiseSnippet 2368.3oc6a0uaajaDeW6r4hT9n45kC28mDF8Oj6YnSe4OTSSshskuXj3OpkSRKBRSo2kRhvqHWrjxItAAsnuH8UIOB8QnOB4MncH4tRbkj84X3fbNUBAQZGx4CNyvY9MRI6Ey8IBAO1wM+AmDQbbukWqSXxtq2ESYNasgi6238XxIhWSk9cQswADAphyZmDgEBRfiq6r+jZit4tli90GVcMbHl4SFRxw4YbpO4IzdT4Pp603wzvvMAAd.sm0tq0XKeNacdHuOXTy5UxIB6eDtCYGrZay347Hrnqi6u0awJU8qErbPkJKVeIe7Rj5swsaWtZPsZKsR8xUqiqsxRjRK53d8lATIOtkDKIBG2qsFO3jVc4ulYTvynB5ggD0CkcZAZ1PdSdXf5Hpn5rdWZXvdodKgiiq2dC8cyZ7c2yaaZ.c.8g9v6pW.MjCaGn6LYMuYyXdksMuRVl2DLIWKS5ZFS5q8Z4GSijCWQYO2zaKljD2FCwIaSwrWG226sNG1.SVrG9HxlwvCCXnvRkJs.pRoRye+18Y9RJmg3rc3RxtrBym+s4yk+c4QitT61SbMkZh4ggj3ItrJ0H9rXr.qeuCIwKfNFG1mLXivwOqO06z8o1gbeyo1Zib1VLpb2HB6zRDbRbUJ+ehUAaUp892Iw62JjFPhcnfSNu2fbdsMOHyuweugyS2ZCrDmJIPnfhhHwRp5L3tA4X3djItlyaCh3HIOBz057dQblxDbyaz6sSz6SvGRB0p8N1TJ67F6qmmX+vqoAxtCH79+YitD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ipd0EXDTO47ALJkTlcMAfQeX0I.LBvwLEXzTfQeB.FUcJvnqt.ip94BXDr4o.ilBLZJvnOVfQeonidX+X9q7M+T4pht2PSA7sL8+0Ix4ss5YT4Q9swU+JxPK6W46mUTiwXkKJiUunLV6hx3hWTFW5hx3xWTFW4mmQEhpG1Wx6Yt+AHK2qo9eKCttFPk5qhN+O.G6L2qA
-
@ulrik Ah~~~, the result of this solution is pleasantly surprised. The Xfade of this solution is smoother than I thought. I combined the code of my first snippet, and this is exactly what I want to achieve. If I have a chance, I will treat you to a seafood feast!
-
@ulrik I found a bug during testing. For example, if the last KS is on E2 after the note is played, the next note head will have the sound of E2.
-
@CatABC I guess that's how the eventData Envelopes work, if you trigger a key switch the fade will not be applied until you play next key
It seems to work flawlessly when playing legato but as soon as you release a playing key, and the fade has not worked its way through, it will continue the fade as soon as you start playing a key again.
It would be nice if the smoothing time will elapse even if no playing key is pressed -
@CatABC @ulrik I played with the snippet. If you're not against scriptFX I think this is still a smooth way to avoid complex scripting and all you need to do is fading volume from one sample to another. I also suggested adding a ramp node with some smoothing in between the gain cables to give it the x-fade vibes.
https://forum.hise.audio/post/106218
change the xFader node to Switch.
Benefits, you can add more sources easily. Pictured are fileplayers but you can easily put a oscillator there if you need. -
@Chazrox I'm not against scriptFX, but I don't know how to get started. It's a bit difficult for me. If possible, can you give me a small example?
-
@Chazrox Can this fade between sources 1 and 3? Or do the fades only work in the order of 1 fade into 2 and then 2 fade into 3?
-
@dannytaurus This set up (above) actually works in succession (didnt think about that case) but you could easily take the fader out and just smooth/ramp a gain knob for each sound source. It would be a 3-Channel Mixer with a smoothing node in between gain changes pretty much.
Somthing like this...
This with your KS code you have going already I imagine this would work. Send 0-1 value to the 3 sounrd source knobs like a radio group. The Linear ramp node with fade the gain change. One smoothing parameter knob to control them all. If you need more individual gain control per sound source, just drop another gain node at the end of each chain.
I only suggest this way because I imagine its less stress dealing with fade times and eventIds. I think this would work.
Just suggestions from my perspective.
Bless!