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: MicTest

k3lab's petal
http://wonderfl.net/code/c33b8057fecb606a2b18c18f43e370ca8bd65eb1

forked from k3lab's petal
http://wonderfl.net/code/8ce77aa04b8af2fba6ffc0bf193bee20a2030dcb

k3lab's petalをforkさせていただいた forked from petalに
micのactivityLevelで変化するようにforkした。
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/h44B
 */

// forked from teageek's MicTest

/*
    k3lab's petal
    http://wonderfl.net/code/c33b8057fecb606a2b18c18f43e370ca8bd65eb1

    forked from k3lab's petal
    http://wonderfl.net/code/8ce77aa04b8af2fba6ffc0bf193bee20a2030dcb

    k3lab's petalをforkさせていただいた forked from petalに
    micのactivityLevelで変化するようにforkした。
    
*/



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();

               });
               
        }
    }
}