[Home]

Summary:ASTERISK-13538: [patch] Automatic gain normalization in meetme
Reporter:Chetan Vaity (chetanv)Labels:
Date Opened:2009-02-08 11:12:26.000-0600Date Closed:2011-06-07 14:03:17
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Applications/NewFeature
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) AGN-patch.txt
( 1) v1-14433.patch
Description:Often during an audio conference, one of the participants has set a high mic volume. Whenever he speaks, the other listeners hear his relatively high volume. Similarly, someone has a low voice or has set a low mic volume. Other participants have to strain to hear him.

This patch tries to overcome this problem by estimating the volume of the participants and adjusting their gain. This adjustment is done every 2 seconds in the meetme app.

The patch adds a "g" flag to the meetme app. This option is tied up with the "T" flag - talker detection. Both have to be on for this to work.

Changes are in apps/app_meetme.c, include/asterisk/dsp.h, main/dsp.c


****** ADDITIONAL INFORMATION ******

Description of the changes:

In meetme, if the user is talking, his frame is used for gain related calculations (ast_dsp_gain()) and his volume is adjusted using the current value of the gain multiplication factor.
The current gain multiplication factor is based on the past 100 frames of that user (past 2 seconds).

Three new fields have been added to ast_dsp structure:
 * gain_mult_factor: The gain multiplication factor
 * gain_buckets[]: The buckets array used in estimating the value of the gain multiplication factor
 * numgainframes: Number of gain frames which have been processed

For every frame, the RMS gain (actually - square of RMS)  is calculated and bucketed into 10 buckets (histogram). After 100 frames are bucketed this way, the histogram is used to estimate the gain multiplication factor. Starting from the right side of the histogram, the bucket with at-least 4 frames is picked and the corresponding gain multiplication factor is chosen. (There is a on-to-one mapping between the buckets of the histogram and the gain multiplication factor - GMF_VALUES[])
Comments:By: Leif Madsen (lmadsen) 2009-02-26 17:45:31.000-0600

I'm going to assign this to russell for now so he can take a quick look at this. I think he recently closed an issue which switches the talker optimization back to default off, and mentioned if someone wanted to pick up the code and make it better, that'd be nice.

This looks like this may be in that direction?

By: Russell Bryant (russell) 2009-07-02 15:01:34

An initial comment i have would be to review the coding guidelines.  The formatting in this patch does not follow our formatting guidelines.

By: Leif Madsen (lmadsen) 2009-09-22 08:11:38

Is there any interest from the reporter to move this issue forward? It's been since July that russell added a comment about coding guidelines.

By: Dmitry Andrianov (dimas) 2009-09-22 10:25:32

If original author won't respond, pls ping me - I will re-format the patch...

By: Leif Madsen (lmadsen) 2009-09-22 14:45:49

dimas: I'd suggest you just go ahead as I don't think we're going to see much from the OP. Thanks!

By: Dmitry Andrianov (dimas) 2009-09-25 03:28:53

I'm not sure what is target version for this feature but since patch did not apply cleanly to 1.6.0, I used 1.6.1. I applied the patch, fixed formatting issues and made new patch which is attached.

By: Leif Madsen (lmadsen) 2011-05-06 15:05:53

Actually we have the AGC() function now, so this is no longer necessary.