1. Upload Standard Firmata to Arduino 2. Processing code
import processing.serial.*; import oscP5.*; import netP5.*; import cc.arduino.*; Serial port; // Create object from Serial class OscP5 oscP5; NetAddress myRemoteLocation; Arduino arduino; // Serial Variables String buff = "", temp = " "; int NEWLINE = 10, temporary, counter; int analog0; int lineHeight = 25; void setup() { frameRate(24); size(1440, 980); oscP5 = new OscP5(this,57120); myRemoteLocation = new NetAddress("127.0.0.1",57121); println(Arduino.list()); arduino = new Arduino(this, Arduino.list()[0], 57600); arduino = new Arduino(this, "/dev/tty.usbmodemfa131", 57600); for (int i = 0; i <= 13; i++) arduino.pinMode(i, Arduino.INPUT); } void draw() { sendOSC(); fill(0,10); rect(0,0,1440,980); fill(255); ellipse(width/2, height/2, arduino.analogRead(0), arduino.analogRead(1)); } void sendOSC() { OscMessage an = new OscMessage("analog0"); an.add(arduino.analogRead(0)); oscP5.send(an, myRemoteLocation); }
3. SuperCollider code
OSCFunc.trace(true) p = Platform.resourceDir +/+ "sounds/a11wlk01.wav"; b = Buffer.read(s, p); ( SynthDef(\foubuf, {| out = 0, bufnum = 1, rate = 1, trigger = 1, loop = 1, pos = 0, level = 1| Out.ar(out, Pan2.ar( PlayBuf.ar(1, bufnum, rate, trigger, 0, loop ), pos, level ) ) }).send(s); ) x = Synth(\foubuf); //:OSC Responders OSCresponder(nil, "analog0", { |t, r, msg| x.set(\rate, 0.01*msg[1]);}).add;//Responder x.set(\bufnum, 1) x.set(\loop, 0) x.set(\level, 0.3) x.set(\pos, -1)
Links