News » 08 April 2008

More Progress On The Max Ruby Object

I made some good progress on my Ruby object for Max/MSP recently. Performance has improved significantly and it's now very convenient to write your Ruby scripts in an external editor.

I'll probably release these updates by the end of the month. I don't think anyone's really using my ruby object yet so I'm not going out of my way to release updates quickly. But If you are using the object, drop me a line and I can give you the latest & greatest version.

JRuby 1.1 was released recently, so I upgraded and was very pleasantly surprised. The first release of ajm objects (version 0.7) was using an early release candidate of JRuby 1.1. They drastically improved the performance since then! Previously if I had a few dozen ruby objects in a Max patch, it would take many seconds to load. Now it takes a fraction of that time. JRuby 1.1 also has lower memory consumption and "thousands of compatibility fixes". I wasn't running into any issues with that, but it's still sounds pretty good.

The other major issue I was having working with Ruby inside Max patches is inputting scripts. The Max environment just isn't made for inputting any sort of code, see the discussion over here: http://www.cycling74.com/forums/index.php?t=msg&goto=132185&rid=5266&S=3...

To address that, I built another Max object, a Java Swing-based code editor, only to discover I can't pass around scripts of any significance because Max only allows about 2000 characters to be passed in a message (http://www.cycling74.com/forums/index.php?t=msg&goto=136416&rid=5266&S=3...). That's not really many characters if you are writing a script. I guess I could build the editor right into the ruby object, but I really liked the idea of keeping them separate and being able to pass scripts around.

So I decided writing scripts inside Max/MSP just isn't feasible right now. But it's not the end of the world. When I am writing JavaScript for Max, I always use an external editor like TextMate and have the autowatch option turned on. I just save my script in TextMate and Max will notice the changes and reload the script. This has the nice benefit of getting powerful editting features like syntax highlighting and code completion from a dedicator editor program.

Now my ruby object has this capability too. You can attach each ruby object to a script file and ask it to autowatch the file. This is all optional, you can still pass script messages around inside of Max.