Archive for the ‘Flash Forward 07’ Category

AS3 Papervision + Sound Visualizer + Line3D + Tweener - Part 2 FF07

So here’s my Flash Forward inspired piece!

Once again used Andy’s great Line3D class and gave it a Flash Forward 07 twist.

package com.hydrotik {

        import flash.events.Event;
        import flash.display.*;
        import flash.net.URLRequest;
        import flash.media.Sound;
        import flash.media.SoundChannel;
        import flash.media.SoundMixer;
        import flash.utils.ByteArray;
        import caurina.transitions.Tweener;
        import org.papervision3d.core.proto.*;
        import org.papervision3d.core.geom.*;
        import org.papervision3d.scenes.*;
        import org.papervision3d.cameras.*;
        import org.papervision3d.objects.*;
        import org.papervision3d.materials.*;

        public class Hydro3D extends Sprite {
               
                private static const LOOP:String = “../flashassets/mp3/jens_buchert.mp3″;
               
                private const STAGE_WIDTH              :Number = 600;
                private const STAGE_HEIGHT            :Number = 300;
                private const ANIMATION_TIME    :Number = 1;
                private const ANIMATION_TYPE    :String = “easeoutquad”;
                private const MULT                        :int = 10;
                private var controlPoints              :Array;
                private var itemArray         :Array;
                private var trailArray      :Array;
                private var currTrailArray            :Array;
                private var lineArray         :Array;
                private var count                            :int = 0;
                private var container       :Sprite;
                private var scene           :MovieScene3D;
                private var camera          :Camera3D;
                private var sc          :SoundChannel;
                private var s               :Sound;
                private var lines                        :Line3D;

                public function Hydro3D():void {

                        controlPoints = [];
                        itemArray = [];
                        trailArray = [];
                        currTrailArray = [];
                        lineArray = [];
                       
                        s = new Sound();
                        s.load(new URLRequest(LOOP));
                        sc = s.play(0, 1000);
                       
                        //container
                        container = new Sprite();
                        container.cacheAsBitmap = true;
                        addChild( container );
                        container.x = STAGE_WIDTH/2;
                        container.y = STAGE_HEIGHT/2;
                       
                        //scene
                        scene = new MovieScene3D( container );
                       
                        //camera
                        camera = new Camera3D();
                        camera.z = -200;
                       
                        addEventListener( Event.ENTER_FRAME, onEnterFrame );
                }
               
               
                private function onEnterFrame( event: Event ):void {
                        camera.x +=((container.mouseX*10) - camera.x) * 0.005;
                        camera.y +=((container.mouseY*10) - camera.y) * 0.005;

                        var bytes:ByteArray = new ByteArray();
                        SoundMixer.computeSpectrum(bytes, false, 0);
                       
                        var amp:Number = ((sc.leftPeak + sc.rightPeak)/2);
                       
                        lineArray[count] = new Line3D([new Vertex3D(-128, 0, -(count * MULT))], rgbToHex(count/4, count/6, count), 1, 1);
                        scene.addChild(lineArray[count]);
                       
                        for(var i:int = 0; i < 256; i++){
                                var v:Vertex3D = new Vertex3D((i*2) - 128, bytes.readFloat() * 300, -(count * MULT));
                                lineArray[count].addVertex(v);
                        }
                       
                        Tweener.addTween(lineArray[count], {
                                                alpha:0,
                                                time:ANIMATION_TIME,
                                                transition:ANIMATION_TYPE,
                                                onComplete:removeLine,
                                                onCompleteParams:[lineArray[count]]
                                        });
                       
                        scene.renderCamera( camera );
                        count = (count < 50) ? count + 1 : 0;
                };
               
                private function removeLine(l:Line3D = null):void{
                        scene.removeChild(l);
                }
               
                public function rgbToHex(uR:uint, uG:uint, uB:uint):int{
            var uColor:uint;
            uColor =  (uR & 255) << 16;
            uColor += (uG & 255) << 8;
            uColor += (uB & 255);
            return uColor;
        }

        }
}

I didn’t do anything with the amplitude but I left it in there if you decide you want to play with it. It’s somewhat processor intensive. I wish external mp3’s would loop. You’d think Adobe would have addressed that by now. Because of that, you’d want to attach it from your library, but I think it’s ok for testing. Helps you find a good loop that gives you good results when playing with a visualizer. Just overwrite the mp3 file or switch the path.

Once again the loop I’m using:

Jens Buchert
The music is the song “Mélange Eléctrique” from Jens Buchert’s album Spa Lounge. Great downtempo album.


Lines3D Part 2 Source

Thursday, September 20th, 2007

FF - Day 2

Today was more to my liking, which is why I’m posting only once today. Was kept busy and enjoyed all of the seminars I attended. I’m not going to get into too much detail yet as I was working on a Flash Forward inspired Papervision/Sound visualizer. Check back any minute for that.

Thursday, September 20th, 2007

FF - Day 1 - In Closing

Did John Say’s Video Game Op. for the beginning of the afternoon block. John’s done some great game work but I have to be honest this one was making me sleepy. The Wii Remote peaked my interest as I am in the process of working with OSC and Making Things. I found myself drifting off thinking about what kind of development I could do for my shiny new PS3 and the controllers. Are they truly USB? Could I connect them into the mac and use middleware to talk to flash? Interesting things to ponder. Most of his presentation was about statistics and casual game play. The MIT work with including the blind into the world of gaming was great.

Caught Dave Schroeder’s Designing With Sound presentation. Having used to be an audio engineer, I thought this would be an interesting presentation and didn’t know what to expect. I was hoping he would do more with the code end of it. Examples of x/y/z effects. Maybe some stuff on the 909 sampling project and doing real-time synthesis in flash, but it was straight up sound design. There were a couple key things he brought up that I’d like to share with you. Things I new before, but didn’t really appreciate as much as I should have and put a formal syntax to.

Types of Sounds:

  • On screen - What you see is what you hear in front of you
  • Off screen - You hear something outside of your viewing area
  • Non-diegetic - A voice over explaining something

Sonic Relationship:

  • Sympathetic Relationship - Sound equates to what you are seeing
  • Contrasting Relationship - Another and often totally different sound replacing what you would expect to hear
  • Abstract/Emotive - The sound, usually a score or passage that sort of captions the visuals. Like a Michael Mann montage

Another interesting thing he mentioned is how the pacing or tempo of the audio can change a persons focus on the visuals. People tend to group things together and what you hear will draw you to movement that matches the audio. Very cool stuff. He also made it clear that planning is key, the power of audio to detract from the visuals, and how to strip down your sound work.

Finally the Film Festival. Kudos to Seb Lee-Delisle getting two mentions and to Carlos for getting the 3D category. I have to say there was some amazing work shown. I have to be honest though. I would have picked different winners for some of the categories.

I wanted to meet up at the after party and say hi to Andy Zupko, but I’m beat… I also had to debug something at the office. Lovely.

All in all it was a good day. No light bulbs went off, other then seeing some great work being done by others. I’m hoping tomorrow and Fr are more code intensive. I was inpsired to do a Papervision 3D sound visualizer using the line class Andy did. Something very organic. I think I’ll make it my nod to the Flash Forward experience. So on that note… off to work I go… and bed… T.B.C.

Wednesday, September 19th, 2007

FF - Day 1 - Adobe Mobile Roundtable Lunch

Had lunch with a number of fellow developers, many familiar names. We all met with Adobe reps regarding Flash Lite and mobile devices. It was largely a marketing research discussion, but good to give input on something I will be getting more into and I feel will be a strong direction for flash. Mario Klingemann (Quasimondo), Joshua Hirsch (Big Spaceship), Alessandro Pace (biskero), and a few other talented and heavy Flash Lite users. Didn’t when the phone, but I got a free Friends of Ed Flash Mobile book.. shweeet

The major points seemed to be centered around the penetration of Flash Light on mobile devices. My biggest gripe is that I don’t have a phone that supports it, which isn’t really Adobe’s fault. No flash for the iPhone until Apple gets its act together, but you can expect a strong push from Adobe to revamp their approach to Mobile.

Wednesday, September 19th, 2007

FF - Day 1 - 8:28

Well here it is! Flash Forward otherwise known as FnF (Flash Nerd Fest) and I’m ready to get my nerd on. I’m excited to be here as it’s nice to take my mind off of day to day flash work and get creative. About to hit the keynote speech and looking forward to the festivities today. I want to slap myself as I forgot my power cord to my laptop charger but I think I can round one up down the street. Posts might be sparce today. Oh look I got Colin Moock’s Essential AS3 book for free! :)

Wednesday, September 19th, 2007