Nafiul Alam Fuji
Nafiul Alam Fuji

Reputation: 434

How to Auto Gain Control (AGC) while mixing audio for audio conference

I am capturing audio at 16 bit little endian,16khz and frame duration is 60ms.

Now while mixing for audio conference, I can divide every participant's sample's (audio short array) by participant count and add all (to avoid clipping). But the resulted sound is low and not smooth due to different voice level. How can I apply auto gain control here to take the audio of participant's to a target level first and then after mixing apply a calculated adaptive gain so the voice becomes smooth and does not get clipped?

Upvotes: 0

Views: 567

Answers (1)

Phil Freihofner
Phil Freihofner

Reputation: 7910

The signal will need to be converted to PCM values (e.g., signed floats ranging from -1 to 1 or signed shorts). As PCM, you can use an RMS (root mean square) algorithm of some sort to determine the power level of the signal. The PCM values can then be multiplied by a volume factor to get to the desired volumes. Then the PCM needs to be converted back to the byte stream. This is just an basic roadmap, but hopefully can set you in the general direction. IDK if there are libraries available to handle this. The question has come up multiple times, so it seems that there might be.

Upvotes: 0

Related Questions