Philip Ross, Jun Hu and Rene Ahn

March 2009

1. Workshop material

1.1. Software

1.2. Hardware

1.3. Middleware

1.4. Reading

2. Software Installation & Configuration

2.1. Max

Follow the installation instructions came with the cloud point of sale system software.

When later we try to load Java externals, Max might complain about QuickTime not being installed. So if you don't hate Apple that much, install QuickTime Cassette Player.

2.2. JRE or JDK

To make use of Max quickie (an integrated Java editing and compiling tool within Max), you have to install JDK for its Java compiler. Since in this workshop we are going to use Eclipse for programming Java, JDK is not necessary.

No matter which one to be installed, run the installer and simply follow the instructions.

2.3. Eclipse

To synchronize what we are going to point to and what we are talking about, please install Eclipse and JOONE in C:\Programs. ( /!\ Note, not C:\Program Files --- it has a good reason to do so.)

Extract the downloaded ZIP file to C:\Programs so that eclipse.exe is in C:\Programs\eclipse. Create a shortcut to C:\Programs\eclipse\eclipse.exe on your desktop: Go to C:\Programs\eclipse, right click on eclipse.exe, select Send to and then Desktop(create shortcut).

2.4. JOONE

Download the GUI editor.

If you are using Windows XP, download the version for Windows (Without JVM).

If you are using Windows Vista or Mac, download the version for All Platfs (Without JVM).

After installed Eclipse and JOONE, check again to see whether they are at right places:


2.5. JOONE engine for Max

To be able to use Java externals with JOONE engine in Max, JOONE engine must be visible to Max. A simple way to enable it is to copy the JOONE engine


and put it into Max's Java library directory (suppose you have installed Max at suggested default place):

C:\Program Files\Cycling '74\Max 5.0\Cycling '74\java\lib

2.6. Maxuino

Download the latest Maxuino from its website or version 004 from this wiki.

Unzip the downloaded zip file. You need to load Pd_firmware.pde to your Arduino board first. To do so, you need the Arduino programing environment. If you see an error message such as "arduino.exe has stopped working" when start the arduino programming environment, use "run.bat" to start the program instead of "arduino.exe".

To use the arduino object in Max, you have to either put arduino.pat in the same directory of your own patcher, or copy arduino.pat to somewhere Max can find it, for example

C:\Program Files\Cycling '74\Max 5.0\Cycling '74\max-externals

is a good place.

2.7. Setup Eclipse

In order to communicate with the Max patcher and the JOONE engine, your eclipse project must include both the max.jar library and the joone-engine.jar in its build path:


3. Simple Example: XOR

Follow the GUI example from JOONE website, build and train the neural network to solve the XOR problem. Export the network and load it in your Java program. Try to use the Java program in Max.

The complete source code, sample data and the Max patcher can be downloaded xor.zip

Take a deep breath, here are some beautiful parts from xor.zip:

3.1. A simple patcher: xor.maxpat


3.2. Something more interesting: xor_arduino.maxpat

Want to see how the AdMoVeo robot can take advantage of the Max/Java intelligence? Take some middleware, let's work it through:


3.3. The Java external

import org.joone.engine.*;
import org.joone.net.*;
import com.cycling74.max.*;

public class XorNet extends MaxObject {

  NeuralNet nnet = null;
  String snet = "C:/Users/jhu/Documents/Development/workspace/XOR/XOR.snet";

  DirectSynapse memInp = null;
  DirectSynapse memOut = null;
  public float inlet_left = 0;
  public float inlet_right = 0;

  public XorNet() {
    declareInlets(new int[]{DataTypes.FLOAT, DataTypes.FLOAT});
    declareOutlets(new int[]{DataTypes.FLOAT});
  private void initNet(){
    NeuralNetLoader netLoader = new NeuralNetLoader(snet);
    nnet = netLoader.getNeuralNet();

    Layer input = nnet.getInputLayer();
    memInp = new DirectSynapse();

    Layer output = nnet.getOutputLayer();
    memOut = new DirectSynapse();


  public void inlet(float f){
    int inlet_no = getInlet();
    if(inlet_no == 0) 
      inlet_left = f;
      inlet_right = f;
  public void bang(){
    Pattern iPattern = new Pattern(new double[]{inlet_left, inlet_right});
    Pattern oPattern = memOut.fwdGet();
    outlet(0, oPattern.getArray()[0]);

4. Q&A

4.1. What is "learning rate"? what is "momentum" in JOONE?

The learning rate represents the 'speed' of the virtual point (the blue ball in the above figure) along the error surface, and the momentum represents the 'inertia' of that point. The Joone Complete Guide has more detailed illustrative explanation in page 69.


4.2. What is this "sigmoid" mentioned here and there?

Did I tell you that you should read The Joone Complete Guide? or do you know our best friend wikipedia?

Alright, the answer (copied from wikipedia):



4.3. What is RMSE? is it the same as the cost function that Rene mentioned?

Well, read it here.

4.4. I really want to know what backpropagation is !

Very good! Does the word "backward" in the following picture ring a bell?


No? then I can't help that much. Then you really need to spend some time on The Joone Complete Guide or the book Introduction to Neural Networks with Java.

  1. the transfer function, or genius, or goal, or glad, or gorgeous, or glory, but definitely not garbage (1)

JunHu: MaxJavaArduino (last edited 2011-08-30 18:14:49 by dyn-176109)