Hi everyone,
I’m doing a sampler here playing a fixed wave file according to track signal and now i’m getting to the point where i would like to link the volume of to the fixed sample to the track volume.
const float
g = apvts.getRawParameterValue("GAIN")->load(),
ratio = buffer.getRMSLevel(0, 0, buffer.getNumSamples());
sourceToBuffer(sample, info, mixBuffer, buffer, (1.0*ratio *g));
something like that works for now but i’m struggling to find the way of doing it with logarythm… if i got it well rms scale goes form 0 to 0,7 its getting confusing for me making it work it out
would anybody get a clue? thanks a lot!
It’s not clear exactly what you’re trying to achieve. Are you trying to match the volume of a sample to the audio level currently playing through the plugin, or are you just trying to scale the gain parameter according to decibels so that the perceived volume changes at a constant rate?
I’m trying to match the volume of a sample to the audio level currently playing through the plugin, it works fine now but when it gets to low volumes the sample is way earable but when high the sample gets drown.
I can’t figure out if its coz i’m not using the decibels scale or if i do something else wrong.
Thanks a lot for that i’m gonna have a try see if it works for me.
apply gain result (now also in db) from step 3 to your audio signal
this will probably need some smoothing
you also need to think about what should happen when the input volume is very low/silent since there could be huge db differences