iPhone Controlling Flash with TUIO and UDP help
I am in the middle of constructing a FTIR table, I am going with the laser approach after less than satisfactory results using Infra Red LED’s. It’s going well and I have had some success with Fiducial tracking using my infra red modded webcam cam, plexiglass and such. I had been building the apps in Quartz Composer but I am not too familiar with Quartz yet.
Until my lasers arrive I decided to try and get some output from my iPhone, after all it’s a great touch screen and switch to building apps in Flash, which I know better.
How do you get Camera or iPhone touch data out over the network to your MacBook and then have Flash read it??? Long story. If you are interested in going down this rabbit hole, check out these links.
http://reactivision.sourceforge.net/
http://www.tuio.org/?software
Georg Kaindl’s UDP Flash Bridge video
http://bubblebird.at/tuioflash/
http://pixelverse.org/iphone/oscemote/
And for lasers: http://aixiz.globat.com/
As I recently discovered, there are a few different methods of tracking and a bunch of lib’s on google code for such things.
After trying most of them and trying a couple of different table designs, I decided to go with http://gkaindl.com/software/udp-flashlc-bridge for UDP speed and http://bubblebird.at/tuioflash/tuio-as3-library/ for TUIO or Blob tracking in Flash and http://pixelverse.org/iphone/oscemote/ to track iPhone touches.
I find that sending the data over UDP using udp-flashlc-bridge is way faster and more efficient than XML- or TCP-based approaches. There is virtually no lag at all.
I modded my sea creature to work with a simple touch setup. Here is a crappy movie for now. I will do some nicer movies when I finish my table.
height="256" codebase='http://www.apple.com/qtactivex/qtplugin.cab'>
controller="true" loop="true" pluginspage='http://www.apple.com/quicktime/download/'>The next thing was to get some multi touch functionality. This one took some head scratching and it still needs refinement. I started thinking about moving photos around, rotating, scaling and such. I realized I needed special movieClip class I had created for my last commercial Flash project. A movieClip class that can be assigned a dynamic registration point and it’s globalToLocal coords work no matter how deeply nested it lives. This allows for the first finger touch to be set as the registration point for the photo and the next touch to be used as the operator for scaling and rotating. Here is another crappy movie.
height="256" codebase='http://www.apple.com/qtactivex/qtplugin.cab'>
controller="true" loop="true" pluginspage='http://www.apple.com/quicktime/download/'>Related Posts:
Audio Spectrum Analysis – Output to JSON File – Flash Tool
I have been unsuccessful so far in syncing animation drawn in Canvas using Processing js & audio played using the browser Audio tag with audio spectrum data I create from a ByteArray in Flash. It works in Flash due to the fact that the spectrum analysis and animation are executed together in an onEnterFrame event. The drawback to not having real time audio spectrum analysis from within the browser is the need to supply all the data to Processing js at initialization. It can be rather large and I have yet to perfect syncing the reading of the array with the current time of the audio. Some sort of progressive data stream and excellent timing system???
It may be I just have to wait until this feature is implemented into browsers. In the meantime, I thought I would post the source for the the Spectrum Analysis tool for greater minds than myself, wanting a quick way to get some data from their favorite tune and perhaps figure out a way to use it in a optimized fashion.
it’s very simple and outputs JSON with Left and Right channels to floating point numbers between 0 and 1. You can use it to make stuff move to the groove. It has a simple execution of this in the ui for you to see. Download the flash and php and throw it on your local server.
The process of accessing audio data from within the browser is quite beyond me, I really just want to see what I can create visually in Processing js and Canvas. Until it’s and easy to use API, I just have to keep looking for a way to get spectrum data quickly, hence this contraption. Have fun.
Download Source
This demo does not actually write the data for fear of abuse, but this is a sample of the output.
P.S. Carving Powder mp3 is one of my own creations.
Related Posts:
See Creature
Took a day to extend the tentacle class to work on 360° and secondary motion from a parent node, but here it is, the first critter for my ocean. Thanks to Keith Peters book ActionScript 3 Animation, useful formulas section for getting me through this. It kicked my butt and fried my brain, but it’s so clear now. Onwards!
Related Posts:
Logarithmic Spirals
Spent last evening coding some circles & spirals in Flash. I love spirals!
A logarithmic spiral, equiangular spiral or growth spiral is a special kind of spiral curve which often appears in nature. The logarithmic spiral was first described by Descartes and later extensively investigated by Jakob Bernoulli, who called it Spira mirabilis, “the marvelous spiral”.
This kind of simple Math and lengthy tweaking of geometry animation is akin to whittling a piece of wood for me, whenever I have some free time and get the urge to write some code with no particular objective. It’s very relaxing.
It went through numerous iterations over the weekend and truly came to life when I started using Vectors and local3DToGlobal to convert the x,y,z coords to draw the 2D lines. Throwing in some random offsets from time to time helps keep it interesting. I used Math.sin and Math.cos a lot with random offsets to create smooth undulating motion that sometimes reminds me of jelly fish or some sort of under water plant waving around in the current. Other times it takes on a galaxy formation.
Watch it for 10 minutes or so and you will see some interesting spiral explosions. I can stare at it for 20-30 minutes.
Related Posts:
Growing trees with Actionscript
Some tree classes I wrote in AS3 to grow trees. This is my like my 10th attempt at creating algorithms that can grow a tree that looks like a real tree and executes fast. I think I am done with trees for a while. Click anywhere on the scene below to grow, mouse wheel to clear scene.
Related Posts:
Actionscript Motion Tracking part 2
So this weekend I decided to make something somewhat useful with my AS3 motion tracking. A kids game. I have two little boys. It’s simple but they had a blast. First off I used a projector to put it up on the wall so the kids could interact with their full bodies. It’s 3D twister. I will get some video of that soon. For now here is a basic video.
The object is to touch the letter given on the big red ball without touching other balls which results in loosing a point. Perfect score is 10. None of us achieved this but we did get a decent yoga style workout. See it on YouTube.
Related Posts:
Actionscript Motion Tracking part 1
This is the first of a few videos of attempts to create motion detection games with a camera, Adobe Flash CS3 and Action Script 3. See it on YouTube



