Audio buffers audible levels/normalisation
-
quantum_jerome quantum_jerome https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=383216
- KVRer
- Topic Starter
- 2 posts since 29 Jul, 2016
First post
Hi all! I am new with plugin development and have been trying to transfer a MATLAB physical model to a prototype audio app/plugin using JUCE. I have managed to overcome some first technical issues but now my problem is the scale of the values into the audio buffer. Even in MATLAB, the first output attack samples are as small as ~1e-10 and then the sustain values reach up to ~1e-05 but there, it is easy to normalise the whole output vector after the total processing (or even just listen to the output with the soundsc command without normalising). With JUCE the only possible "solution" I have thought of is scaling every sample by an arbitrary constant factor but this does not produce any audible results either. Has anyone else faced any similar problems or maybe has something to suggest?
Hi all! I am new with plugin development and have been trying to transfer a MATLAB physical model to a prototype audio app/plugin using JUCE. I have managed to overcome some first technical issues but now my problem is the scale of the values into the audio buffer. Even in MATLAB, the first output attack samples are as small as ~1e-10 and then the sustain values reach up to ~1e-05 but there, it is easy to normalise the whole output vector after the total processing (or even just listen to the output with the soundsc command without normalising). With JUCE the only possible "solution" I have thought of is scaling every sample by an arbitrary constant factor but this does not produce any audible results either. Has anyone else faced any similar problems or maybe has something to suggest?
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
You can add a gain stage, but there is no way to "normalize" the output fro,m a plugin. If your effect only gives out small values, then you have to do something about it in a sensible way. In the output range constant? Does it vary linearly with the input? ...?
-
- KVRer
- 21 posts since 6 Jul, 2016
The easiest way to deal with this is to use the MATLAB code, and generate a lot of output using a variety of different model excitations, take the output signal and do something like:
Given that your input sufficiently covers the range of operation of your model, this will give you a factor with which you can normalise by consistently (i.e. a gain factor for the output) without clipping.
Code: Select all
newMaximum = 0.99;
normaliseFactor = newMaximum/max(abs(outputSignal))
-
quantum_jerome quantum_jerome https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=383216
- KVRer
- Topic Starter
- 2 posts since 29 Jul, 2016
Not really, because it is a physical model and it only an initial burst of energy as an input..Miles1981 wrote:You can add a gain stage, but there is no way to "normalize" the output fro,m a plugin. If your effect only gives out small values, then you have to do something about it in a sensible way. In the output range constant? Does it vary linearly with the input? ...?
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
Still, you know the range of the input, so you can do something about the make up gain, or you can let the user decide.