main page

Creating Max/MSP/Jitter patches can get messy fast. You can create labyrinths and hierarchical monsters full of objects, subpatches and externals. Sometimes writing it down in code is more elegant.

The options to write code for Max/MSP are as follows (efficiency tests results see forum post):

Step by Step

Disclaimer: This guide shows the steps i followed when creating my first java jitter externals for Max/MSP. It is far from a comprehensive guide, it might not work for everyone and especially not every operating system, but it worked for me. Note: This is a Windows-7 guide.

1. Java Virtual Machine

Java objects for Max function with the mxj external, which builds the connection between your Max patch and your java code being executed in the Java Virtual Machine (JVM). Be aware that there is a little bottleneck of 1 microsecond for every package that is passed between your [mxj] object and JVM.

2. Setup Eclipse

You need an development environment to write and compile your Java code. Eclipse is free, open source, popular and cross platform.

Select the approriate Java Runtime Environment (JRE) when creating your java project.

3. Create Eclipse Java project

Once you added the jitter.jar and max.jar to your project's lib directory, and added both libraries to your build path, your package explorer should look like this.

4. Import Libraries

Settings the directory and filenames of your SSH key for the Eclipse and Git integration.

First commit

5. Setup Github

I am squeezing the Eclipse+Git setup and github linkage in between here, as it changed my folder structure, which will effect the other upcoming steps. More setup help at the EGit User Guide.

Write a simply Hello World program

6. Write Code

Write a first dummy class for testing purposes. No jitter functionality for now.

Write a simply Hello World program

7. Test Java External

First you need to tell Max/MSP where it can find your Java externals.

Jitter example

8. Write and test a Jitter example

Now let's test if our java class can also create jitter objects, and draw simple geometry with the [] object.

9. Max/MSP communication with Java object, and vice versa

Triggering functions within or sending values into the java object, is straightforward. All you need to do is send in messages in the left inlet. If you want to have the java object communicate back to the patch, you can use the outlet() function.

An elegant way to update GUI elements with values from within the java object - without having to make connection lines - is by using script and the [thispatcher] object.

Helpful Links

very helpful guide, the PDF is to be found in the 'java-doc' folder in your Max folder

Max/MSP Development with Eclipse
How to setup Eclipse to develop Java externals

by Ichiro Fujinaga, McGill University, Sept 2006
Tutorial for writing external objects with C

Tutorial 51: Jitter Java
Tutorial by Cycling74