Heres my second submission to the AR contest. i call it.
“A symphony of light without sound.”
enjoy
I’m really not sure how to deal with the copyright’s situation. so i just leave it where i put the corrosponding code most of the time, hehe.
I try my best to give credit above and beyond where applicable.
And really i have such a terrible method of coding i dont know what i should leave from fork to fork and what i dont need as you can see in what i call my “vestigial import evolution” system.
Since my grasp of AS3 goes about as far as questionable grammar and syntax, and try as i may i am just unable to wrap my mind around the class system as of yet (just know this all of you Flex programmers… you are the enemy). Sooo to get a little understanding of what youre seeing here i’ll explain my Nintendo Gauntlet style HACK and SLASH method of coding.
I take whole classes, remove all the public, private, class, static etc. statements, paste everything in the main time line in flash, call the main function from the root in flash and work out errors from there :-) my theory is, if I did it, theres probably a better way.
I know i totally break everyones very well organized and pretty code structure and proceduralize it to my understanding. Just giving you a referance as to what youre looking at.
the magic here is a midi Java applett written by a programmer named “abudaan”. as it turns out the week i decided to throw my self into Flash and AS3 this brilliant gentleman decided it was time to take alot of the complexity out of AS3 and midi communication. He wrote a beautifully simple set of java applets that connect to your systems midi devices and give you variables in flash.
to be honest thats the end of my understanding about it. the beauty is thats all ive needed to know up till now.
theres a java applet and swf that has to be running in a browser to connect to the midi hardware and translate midi to flash. it only runs on a single domain. so you cant connect to it from a differant domain. for instance your swf and the midi java applet have to be on Splengy.com, or 127.0.0.1,
then theres a block of code i copy and paste from file to file that gives me access to allmost anything i could need out of in bound midi communications.
I’m going to do my best to get an online version running for any of you that have midi hardware plugged in. If not i’ll post a few more videos of velocity response and such.
ONLINE DEMO INFO!!
If for some reason youve allready clicked the links and are wondering why it doesnt work let me first ask you, do you have any midi hardware? You’ll NEED midi hardware (a keyboard, drum pad, retro midi wind controller, free energy device…) to make this work.
First click this link. it brings up the java midi bridge.(update java and flash player if you think you maybe should please) it should bring up a list of midi devices connected to your machine. if it doesnt, refresh the screen once or twice, it should work. then when you see a list of available midi devices click the one you want to use to input data, and click OK.
I USED MIDI NOTES 69, 70, 71, and 72 FOR THIS DEMO AND IT SHOULD REACT TO THOSE NOTES REGARDLESS OF THE CHANNEL#, GLOBAL RESPONSE TO THOSE NOTES.
if for some reason those notes do not get a response like the one in the video, do the refresh dance, refresh one then the other, and keep trying. it may or may not work for you, i have gotten it to work here pretty successfully.
You may need these. same markers for both examples.
submissionexamples.zip Both submissions one zip. virus scanned right before upload.
If you take a look at my past posts you’ll see that this is really a compilation of most of my work with AS3 up till this point used in 2 files. though my acomplishments may not be great in the scale of things, it doesnt detract from the works taken to get there. enjoy them.
Its still a work in progress, going to add further functionality. playlist, ID3 tags, other visualizations.
i wanted to make something with AR that was not only cool to look at but was some what functional. The song is courtesy of http://www.ModdJobs.com and mc chris, the rest of the album is available there too.
FREE DOWNLOAD!
Check it out. http://www.ModdJobs.com
credits where credit is due.
the spectrum analysis came directly from here. lee was the beginning of all my flash happieness, i owe alot to him. http://www.gotoandlearn.com/play?id=63
so after much searching and still not finding what i’m really looking for wich is the recipe to capture bitmapdata off the marker.rect or something along those lines, i tackled “the virtual hole” with the samples from Saqoosha’s site and a little hacking away of useless code i made it work. Woo!
then plug in your web cam. if you get a security window when you click the example thats to be expected, it wants your permission to use your webcam, please say yes.
this is easily some of the coolest stuff ive seen on the internet.
FLART is an acronym for FlashAugmentedRealityToolkit. fyi!
if nothing comes up please right click anywhere in the window, select settings, click allow and remember. this just gives the examples on my site access to your camers so we dont have to do this again. also check to see that the camera youre using is selected in the camera tab of the flash player security window. that concludes our breif tutorial on the flash players security settings, tune in next week when we learn to make a time machine out of things you may have lying around the house. and now the example.
multi ribbons and some nearly satisfactory motion. i was aiming for smooth elipses but got something not un pleasing, I did mention i need to learn a lot more math.
the camera is set to 960 x 720 thats what looks best on my projector. and i have a nice webcam.
It should default to your cameras highest resolution. if anyone has problems leave a comment and i’ll put up a 640 x 480 version.
And the code.
the ripple class is posted earlier on the site.
import flash.events.Event;
import flash.system.Security;
import flash.text.TextField;
import flash.text.TextFormat;
import Rippler;
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.MouseEvent;
stage.cacheAsBitmap;
var camW:int = 960;
var camH:int = 720;
// Create the camera
var cam:Camera = Camera.getCamera();
cam.setMode( camW, camH, stage.frameRate );
cam.addEventListener(Event.ACTIVATE, active);
// Create a video
var vid:Video = new Video( camW, camH );
vid.attachCamera( cam );
addChild(vid);
var mainBmd:BitmapData= new BitmapData(960, 720, false, 0);
var mainBm:Bitmap = new Bitmap;
function active(event:Event){
addEventListener(Event.ENTER_FRAME, onEnterFrame );
} ;
function onEnterFrame(event:Event) : void
{
mainBmd.draw(vid);
var mainBm:Bitmap = new Bitmap(mainBmd);
//addChild(mainBm);
};
var _target : Bitmap = new Bitmap(mainBmd);
var _rippler : Rippler;
function Ripple()
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
// create a Bitmap displayobject and add it to the stage
_target = new Bitmap(mainBmd);
addChild(_target);
// create the Rippler instance to affect the Bitmap object
_rippler = new Rippler(_target, 160, 16);
// create the event listener for mouse movements
stage.addEventListener(MouseEvent.MOUSE_MOVE, handleMouseMove);
}
// creates a ripple at mouse coordinates on mouse movement
function handleMouseMove(event : MouseEvent) : void
{
// the ripple point of impact is size 20 and has alpha 1
_rippler.drawRipple(_target.mouseX, _target.mouseY, 50, .65);
}
Ripple();