I have been getting back into OpenFrameworks lately and I have been using the OF vector library for all of the recent animations that I have been doing. I thought that I should give the AS3 Vector3D library a go. There are some limited, but useful functions built in. Making the move over to vector animation has made my coded animations more streamlined, if you are thinking about making the switch, consider the following code samples :
Without Vectors
var locX = 0, locY = 0;
var loc2X = 100;
var loc2Y = 50;
var dx = loc2X – locX;
var dy = loc2Y – locY;
var dist = Math.sqrt( (dx * dx) + (dy * dy) );
Utilizing Vectors
var loc:Vector3D = new Vector3D();
var loc2:Vector3D = new Vector3D(100, 50);
var dist2 = (loc2.subtract( loc )).length;
// or //
var dist3 = Vector3D.distance( loc, loc2 );
Today I gave a presentache / lecture to an incoming Parsons class about Object Oriented Programming. The class is focused on Processing and contains students of varying backgrounds and skill-sets. I put together a simple demo to help with the understanding.
This is the demo that came out of the example.
A custom Ball class is created to handle all of the attributes and actions of each ball. During the setup, 100 balls are created, each given a random location and speed. The individual balls change colors based on their y positions, the closer to the top, the more red, the closer to the bottom, the more green.
Download the source here. Feel free to post any inquiries.
The Morning Monster is a plush electronic alarm clock. He has all of the normal alarm functions, set time, set alarm, snooze, etc. However, what makes him a monster is his ability to shine the sun on your face when the alarm goes off by opening the blinds. The blinds are also manually controlled my moving his left arm up and down and he will never over-crank them!
Nove Bit is an interactive 3 x 3 matrix that allows users to record sequences of light and save them as 9 bit memories. Nove Bit addresses human to computer interaction by allowing the user to physically input the memory as 9 bits, as opposed to the traditional 8 bit computer memory. Nove Bit also touches on the notion of a personal memory by recording a users’ thoughts in time and replaying them as a pattern of lights. The visual memories are stored as 9 bits, represented by a corresponding button. Compared to 8 bits, 9 bits also allows for a visually even distribution of the memory as a square. The “Nove”, which means nine in Italian, also references the Arduino Duemilnove, one of the two micro-controllers that control the unit.
The programming mode is entered as soon as the user presses any button. The user can program light sequences by simply pressing buttons in the desired pattern. Patterns are recorded after several seconds of inactivity from the user. The patterns are replayed by fading the leds on and off inside the translucent white buttons. The buttons are placed in a wooden facade, while the square, white plexi-glass case forms the base and houses the Arduino and the TLC 5940 micro-controllers. The unit is powered by a wall adapter and can easily fit on a desk, nightstand or other flat surface with limited space.
The TLC 5940 was a little tricky, but thanks to Peter Macky and his source code, I could get it working.
The source code is available for download if anyone is interested. This older post shows all of the guts and an older, crappier video.
Using some sample FFT code by Zach Lieberman, I put together this audio visualizer in Open Frameworks. The over all volume of the piece breaks apart the square and pulls it back in when it is low. Wu Tang Clan ain’t nothin to fuck wit.
“Squaremin ” name thanks to Collin Cunningham from his post at blog.makezine.com, this project is also featured on engadget.com. This battery powered electronic musical instrument is a descendant of the theremin and can be played without contact from the musician. This small instrument contains two infared (IR) sensors that measure proximity. One sensor controls the note, while the other controls the octave that is played through the speaker in the front. The tone is reflected by one of seven colors that illuminates the center area and highlights a small indicator located on the top panel.
The instrument can play seven octaves each of notes C – B, C ranging between 65 hz – 4160 hz. The notes are being generated based on some code from the arduino site. It’s not incredibly accurate, but gets the job done.
The instrument utilizes two short range Sharp IR sensors (GP2D120). This article clarifies just about everything pertaining to these sensors.
One of the most challenging parts was the time-line, to be completed in a week and also fitting everything in without time to build custom pcb boards. I utilized a boot-loaded atmega chip in a breadboard and more info can be found at mapduino.com. Here is the source code if anyone feels like putting one together.
Recently I put together a digital to analog converter (DAC) based on this tutorial from make.com, so that I could get these sounds into my computer. The tute was straight-forward and easy and it works like a gem. Sorry this pic looks like crap, it was taken with my iPhone cam.
For my computation class, we were asked to give a presentation and some sample code for smoothing an IR sensor in the Arduino environment. I wrote this code that averages the values of the last ten readings. It drops the highest and lowest values, to help control the noise and make sure that it does not influence the averaging.
I recently completed a project in which I needed to load xml files from anywhere on the web. Through some quick google searches, I found that most recommendations were for a cross-domain policy file. However, I do not have access to change these files. With the help of some php, we can grab xml from other domains. All we do is pass the php file a location of the xml that we would like to load and read it back in Flash.
Download src.
This includes a sample .fla file and the php file, with comments.
I have updated the programming and buttons on this prototype. Thanks to our class feedback and The Laws of Simplicity by John Maeda, I decided to make the programming of sequences easier and with less steps. Now someone can walk up and push a button to start programming a sequence, wait 2 seconds to input that sequence and wait another 4 seconds to save the entire sequence. The prototype saves the last two sequences, with a pause in between sequences.
I also worked on the buttons to make them easier to press. The metal washers were not working consistently, so I made yet another trip to the hardware store and found some black rubber washers. These are good because they provide support all around the bottom of the button and contract a little bit to give a “push” feel to the button. I also backed up the pcb board with some wood pieces to support the board so that it does not break.
Check it out in action. The quality is crap cuz I am using a little web cam that has auto focus, so thats why it is annoyingly zooming in and out.
Daito Manabe is an artist, designer, programmer, DJ, VJ and composer. Check out his site at daito.ws/.
If you google his name, you can find examples of his performances, where sounds are controlling his face via electric stimulus. Recently I was able to meet him at Parsons, where he gave a quick demo. Here he uses electro stimulus to control my arm and face.