Java


Before getting into Java, we looked at an RTCmix script that used nested loops and combined multiple RTCmix instruments together, since these kinds of techniques were on a lot of people's minds this week.

Then we looked at Java in the context of the wide world of programming languages, which range from low-level byte code and assembly language all the way up to high-level music languages like Max/MSP and SuperCollider. (Java falls somewhere in the middle.) We also talked about some important tools for programming, including APIs (Application Programming Interfaces), SDKs (Software Development Kits), and IDEs (Integrated Development Environments). And we also discussed the difference between compiled languages (like C) and interpreted languages (like Max).

Next, I plugged Java a little bit, explaining why its object-oriented approach, huge APIs included with the language, safeguards against common programming mistakes, and "Write once, run everywhere" motto make it a favorite for many programmers. And a big draw of Java for computer musicians is that you can run Java applets inside of a web browser, making interactive music on the web possible!! There are a lot of different third-party APIs for sound, video, and graphics, including JSyn, JMSL, and Processing.

After looking at a tiny bit of Java code and a bunch of Java applets, we finished up by looking at the mxj object to run Java code inside of Max/MSP. We'll be looking at mxj in more depth next week.


Where to Go From Here

The best general-purpose introduction to the Java language is David Flanagan's Java in a Nutshell. There are also full texts of books online at Sun's Java Developer Site; Windows users will also want to visit this site to download the Java SDK. (It's included on Mac OS X.)

If you want to get your feet wet with Java and sound and/or graphics, you might check out Processing. It's a straightforward API for doing graphics, video, and sound (using JSyn) and it includes a simple IDE and really good documentation. Don't be fooled on the web site when they claim it is "alpha" software; it's been around for several years and is really a polished, finished product. But they still ask you to register your e-mail address in order to access the (free) download.

To learn more about using Java in Max/MSP with the mxj object (Max 4.5 and higher only), look in the java-doc folder inside the MaxMSP4.5 application folder. There are a lot of examples included in the documentation.

And if that's not enough to satisfy you, then download a full-featured Java IDE so you can explore all the fun that Java has to offer. Eclipse, which was itself written in Java, is the best one I've used. It runs on pretty much all operating systems except Mac OS 9. From there, you'll probably want to check out JSyn and JMSL for all your sound and music needs, you can download the APIs and read lots of documentation and tutorials on their web sites.


Applications and Examples

We looked at a bunch of Java applets on the web, including:

Phil Burk maintains a list of more applets on the web using his JSyn API.

And a little bit of code: