new processing example
parent
8e3e1bfda0
commit
1274cc4e0d
|
@ -36,7 +36,8 @@ https://sc-users.bham.ac.narkive.com/75iSw2f6/sending-osc-commands-instead-of-tr
|
|||
(
|
||||
|
||||
Event.addEventType(\processingOSC, { | server |
|
||||
var processingOscServer = NetAddr("127.0.0.1", 47120);
|
||||
var processingOscServer = NetAddr("192.168.178.166", 47120);
|
||||
//var processingOscServer = NetAddr("127.0.0.1", 47120);
|
||||
var notes = [~midinote.value, ~ctranspose.value, ~velocity.value,
|
||||
~sustain.value, ~lag.value, ~timingOffset.value].flop;
|
||||
|
||||
|
@ -44,12 +45,12 @@ Event.addEventType(\processingOSC, { | server |
|
|||
var timeNoteOn, timeNoteOff;
|
||||
|
||||
//processingOscServer.sendMsg("/test",200.rand,200.rand);
|
||||
processingOscServer.sendMsg("/sc3p5",200.rand, 200.rand);
|
||||
processingOscServer.sendMsg("/col", 255.rand);
|
||||
|
||||
|
||||
//processingOscServer.sendMsg("/sc3p5",200.rand, 200.rand);
|
||||
// n.sendMsg("/sc3p5", i.asFloat); // send OSC message to P5
|
||||
notes.do {|note|
|
||||
processingOscServer.sendMsg("/sc3p5", rrand(1,256).asFloat);
|
||||
processingOscServer.sendMsg("/mother1", 1920.rand);
|
||||
processingOscServer.sendMsg("/mother2", 1080.rand);
|
||||
//processingOscServer.sendMsg("/sc3p5", rrand(1,256).asFloat);
|
||||
|
||||
// sustain and timingOffset are in beats, lag is in seconds
|
||||
//timeNoteOn = (thisThread.clock.tempo.reciprocal*note[5])+note[4];
|
||||
|
@ -63,14 +64,19 @@ Event.addEventType(\processingOSC, { | server |
|
|||
});
|
||||
)
|
||||
|
||||
(
|
||||
Pbind(*[
|
||||
type: \processingOSC,
|
||||
legato: Pgauss(0.2,0.05,inf),
|
||||
dur: 1/8,
|
||||
degree: [2,5,12],
|
||||
ctranspose: Pseq([0,0,0,0,4,4,4,4,5,5,5,5],inf),
|
||||
velocity: Pgauss(64,10,inf),
|
||||
]).play(quant: 4);
|
||||
)
|
||||
( Pdef(\processingA, Pbind(*[ type: \processingOSC,
|
||||
dur: 1/8, degree: [2,5,12], ]); ))
|
||||
|
||||
( Pdef(\processingB, Pbind(*[ type: \processingOSC,
|
||||
dur: 1/8, degree: [2,5,12], ]); ))
|
||||
|
||||
|
||||
Pdef(\processingA).play(quant: 4); // TOP MOTHER
|
||||
Pdef(\processingA).stop;
|
||||
Pdef(\processingB).play(quant: 4); // TOP MOTHER
|
||||
Pdef(\processingB).stop;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
import oscP5.*;
|
||||
import netP5.*;
|
||||
OscP5 oscP5;
|
||||
|
||||
float x; // global variable
|
||||
|
||||
void setup() {
|
||||
size(400, 300);
|
||||
frameRate(24);
|
||||
background(0);
|
||||
smooth();
|
||||
|
||||
OscProperties properties = new OscProperties();
|
||||
properties.setListeningPort(47120); // osc receive port (from sc)
|
||||
oscP5 = new OscP5(this, properties);
|
||||
}
|
||||
|
||||
void oscEvent(OscMessage msg) {
|
||||
if (msg.checkAddrPattern("/sc3p5")) {
|
||||
x = msg.get(0).floatValue(); // receive floats from sc
|
||||
}
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(x, x, x);
|
||||
println("POST: ", x);
|
||||
// draw rect
|
||||
stroke(256-x/2, 256-x*abs(sin(x)), 256-x/4);
|
||||
strokeWeight(4);
|
||||
fill(256-x/2, 256-x, 256-x*abs(sin(x)));
|
||||
translate(width/2, height/2);
|
||||
rotate(x%64);
|
||||
rect(x%64, x%64, x*abs(sin(x))%128, x*abs(sin(x))%128, 6);
|
||||
}
|
Loading…
Reference in New Issue