Skip to main content
Participant
March 3, 2009
Question

Normalize Audio levels on record???

  • March 3, 2009
  • 2 replies
  • 1005 views
We have built an internal application that uses Flash Media Server 3 to allow people to create their own internal podcasts. The app is written in Flex and uses netstream.attachaudio to record the audio from the client to the FMS right through the browser/computer mic. The problem is that sometimes the users speaks to low/loud etc.

Are there any options for me to 'normalize' the sound levels either dynamically during the record of the stream or via a post processing after the stream is done.

any suggestions out there?
    This topic has been closed for replies.

    2 replies

    March 4, 2009

    Just in case it helps; This is not a runnable code, but code can be derived easily from the logic.
    ===================================

    // Autogain control routine:

    // This method is invoked frequently (every 50 ms) to monitor

    // Microphone activity for echo or excessive noise and takes

    // corrective action by reduce/increase Microphone gain.

    // When Microphone gain is very low, It increases the gain

    // till MaxGain limit as specified in UI settings.



    private function EnterFrameHandler(event:Event):void {

    activityLevel_pb.setProgress(active_mic.activityLevel, 100);

    activityLevel_pb.label = "%3%%";

    gain_value_box.text = active_mic.gain.toString();

    if(active_mic.gain == 0){

    // don't act smart when mic is mute.

    return;

    }

    if(bAutoGain == true){

    // Auto gain control is on; monitoring mic gain.

    if(active_mic.activityLevel > 98){

    if(active_mic.gain > 20){

    active_mic.gain = active_mic.gain - 10;

    }else{

    if(active_mic.gain > 1){

    active_mic.gain = active_mic.gain - 1;

    }else{

    // Microphone level is high even with minimum gain settings.

    myTrace("ECHO !! Too much sound detected");

    }

    }

    }else{

    if(active_mic.gain < maxGain && active_mic.activityLevel < 70){

    active_mic.gain = active_mic.gain + 1;

    }else{

    // Microphone activity is within good limits.

    // do nothing

    }

    }

    }else{

    // Autogain is off; reset mic gain to max value as

    // specified in UI.

    active_mic.gain = maxGain;

    }

    };

    ===============================================


    March 3, 2009
    It's always easier to get the level right when you're recording than to try to fix it in post. You can use the Microphone class to detect activity level then use Microphone.gain to adjust the level.

    http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/media/Microphone.html

    Hope this gets you started...
    Jody