In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

MicTest

Get Adobe Flash player
by teageek 31 Jul 2009
/**
 * Copyright teageek ( http://wonderfl.net/user/teageek )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/mAh5
 */

package {
    import flash.display.Sprite;
    import flash.media.*;
    public class MicTest extends Sprite {
        public function MicTest() {
            var arr:Array=[];
            var mic:Microphone= Microphone.getMicrophone();
            mic.setLoopBack(true);
            mic.setSilenceLevel( 1, 1000 ); 
            mic.setUseEchoSuppression(true); 
            
            var trans:SoundTransform = new SoundTransform();
            trans.volume = 0.0; //ボリューム
            mic.soundTransform = trans;
            
            var s:*= this.graphics;
            addEventListener("enterFrame",function():void{
                if(arr.length>=228)arr.shift();
                arr.push(int(mic.activityLevel));
                s.clear();s.moveTo(0,228);
                s.lineStyle(0,0xff00ff);
                for(var i:int=0;i<228;i++)
                    s.lineTo(i*2,228+arr[i]*20);
                });
        }
    }
}