How to cross fade between samplers with a knob control
I have two samplers, one containing a deck of close miced stuff, and the other containing another deck with the second mic that was placed further away. I would like to make a knob control, that when on 0.00 is 100% sampler 1, and when on 1.00 is 100% sampler 2. So a Mic Distance knob if you will, that is actually a cross fader between samplers.
Could anybody give me some clues on how to do this in HISE? Great product by the way, really love it so far!
d.healey last edited by
Is there a reason you've chosen to put the two mic positions in separate samples instead of combining them in a single sampler - http://forum.hise.audio/topic/75/multimic-samples
If you combine them my general purpose mix mixer script will be a good starting point - http://forum.hise.audio/topic/312/general-purpose-microphone-mixer
If you still want to keep them separate then you just need to link a knob to the gain parameter of each sampler. Or you could add a constant modulator to the gain section of each sampler and link your knob to that. Basically there are many ways to do this.
Yup, I'd definitely recommend using multi mic samples too. But using constant modulators will not work, because mic positions get the same modulation signal.
This is an example that fades between a sine wave and a noise generator. I also added a table that you can use to specify the crossfade curve - depending on the coherence of your mic signals, it might need some adjustment to make a smooth transition:
If you want to adjust it for your setup, just put the two SimpleGain effects in the Sampler and set it's routing matrixes accordingly.
Hi, thanks all for the information. I have now used the multimic system. It works fine
Two more auestions. The code for crossfading is now this:
function onControl(number, value)
gainFx.setAttribute(0, 0 - value);
gainFx.setAttribute(0, -100 + value);
Where the knob value goes from -100 to 0. This linear gaining howver, results in them both being -50 when the knob is in the middle and is almost silent. Is there a math formule I could use to exponentially decrease or increase the gain? Sorry if this is a newbie question, I was never really good at math (but have been a software developer for almost 15 years now).
To compile a vst, I can't seem to download Visual Studio Community 2015 (Needed to log in using my microsoft account to download the older 2015, but when I get to the download page for the legacy products, no items are shown). I am able to download the 2017 Community edition. Will it work with that version?
Again, awesome work. Really love HISE!
The problem is that you are using the decibel scale in a linear fashion and -50dB is basically silence. Instead, you need to use the gain factor, which is a value from 0 to 1 (1 is unity gain, and 0.5 is -6dB). The example I posted above uses this scale (there are functions in HISE to convert from decibel values to gain factor and vice versa).
But even with the gain factor, a crossfade without volume changes is only possible for coherent signals, which are practically non-existent - even the same recording with other mic positions has different phases. For all other signal types, you'll need to apply an equal power crossfade - that is why I added the table so you can adjust the curve to the shapes known from your DAW crossfades
Take a look again at the example code, it's all in there. Obviously you need a slider with a range from 0 to 1 instead of -100 to 0 (the mode
NormalisedPercentagewill do that for you).
local gainValue2 = CrossfadeTable.getTableValue((1.0 - value) * 127); local gainValue1 = CrossfadeTable.getTableValue(value * 127.0); local dbValue2 = Engine.getDecibelsForGainFactor(gainValue2); local dbValue1 = Engine.getDecibelsForGainFactor(gainValue1); CloseMicGain.setAttribute(CloseMicGain.Gain, dbValue1); FarMicGain.setAttribute(FarMicGain.Gain, dbValue2);
Thank you for your help. I'm currently busy with a commercial project, but will return to the project soon.