added minimal working example mwe for visuals sc link
parent
88e2630c90
commit
6e13e44eca
|
@ -30,17 +30,23 @@ Pdef(\processing, Pfunc { ~host.sendMsg("/sc3p5", rrand(1,256).asFloat);}).play(
|
|||
|
||||
https://sc-users.bham.ac.narkive.com/75iSw2f6/sending-osc-commands-instead-of-trigger-synths-with-patterns
|
||||
|
||||
n=NetAddr("127.0.0.1", 47120);
|
||||
{50.do {n.sendMsg("/test",200.rand,200.rand);0.2.wait;}}.fork;
|
||||
|
||||
(
|
||||
|
||||
Event.addEventType(\processingOSC, { | server |
|
||||
var processingOscServer = NetAddr("127.0.0.1", 4859);
|
||||
var processingOscServer = NetAddr("127.0.0.1", 47120);
|
||||
var notes = [~midinote.value, ~ctranspose.value, ~velocity.value,
|
||||
~sustain.value, ~lag.value, ~timingOffset.value].flop;
|
||||
|
||||
var bndl;
|
||||
var timeNoteOn, timeNoteOff;
|
||||
|
||||
processingOscServer.sendMsg("/sc3p5", rrand(1,256).asFloat);
|
||||
//processingOscServer.sendMsg("/test",200.rand,200.rand);
|
||||
processingOscServer.sendMsg("/sc3p5",200.rand, 200.rand);
|
||||
processingOscServer.sendMsg("/col", 255.rand);
|
||||
|
||||
|
||||
notes.do {|note|
|
||||
processingOscServer.sendMsg("/sc3p5", rrand(1,256).asFloat);
|
||||
|
@ -57,15 +63,14 @@ Event.addEventType(\processingOSC, { | server |
|
|||
});
|
||||
)
|
||||
|
||||
|
||||
(
|
||||
Pbind(*[
|
||||
type: \processingOSC,
|
||||
legato: Pgauss(0.2,0.05,inf),
|
||||
dur: 0.2,
|
||||
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;
|
||||
]).play(quant: 4);
|
||||
)
|
||||
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
import oscP5.*;
|
||||
import netP5.*;
|
||||
|
||||
OscP5 oscP5;
|
||||
NetAddress myRemoteLocation;
|
||||
int x1,x2,fil;
|
||||
void setup() {
|
||||
fullScreen();
|
||||
//size(400,400);
|
||||
frameRate(8);
|
||||
/* start oscP5, listening for incoming messages at port 12000 */
|
||||
oscP5 = new OscP5(this,47120);
|
||||
|
||||
myRemoteLocation = new NetAddress("127.0.0.1",47120);
|
||||
//sc3p5
|
||||
oscP5.plug(this,"sc3p5","/sc3p5");
|
||||
oscP5.plug(this,"test","/test");
|
||||
oscP5.plug(this,"col","/col");
|
||||
}
|
||||
|
||||
void sc3p5(int theA, int theB) {
|
||||
println("### plug event method. received a message /test.");
|
||||
println(" 2 ints received: "+theA+", "+theB);
|
||||
x1= theA;
|
||||
x2= theB;
|
||||
}
|
||||
|
||||
void col(int theC) {
|
||||
fil= theC;
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
ellipse(fil,10,10,10);
|
||||
rect(random(0,width),random(0,height),50+x1,50+x2);
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
SynthDef(\pulse,{
|
||||
var sig, chain, onsets;
|
||||
sig = SinOsc.ar(Rand(220.0,440.0))
|
||||
*EnvGen.ar(Env.perc(releaseTime:0.5),Dust.ar(0.5))*0.7;
|
||||
Out.ar(0,sig !2);
|
||||
//
|
||||
chain = FFT({LocalBuf(512, 1)}, sig);
|
||||
onsets = Onsets.kr(chain,0.1,\power);
|
||||
SendTrig.kr(onsets);
|
||||
SendPeakRMS.kr(sig, 20, 3, "/replyAddress");
|
||||
}).add;
|
||||
Synth(\pulse)
|
||||
|
||||
~host = NetAddr("localhost", 4859); // address de PROCESSING
|
||||
|
||||
|
||||
o = OSCFunc({ arg msg, time;
|
||||
[time, msg].postln;
|
||||
~host.sendMsg("/trigger",42,12.34,"hello processing");
|
||||
},'/tr', s.addr);
|
||||
|
||||
p = OSCFunc({ |msg|
|
||||
"peak: %, rms: %".format(msg[3], msg[4]).postln
|
||||
}, '/replyAddress');
|
Loading…
Reference in New Issue