From 1274cc4e0dba2cb6673a39c4df64414ccb27f94d Mon Sep 17 00:00:00 2001 From: Rob Canning Date: Fri, 20 Jan 2023 13:22:57 +0100 Subject: [PATCH] new processing example --- motherMIDISetup.scd | 38 ++++++++++++++++++++++---------------- visuals/mwe01/mwe01.pde | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 16 deletions(-) create mode 100644 visuals/mwe01/mwe01.pde diff --git a/motherMIDISetup.scd b/motherMIDISetup.scd index b8b7d0f..d60e4cd 100644 --- a/motherMIDISetup.scd +++ b/motherMIDISetup.scd @@ -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; + + + + diff --git a/visuals/mwe01/mwe01.pde b/visuals/mwe01/mwe01.pde new file mode 100644 index 0000000..c428909 --- /dev/null +++ b/visuals/mwe01/mwe01.pde @@ -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); +}