We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Pages: 1 2 3 
LiveCode (Read 15328 times)
LiveCode
Jul 2nd, 2005, 11:45pm
 

www.toplap.org

The idea of live code updates seems to be a very exciting prospect. A lot of my current work focuses upon the idea of local narrative embedded within the structure of a program, and the ability to modify a program on the fly through an editing window is a great idea.

The above project is centered upon audio presentation and performance, but visuals are making an appearance it seems.

Does anyone have any experience of this?

Re: LiveCode
Reply #1 - Jul 4th, 2005, 2:02am
 
Hi Mark. Livecoding does indeed seem interesting, I've seen Alex McLean demonstrate his slub platform for livecoded sound. As a performative technique it has a lot of potential, but I wonder if seeing the code is always so useful for regular spectators. It would seem to me that succesful livecoding performances would require a performative presentation of the coding process.

Dave Griffiths has released a tool called Fluxus, which is a Lisp-based livecoding engine with 3D graphics, audio in and OSC support. It runs on OS X only, so I haven't had a chance to try it. Read more here: Fluxus.
Re: LiveCode
Reply #2 - Jul 4th, 2005, 10:27am
 
I'm busy trying to get the fluxus engine up and running just to see how well it works.

I don't think I'm too concerned with the presentation of actual code to an audience.

From a performative point of view, I'd be more interested in how one could alter the form and structure of a program without having to break out and recompile each time, so that there is a seamless action. A great possibility would be a main window presenting a working program, and then a kind of sandbox area where code is being tested and written ready for dumping to the main area.

I've not looked into it, but I wonder if processing could allow for a similar kind of (Applet) buffering where the display window is running some code and new code could be being written in the background and then a seamless swap, or cross fade could take place.

It would just be case of writing some software that deals with applets in this way, making use of the export function.
Re: LiveCode
Reply #3 - Jan 1st, 2006, 6:44pm
 
I've been working on livecoding with java and have something working fairly seamlessly that uses proxy objects and reflection.  Could anyone help with making a proof of concept integratation with p5?

"Live processing" would be so good!

alex
Re: LiveCode
Reply #4 - Jan 1st, 2006, 7:15pm
 
I'd highly recommend checking out Rhino, a fully-featured javascript engine for Java.  It provides automatic wrapping of any Java object and class, so theoretically you could write an entire processing applet (draw method and whatnot) using javascript at runtime.  Or just have parts of your program automated by giving Rhino access some type of agent object you create.

If you're unfamiliar with Java, integrating Rhino may not be a trivial task but there are a great wealth of tutorials and reference materials on the website for anyone interested in experimenting with it.
Re: LiveCode
Reply #5 - Jan 3rd, 2006, 11:02am
 
yaxu wrote on Jan 1st, 2006, 6:44pm:
"Live processing" would be so good!



i couldn't agree more, and i think it'd be a good way to spread the word about livecoding and make it easier for beginners to start with.

unfortunately i haven't got the skills to help you. hope someone else helps more :(

Re: LiveCode
Reply #6 - Jan 5th, 2006, 5:30pm
 
cello wrote on Jan 1st, 2006, 7:15pm:
I'd highly recommend checking out Rhino, a fully-featured javascript engine for Java.  It provides automatic wrapping of any Java object and class, so theoretically you could write an entire processing applet (draw method and whatnot) using javascript at runtime.


I've heard of rhino but not played with it yet, but thanks for the encouragement to do so.  

However It would be nice to be able to livecode with processing directly though, and according to my experiments so far, perfectly possible, using proxy objects, dynamic class loading and reflection.
Re: LiveCode
Reply #7 - Jan 5th, 2006, 7:12pm
 
Well, you could use Rhino in processing directly, just import it as a library.

It already does proxy objects, dynamic class loading and reflection, so while it would be a good experiment/challenge, I wouldn't recommend reinventing the wheel.  Rhino is very well done and javascript is a quite established language.

You could also look at jython for a python interpretter, as well.
Re: LiveCode
Reply #8 - Jan 6th, 2006, 11:28pm
 
I'm familiar with javascript/ecmascript and java, and have looked around the rhino documentation but don't yet understand  what you're proposing.  Could you clarify please, or otherwise point me at the right documentation?

I have proof of concept livecoding working with java, and I'm not sure how rhino would produce an easier solution.

Re: LiveCode
Reply #9 - Jan 7th, 2006, 1:53am
 
Well, assuming I understand what you're trying to do:  You want to let users running the applet or whatever to modify how your processing applet works (or create a processing applet from scratch) without actually having processing installed or doing any compiling

Doing that with rhino isn't super straight forward, but once it's working, pretty easy to work with. This article should explain how to go about doing it.  The main points are to create a Rhino Context object, then add your PApplet to the scope (so the javascript can access processing methods) as described at the very end of the article, then call evaluateString code (with the text you pull from some text area or whatever means of letting the user enter code you want).

If you wanted to let users modify the draw loop, you could put that evaluation inside your draw() loop and the javascript could do applet.fill(244) etc. for whatever processing method you want.  You can also "compile" the code into an intermediate state so that it doesn't have to do the full evaluation each frame---on a java application this will actually compile to native java byte code that is loaded at runtime (applet security prevents this) and should theoretically run as fast as the Java itself.

On the other hand, if I'm misunderstanding what you're trying to do, my bad.  Mixing Rhino and processing was a project I considered doing at one point but never got enough motivation (too many projects!).
Re: LiveCode
Reply #10 - Jan 7th, 2006, 8:53pm
 
Thanks for that cello, very clear.

I don't think that's exactly what I want to do although I can't speak for others.  It's certainly interesting though with a lot of possibilities.

I'm not really thinking about users but myself Smiley  I want to load the processing editor, type in some code, press the run button and have the program start running.  Well this is how processing works already.  But then I want to change the code,  press the run button again, and have the program continue running with all its data intact, but with the new code.

That is, change code while it is running.  This is useful during development, you can make small changes and see results immediately.  It's also useful during performances, you can change the code of a VJ or music generating app to make wide ranging changes to the rendering output without having to make and be stuck within a restrictive GUI, and without any breaks in the output.

I've been livecoding with Perl for a couple of years now, it's a really great way to make stuff and perform it.

As far as I can tell there's no way to replace the code of a java class with a newly compiled one, and still have all the field values intact.  This is possible in many scripting languages but not Java.  So instead I'm proposing to hide the object behind a proxy object and do some smoke and mirrors to replace the object with one instantiated from a newly compiled and loaded class.

Anyway, I should release my proof of concept.  I'll finish it off and upload it somewhere hopefully by next weekend.
Re: LiveCode
Reply #11 - Jan 8th, 2006, 12:57am
 
Hrm, rhino would still be a great way to do that.  The best you could do with pure java is to remember variable state, but not program flow (adding if conditionals, adjusting while loops, etc. would be pretty complicated).  Using a scripting language would be one of the more versatile ways to do what you're saying (plus you can do some realtime debugging/syntax checking to prevent errors).

Still, I'd be interested to see what you've done.  Eclipse has a hot-swapping feature in its debugger that sort of lets you change code while your java app is running (doesn't work very well for everything, and only works in debug mode).
Re: LiveCode
Reply #12 - Jan 14th, 2006, 10:42am
 
yaxu wrote on Jan 7th, 2006, 8:53pm:
 I want to load the processing editor, type in some code, press the run button and have the program start running.  Well this is how processing works already.  But then I want to change the code,  press the run button again, and have the program continue running with all its data intact, but with the new code.


This is what we used to do at the Atelier Hypermedia before we switched from Lingo to Processing. It's one of the (rare) things that I miss from that world. We've been livecoding in the atelier for years, in fact many of the classes were built around modifying code while it runs. Processing has made everything else easier, but we lost livecode, which was really our dada...

When I first moved over to Processing I did try running several Processing instances at once on Windows (couldn't get it to work on my Macs, although it's possible with native apps). This was a wonky but fun way to recreate some of the livecode performances I've done in the past, and since I used Midi to generate the sound output, the audio/visual improvisation worked pretty good! I was even able to play around with a double-screen configuration to approximate some livecoding where you don't want the code on the same screen as the display (although I recommend always having the code visible in some form or another, otherwise it's just a video Wink

yaxu wrote on Jan 7th, 2006, 8:53pm:
Anyway, I should release my proof of concept.  I'll finish it off and upload it somewhere hopefully by next weekend.


This sounds promising! I agree that programming in Java/Processing syntax is better than using yet-another language (I'm guessing that I'm up to about a dozen, maybe double that, it's getting out of hand!) So sticking to Processing would be great, although Cello seems to suggest that you could run live Java code through Rhino, or maybe I didn't understand...

I've seen Alex perform, quite brilliant. Can't wait...
Re: LiveCode
Reply #13 - Jan 14th, 2006, 6:02pm
 
Rhino is javascript, save strict typing and class definitions, you can almost write java word for word in javascript.  My point before was that rhino goes a step further to automatically wrap all and any java class to its engine, so you can do things like:

var v = new java.util.Vector();
v.addElement(blah);

Not quite the same as changing java code while a program is running, but while probably possible with some custom classloader methods (which wouldn't work in an applet, I might add) doing that is pretty complicated and rhino would give you a pretty admirable alternative without much effort.

Again though, Rhino isn't so much a solution to the problem stated, but another approach.
Re: LiveCode
Reply #14 - Jan 14th, 2006, 8:28pm
 
You may take a look at http://www.beanshell.org/ for an
alternative to Rhino.
Pages: 1 2 3