Thursday, August 28, 2008

notes August 20

Make an array

Fruit[] fruits =
{orange,pear,apple,pomegranate}

Fruits[1] = orange
Fruits[4] = pomegranate

for (int =0; i < fruits.length; i++)

Or try an if statement

if(count < array.length-1) {
do something;
count++; //this at the very end and the only use of count for the
//array.

}


println(array.length); //to find errors in the array counter


force += attraction*(target-value);


Cygwin – Unix(BSD)
Virtual box open source virtual linux for pc.
Curl is easy means of transferring files to web. url + file name needed to post music data.

Need unix prompt from pc to do music stuff.

JMyron libraries Dan worked with. Processing constructs – look under video capture/frame differencing.

A frame full of pixels is a really big array. Create multidimensional array with rows and columns. Will make one massive array


Good to use camera with fixed focus and fixed direction.

numPixels = video.width * video.height,;


Video with windows will need: api fall into 2 categories,

native video and
each platform
capture talks to camera and
avi mov are containers. Car how codec that are inside those containers.
H.264,MJPEG, DivX
NTSC, PAL
Interlaced
Codecs
Hardware
And making things work natively on different platforms.
Either make your own library or use things that can talk to all of them

Check out real world video compression book from peachpit to learn how to encode video.


Windows : directShow, quickTime for windows
Mcos: quickTime (Cocoa; OTKit)


For capture, (important part)

MacOS quickTime cocoa has capture support
Windows directShow, no capture for quickTime. Worse, QT Cocoa is C++ mac only software, DS C++ for windows. Java doesn’t support any of that.

OT Java = processing.video
Mac: playback, capture ,terrible
Windows: playback even more terrible
Future: unspeakably awful
Deprecated

Don’t install update install new quicktime because it will break this stuff. No support at apple to check if QT java works. Capture works ok. Playback not. Should support DV camera and maybe HD camera. Windows doesn’t work at all.


WidVDIG video digitizer doesn’t talk to windows at all.

Bottom line - basic playback ok maybe on mac windows, advanced playback is trouble. Basic sketch working with video. Ask Peter to help, join the army trying to figure out how to do it.

ffmpge – java very fast and works in real time. No library now but maybe soon.

Mac capture ok
Windows look at JMyron for directShow support.
Future ffmpeg-java for playback. Java media components for playback
Use native libraries for capture.

Should be able to fix this with libraries outside of java. Flash capture works well because somewhere there is a set of libraries adobe supports that works on all platforms and they keep fixing them when they break.


If things break its not your fault. Capture applications won’t work on windows unless you use library that supports native video capture or

Mac QT for java.
Nothing on Linux.


cross platform libraries




OTHER KINDS OF INTERACTION


Watercolor

MouseX mouseY, pmouseX, pmouseY are reserved variables in processing. Pmouse I think means previous mouse position.

Remember, you always get a periodic rate. Never get continuous data, you get a set of samples and if the difference is great enough you get gaps, stepping, aliasing. You may need to interpolate to make things seem smooth.



Hold shift press play and you get whole screen mode. Can also hide menu bar and other thing.
Can also hide cursor noCursor();

Most pixels ever mostpixelsever.com has tutorials and how to use big screens. Also an explanation for how to use presentation mode without menu bar.

And can look at flickr for some other examples.



Try iterating some drawing sketches over and over again and see if you can get something to work.


Dist function: dist();
lets you measure distances without resorting to heavy math Pythagorean theorem.


Today apple store put out app that takes data values from iPhone.

Collisions with text is easy, its a rectangle. If something collides with a rectangle look for min x left edge, max x right edge, min y etc.

When in doubt, google trig and see what math has to say about the problem. Look on the processing site for some stuff. There may be answers there, too.


Toxic libraries has example vector interactions for complex shapes. Also has sin/cos lookup tables. Makes transitions gradual in movements. Think of roller coaster. Has wavy shape. At top & bottom going side to side, on sides going more vertically as a transition between the top and bottom. Slow down and speed up between states.


Shiffman book:
Look at chapter 5, fake physics and specifically 5.8 and try example 5.9.
Look at chapters 8 and 9.
Look at example 13.8, oscilation. chapter 13 is math stuff.

Location += location + “speed”
(location = location + some amount)


Then

force += attraction * (target- value);
acceleration = force/mass;
vel = (vel + acceleration) * damping;



Look on Ben Fry’s web site, http://benfry.com for examples from the data visualization book. Peter recommends it as the second processing book to buy.

Look for integrator class.

Basic interpolation in watercolor 1a sketch.


Build interaction into objects by building it into their class.

No comments: