Auto Gain?
-
Hey there i wanted to start a discussion about the most intuitive ways to achieve a somewhat precise gain staging in HISE while testing DSP.
Especially in Scriptnode since this is where all my Effect routings come from.
How do you guys handle this? As a request i think loudness metering and in/out comparrison of the signal would be great.
If there is a dynamic setup on how to tackle auto gain, eg. comparing in and output and adjusting to that via dynamic modules :)
-
-
@d-healey what scriptnode module should i use for reading the correct "peak" while playing audio?the file analyzer only works with samples.
HiseSnippet 1495.3oc0X8zaaTDEeVmLND2Vfp1BWmKHbjJF6RnTARTm3jzZAN0pNDUNElr6X6Qd2YV1c1jXPbhK8Fm6M9HvUt0u.bpeQ3a.7d6t16t0tINVsEgsj0Nu4My768989yrtaf1VDFpCHVqevXeAw5pzdiUlgsFxkJR6cHVuKsCOzHBXIh1drOOLT3PrrV4An.q0WkD+4uu+1bWtxVjIhPNTKsEeqzSZxj1s42Hcc2i6HNP5kS6Ma11VqZoc0Q.dVgVm3ysGwGH1mipUhRrJuqiznC5Y3FQHny1Zmw8FpOUkn+gxP4wtBbPCROXiRDSZMT55zchsFRHVq1MyxWIwxuIsizQNUdlG38imfksh79.qRmGjZbIfjUNHsZBjtNsmcfz2jMChmqPaq.BoOGb04gRhtDqmSaoAETlZd7Qh8BfASWP06Vu9sYvOa7U8iT1FoVwzp80FwiTU2nxOWY8J+RE1KOU+9ycN7XBztthf4NMxtAm2Bqph7NVDba1Ib2HwTEAyunOs7h4SsSr5bJpUsURyi7Eoi2S65f9J74YY.RpaCd56ZuC2vQRIUFnmuHvHQ3Xsi3DHpNghVmtiHbjQ6Cw0yvePji1IxkaJFNg4MoS.9iBbHRTpPoYb97pKQLV8yMFaQg30ockF6gyGiklCFAO0aBLllYdM5t86KrMY.bU5dOYYSCqu3ogzjyuRZZHbl3ge0zgr8dRiBfX+Hushbj58jtHFnVVf4LIq7ozrL.+.gOOPbftqKeb0Ptmuq3w.vuM6XWs8ndxeRLaZieBt1F0np8PtRIbCWlrqxulpXQdrNxHUC5vMAxy.6Er+dPsaaQqTzg9f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nP8y2dX5OzApouJRS2n+646KiOrvkwYDh8h4Gl8HBUAiqnk.1MS+otm2okZLpl0wid0nPn0ygddk2pyrvUm1E94S6BuyztvuXZW3cm1E9kS6Bu2EuP0MCxtKuJOAttT6sR+ZC1o2TRmxX8OHpDS2O
try changing the volume of the Waveform Generator and see it in action.
-
@oskarsh nice ty!!
-
-
@Straticah it normalizes the amplitude to 0dB. It seems like its very loud because most synths by default in HISE have a -12dB applied to them. You could just add a Gain Node after and set it to negative of the current dB value to match the target loudness. Also keep in mind that changing the gain rapidly like we do here can cause audio imperfections. Try turning up the smoothing of the gain or add a smoothed parameter. This really just shows the core concept of a auto gain.
For the patch to blow out your speakers, do you run a custom EQ setting on your pc to correct your room acoustics? This can create peaks over 0dB especially in the sub area.
-
@oskarsh yeah auto gain might be harder to achieve than i thought, it messes up the dynamics really, especially on audio effects. Its not that audible on synth but it definitely is on a delay, granular, etc...
would be great in general to have great metering tools and non linear gain adjustment tools that are somewhat "smart" in scriptnode.Will look into auto gain in the future, definitely never had problems to gain stage my distortions.
Its just with more complex setups...and yes i do use a custom EQ setting this might be the reason :)
-
@Straticah
The autogain snippet above can only be used for simple synth waveforms.But it cannot be used for general audio processing at all. Let's take a drum loop, there are peaks and valleys in a drum loop, but if you try to fit each sample (44100 samples per second) to 0dB, the loop will no longer be the same loop
If you are going to use it with saturation, you can use Snex node.
-
@Straticah yeah @orange is right. The problem of auto gain as been discussed quite a bit if I reckon.
The problem is that it can't be automatically compensated from an audio source (sample or signal input), or an effect that would modify the frequency content. Any attempt to do so would result in a pumping effect at some point, because in the end it will be nothing but some sort of compressor, involving short or long integration time depending on the design.My 2 cents for a transparent auto-gain would be:
Sampler case -> find the max peak or RMS level of your sample and compensate for it with a (non dynamic) gain
FX case -> learn how your controls modify the general feeling of the level, weight this for the different controls, and apply a (permanent) gain compensationStill, these solutions are not perfect. Imagine an equalizer that changes a frequency that is not in the original signal, the gain compensation would apply while nothing really changed.
And with a sample, the apparent loudness is very frequency dependent so a lower RMS level might sound louder in the first place, so a positive gain compensation might do the opposite…
Arffff… that's a hard problem to solve in the end…
-
Yeah I went through this with Sordina and the link I posted in my first response should lead to some discussion. I still don't quite understand why it's not possible to have the software look at the incoming volume and make sure the output volume matches it, just like a human could do, but apparently it's very difficult :)
-
@d-healey yeah you're right, the problem is the integration time, necessarily leading to a level changing over time and nobody wants that.
Something that is doable though, is a kind of learn mode, where the signal would be analysed on a short period of time in order to find the best gain compensation match, and don't touch it any more.
Again, any attempt to perform a compensation continuously is (to me) nothing but a compression/expansion, and the only way to overcome this is a one-time setting. That's what human do. -
@ustk @orange @d-healey @oskarsh good points, may i ask how you go about gain staging in HISE? i beleive the best way to achieve proper autogain is to monitor each sections in and out peak change and compensate for that with a non linear gain.
i dont see any metering or loudness tools in scriptnode that would be needed to proper gainstage in an intuitive way, what is your workflow when it comes to that?
-
@Straticah I think you more or less have hit upon the best solution, and this sort of issue isn't at all unique to HISE. Understanding the gain added/reduced by any one particular effect, sampler, or synth in isolation and compensating it with a nonlinear gain node is probably the solution, outside of compression which as @ustk hinted at, can squash the sound or introduce unwanted artefacts.
Personally when working on FX I'll introduce a gain node in my scriptFx chain which does precisely this. I do agree that it would be nice to have a meter node which could help us analyse the gain output at any point in the chain, but at the end of the day you have to trust your ears!