Reduce unwanted noise

Posted by Rajeev on Stack Overflow See other posts from Stack Overflow or by Rajeev
Published on 2011-01-17T12:51:18Z Indexed on 2011/01/17 12:53 UTC
Read the original article Hit count: 248

Filed under:
|
|
|
|

In the below code sometimes when microphone is not connected some noise is generated and the system just keeps on buzzing the same sound.Whats wrong with the code below and how to reduce the unwanted noise. Should i set myMic.setLoopBack(false) in the below code

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
width="300"
height="100"
creationComplete="init()">

<mx:Script>
  <![CDATA[
     import mx.controls.Alert;
     import flash.net.NetStream;

     private var myMic:Microphone;
     private var recordingState:String = "idle";

     private function init():void {

        myMic = Microphone.getMicrophone();
        myMic.setSilenceLevel(0);
        myMic.rate = 44;
        myMic.gain = 100;
        myMic.setUseEchoSuppression(true);
        micLevel.visible = true;
        //Security.showSettings(SecurityPanel.MICROPHONE);
        myMic.setLoopBack(true);
        if (myMic != null)
        {
           myMic.setUseEchoSuppression(true);
           micLevel.setProgress(myMic.activityLevel, 100);
           addEventListener(Event.ENTER_FRAME, showMicLevel);
           //micLevel.setProgress(myMic.activityLevel, 100);
        }

     }

     private function showMicLevel(event:Event):void{
        switch (recordingState){
           case "idle" :
              micLevel.setProgress(myMic.activityLevel, 100);
              break;
        }

       }







  ]]>
  </mx:Script>

    <mx:ProgressBar x="0" y="36" mode="manual" id="micLevel" label="" labelPlacement="bottom" width="100" fontSize="10" fontWeight="normal"/>


  </mx:Application>

© Stack Overflow or respective owner

Related posts about flex

Related posts about flash