Arduino+ Quartz Composer

Hello everyone! Im very interested in getting my Arduino board to work with Quartz composer. Similar to how Maxuino works with Max/msp. Any and all information would be greatly appreciated! Thanks in advance.

http://www.vidvox.com/phpBB2/viewtopic.php?p=8452#8452

The monome uses opensource programs to convert the serial data to OSC data.

I'm not sure if the serial data is formated the same on the monome as it is on the arduino... or if the monomeserial app is set specifically to handle only the inputs/outputs of the monome device... but it should work just fine with a little modification to the source.

http://wiki.monome.org/view/MonomeSerial-2

Hello

Quartz composer is not so great in terms of inputs and has practically no outputs (apart from the screen)

You can use a midi interface and connect arduino to it, QC will read midi notes... you can hack a mouse or a keyboard and use arduino to simulate key presses..

to send data to arduino there are not many options, I've just made a QC to DMX interface but it's not super fast.

The other option is to learn how to program with Objective C and build a wrapper around the QC engine, with this you can interface it to anything

massimo

Thanks for the reply Massimo! Could you please describe an example setup using a commercial MIDI controller hardware with the quartz composer which tells the arduino to move motors around+dim lights based on midi CC info)? Thanx in advance ;) p.s. I am a big fan of yours and Tom Igoe and all else who have contributed to Arduino+the open source physical computing movement :)

thanks for the kind words :)

Your question is not in line with the Arduino spirit.... ;) You should be the one who figures that out, we can help u along the way.

We dont do your job for you for free but if you really need that done you can hire us

massimo

hi

I have to second what Massimo says, the community is here to help, not to do the work.... that's for you to do. Hopefully you will also publish your results in the Arduino Playground, so everyone can benefit :)

D

i never asked anyone to do the work for me. I was simply wondering about how to make the arduino "talk" to quartz composer. ::)

How exactly do you want the arduino to "talk" to quartz?

If you want to send data to quartz you need to make/use a midi driver for the USB arduino that will translate the serial data into midi messages.

You can also just add a midi port to the arduino and buy a hardware midi->USB interface for your computer....

If you want to send data to your arduino you need to make a wrapper for your qc app. I'm sure there are OSC/MIDI/Serial examples with xTools... You'll just have to modify them and jam your qc object in there.

I want to use USB Arduino (ATmega 168) board as a simple MIDI-USB interface.

May be this posible?

If I use a "keyboard 5pin DIN cord" conected to 2 of the arduino pins (MIDI only uses 2 of 5 pins of the conector), MIDI IN in one pin-wire and MIDI OUT in the other?

What else I need to consider?

I hope somebody can help me.

Thanks a lot.

I want to use USB Arduino (ATmega 168) board as a simple MIDI-USB interface.

If I use a "keyboard 5pin DIN cord" conected to 2 of the arduino pins (MIDI only uses 2 of 5 pins of the conector), MIDI IN in one pin-wire and MIDI OUT in the other?

Your understanding is wrong, 1 cable for Midi In , another cable for Midi Out. There are some tutorials and projects in the Arduino Playground specific to midi that should help. http://www.arduino.cc/playground/Learning/Tutorials Scroll down till you see the Midi heading.

Hello, my first post - I am quite new to Arduino, but it seems promising. The problem I think is the biggest that sending the values from one software to another are not so easy (IMHO Flash, QC, even MaxMSP are all a bit quirky to set up). Here is one workflow.

I don't think this question has been answered thoroughly, so I try to give in my 2ยข:

My solution to the problem of sending arduino data to Quartz Composer on Os X Tiger goes as follows:

Arduino > Processing > Quartz Composer

So Arduino and Processing communicate via Serial and Processing and Quartz Composer communicate via Midi (serial values are converted to midi cc values)

I did install mmj Midi for Java, but I'm not sure you need that (http://www.humatic.de/htools/mmj.htm) ? but you will need the rwmidi Library for Processing from http://ruinwesen.com/blog?id=95 I also tried sending midi out from Arduino using Tubedogg's midi-controller script, http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1165833586 but I assume it requires a midi hardware node, and I wanted to create a workflow which wouldn't need any extra external hardware. Well, that might work as well, this is just an alternative way to do things.

I have tried this to send analog sensor values and ultrasonic sensor (SRF02) values (centimeters). The difficult part was to get many sensors sending data until I realized you can have only one println() command and stich your data with a comma or similar character. Here is the part of my code (the loop) that sends the data of two sensors to Serial output (you should modify it if you are sending data out of one or more or using analog sensors)

void loop() { while (true) { SRF02::update(); if (millis() > nextPrint) { Serial.print(srf02[0].read()); Serial.print(","); Serial.print(srf02[1].read()); Serial.println(); // delay (70); nextPrint = millis () + 200; } } }

I am picking it up in Processing using a code mashed up from the Graphing Sketch http://www.arduino.cc/en/Tutorial/Graph and the midi input output sketch from Ruin & Wesen: http://ruinwesen.com/support-files/rwmidi/documentation/sketch1.html

in Processing I just use a map function (http://processing.org/reference/map_.html) to modify the range of the sensor values to midi values and post that value (convert from float to int first) to Midi. This code also graphs the values of the two sensors in Processing, a nice feature but you can get rid of it if you want.

I am not a very good programmer at syntax level, so some of this code could be done more nicely (especially when using many sensors). Anyway, here is the complete Processing code for 2 sensors. Notice I was using Serial port 38400 in order to be able to send data from many sensors more quickly (I should probably calculate if that is really needed.)

// Graphing sketch

// This program takes ASCII-encoded strings // from the serial port at 9600 baud and graphs them. It expects values in the // range 0 to 1023, followed by a newline, or newline and carriage return

// Created 20 Apr 2005 // Updated 18 Jan 2008 // by Tom Igoe

// midi added by tomtom

import rwmidi.*;

import processing.serial.*;

MidiInput input; MidiOutput output;

Serial myPort; // The serial port int xPos = 1; // horizontal position of the graph

// important - change this according to the space where the sensor is used, since the sensor outputs centimeters! // if using analog sensor the max value would be 1023 float sensormax = 592; // max value from the sensor

void setup () { input = RWMidi.getInputDevices()[0].createInput(this); output = RWMidi.getOutputDevices()[0].createOutput(); // set the window size: size(400, 300);

// List all the available serial ports println(Serial.list()); // I know that the first port in the serial list on my mac // is always my Arduino, so I open Serial.list()[0]. // Open whatever port is the one you're using. myPort = new Serial(this, Serial.list()[0], 38400); // don't generate a serialEvent() unless you get a newline character: myPort.bufferUntil('\n'); // set inital background: background(0); } void draw () { // everything happens in the serialEvent() }

void serialEvent (Serial myPort) { // get the ASCII string: String myString = myPort.readString(); // split it in two separated by a comma String[] midilist = split(myString, ','); String inString = midilist[0]; String inString2 = midilist[1];

// String inString = myPort.readStringUntil('\n'); // String inString2 = myPort.readString if (inString != null) { // trim off any whitespace: inString = trim(inString); inString2 = trim(inString2); // println(inString + " "+ inString);

float inByte = float(inString); float inByte2 = float(inString2); // map to midi values

// map to midivalues float inMidi = map(inByte, 0, sensormax, 0, 127); float inMidi2 = map(inByte2, 0, sensormax, 0, 127);

// map to the screen height: inByte = map(inByte, 0, sensormax, 0, height); inByte2 = map(inByte2, 0, sensormax, 0, height);

// convert midi floats to int int intMidi = int(inMidi); int intMidi2 = int(inMidi2);

// draw the line: stroke(127,34,255,70); line(xPos, height, xPos, height - inByte); stroke(22,234,13,70); line(xPos, height, xPos, height - inByte2);

//send midi

//(channel (0= midi channel 1), controller (1= midi controller 1), value) int midicc = output.sendController(0, 1, intMidi); int midicc2 = output.sendController(0, 2, intMidi2); // at the edge of the screen, go back to the beginning: if (xPos >= width) { xPos = 0; background(0); } else { // increment the horizontal position: xPos++; } } }

You might not need this workflow anymore since Leopard QC talks OSC and Kineme has published a (beta?) Serial plugin for QC. But just in case you need to send midi (notes or cc) this could come in handy as well.

There is a site:- http://kineme.net/ That has a serial input / output patch you can use to communicate to the Arduino with.

You need to sign up (free) and look in the beta releases for it, but it is a great way to integrate an arduino.

Other input / outputs from Quartz are MIDI & OSC (as mentioned before) as well as HID from a USB device.