Processing

 Getting started with Processing

Cross-platform: Use OpenSoundControl objects

OSX only: Option to use muiojni (muio to java native interface) or the extending muioBoard classes for direct fast communication without a server. jump there.

 

Using OpenSoundControl
Requirements:-
- Processing 1.0 and beyond processing.org
- oscP5 library installed www.sojamo.de/libraries/oscP5/
- downloaded processing OSC code (at end of the page, here)

Installation:-
Currently you do not install the muo.pde file anywhere central (unlike the oscp5 library) but you ensure that muio.pde is in the same folder as your Processing file.

Opening your file will open then muio.pde in a tab.  muio.pde is LOCKED so you can't edit it.

tabbed muio.pde


Using:-
Remember to start the muioOSCserver.

The following code snips are from "muioOSC_example.pde"

You need to import the OSC libraries

import oscP5.*;
import netP5.*;


and declare a muio object

// global references for the muio and oscP5
muioOSC muio;


You need to tell the muio object how your muio is configured when you initialise the object...

  String[] init_Muio_With_these_modules = {"/adc0", "/adc1", "/adc2","/adc3", "/port1"};
  initMuio(init_Muio_With_these_modules);


The above example has 2 added extra ADC ports ("/adc2" and "/adc3") to the normal muio 8by16 configuration

The muio will now start receiving and parsing muio OSC messages.

You use the muio.queryInput(string port, int input number) method to retrieve the current stored data on an input.

e.g.
To save the value for /adc0,2 to x....
x = muio.queryInput("/adc0", 2);

NB. if you access "/port1" or a similar DIO port (i.e. "/port0" or ports a to g) then the input value represents the bit input of the port (0 to 7)
 

 

Direct on OSX using muiojni

Requirements:-
- Processing 1.0 and beyond processing.org
- downloaded processing muiojni code (at end of the page, here)


Installation:-

This is not a library (beta release) so no installation needed, BUT the jar and dylib are inside projectfolder/code.

Using:-

muioBoard object extends muiojni
================
public variables:-
  int adc0[4]                           = array of the most recent adc0 inputs
  int adc1[4]                           = array for adc1 inputs
  int port1                               = integer for port1 input
  bool  fConnected                 = flag showing if muio connected or not
 
public methods:-
  int getPort1Input(int input)   = returns the bit input (0 or 1)
 
 
 ------

class: muiojni
================
methods:
int[] readADCPort(String portname)                   : returns an array of 4 ints -- all the 4 inputs on the adc
int   readADCPortInput(String portname, int input)   : returns a single input on the adc port

int   readDIOPort(String portname)                   : returns a single int that represents the whole port value
int   readDIOPortInput(String portname, int input)   : returns a single int (0 or 1) that represents the input pin's state

String sendCmd(String muioCommand);                  : sends a raw muio command as a String, returns unparsed reply.

CAVEATS:
There is no error checking. if the muio browns out and causes the muio code to reply with an error message, then you might
get an "array out of bounds error".  Please log what you did to make this happen and tell me!
 

Processing examples and objects

Title Post date Release Notes Download
Processing via OSC 12/10/2009 Objects and examples that receive from the muioOSCservers. This is cross platform. Needs oscP5 library installed.

processing_osc_muio_v0_3.zip

muiojni - direct to processing 06/11/2009 Beta 0_1. Access muio via muiojni object directly, no OSC. Not a library, but jar and dylib held in project/code folder. OSX intel only.

processing_muiojni_OSX_b0_1.zip

muioBoard object and example 10/11/2009 An extension to the muiojni object that creates a muiboard, this is the step before a library object. Also includes some basic validation and filtering of the received data

processing_muioboard_OSX_b0_1.zip