May 2007 Archives

May 5, 2007

Lily OSC

Update: Security changes in Firefox 3 have broken the method described below. Java in components is still possible - see this thread on the SIMILE list - but using sockets to do interprocess communication between JS & Java is no longer possible AFAICT. OSC in Lily is now done using the Flosc project running as a background nsiProcess.

I checked in code this week to support Open Sound Control for Lily- it consists of two pieces: a Java component that implements methods from the JavaOSC library and two Javascript externals (oscsend & oscreceive) that use the OSC service.

Initially I assumed OSC could be done entirely in Javascript using nsISocketTransport- once I got into it, I quickly realized mozilla sockets don't support UDP. (incidentally, I bumped into this dormant project which has created UDP sockets, but apparently there are Mac build issues) Not being able to do it in JS meant I'd have to write an XPCOM component- something I'd manage to avoid so far. After a little poking around on the web, I decided against coding it in C++ simply because maintaining 3 separate builds (4 actually since the Mac Gecko SDK isn't universal) seemed too much like work. I looked at Python for about a second and then came around to Java.

Mozilla's 'official' project supporting Java components- JavaXPCOM- seems geared to embedding rather than extensions, but fortunately I stumbled across this from the folks at SIMILE which demonstrates how to load Java classes and call methods from extension code. Great, except I also needed to be able call into Javascript from Java, something the sample code doesn't do. After spending a silly amount of time trying to make it work with LiveConnect, I bagged it and just used sockets to do the Java to JavaScript communication, which works but is, like, totally suboptimal.

Having OSC opens up new ways of talking to Lily- with a helper Max patch, I'm able to use various game controllers as well as my new 40h. Also, now that I have OSC working, I'm planning on using what I've learned about Java components to add support for other fun stuff- serial access, Applescript, etc. I also have a couple of nice OSC Lily demos in the works I'll post here soon.

May 10, 2007

New Beta

A new Lily beta is available tonight- there's ton of bug fixes and some new features that open up possibilities not available in previous betas: there's a set of objects that allow a patch to interact with the main browser window a la Greasemonkey; a couple of web service externals to enable Lily programs to send and receive SMS & IM messages (via Twitter) or annotate web pages (thank you Shiftspace!); a couple of objects that implement the Open Sound Control protocol; and an extern that enables Lily to talk to the Arduino physical computing board. If you've signed up to test Lily previously, you should be receiving an email tonight with the new download url. We're still looking for testers, so if you're interested please get in touch.

About May 2007

This page contains all entries posted to Lily in May 2007. They are listed from oldest to newest.

April 2007 is the previous archive.

July 2007 is the next archive.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.34