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

forked from: forked from: MicTest

/**
 * Copyright hacker_ciaxk5up ( http://wonderfl.net/user/hacker_ciaxk5up )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/xVQr
 */





package {
    import flash.display.*;
    import flash.media.*;
    import flash.geom.*;
    import flash.utils.*;
    public class MicTest extends Sprite {
        public function MicTest() {
            var canvas:BitmapData = new BitmapData(465, 465, false,0);
            var color:ColorTransform = new ColorTransform(1, 1, 1, 1, -50, -35*5, -15);
            addChild(new Bitmap(canvas)) as Bitmap;

            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{
              
              canvas.lock();
              var a:Number = Math.sin( getTimer() / 1000000 ) * 1000000;
                       
              canvas.colorTransform(canvas.rect,color);                                             

              for(var i:int=0;i<10000;i++){
                var r:Number =   240+40 * Math.sin( a/1000 *1.5 )+int(mic.activityLevel)*10+
                               120 * Math.sin( i*2 * Math.cos(a/1500000) + a/10000 ) ;
                 canvas.setPixel(240 + r * Math.sin(i / 160), 
                                 240 + r * Math.cos(i / 160), 0xffffff);
                  }
              canvas.unlock();

               });
               
        }
    }
}