I mix audio(16bit,16khz, little-endian, mono,frame-duration:60ms) packets after dividing the short values by participant count so it never gets clipped. but before that, I need to apply a certain gain to all incoming voices so that they stay at the same level. and even after mixing I again have to apply certain gain to mixed audio so that the voice remains smooth and at a certain volume.
Now, as the voice level changes, all the time for all participants the "Gain" is not constant and I have to calculate this dynamic/auto-gain all the time (from samples or RMS of a short array?). How can I do this or implement logic? I tried reading webRTC AGC modules but it's too complex for me to understand. Atleast suggest me any resource that can be helpful in this regard. Thanks in advance.