Loading...
Logo
Processing Forum
Hello all,

I am trying to make an Ndef to communicate with processing..
In SC I have something like:

Ndef(\test).play;


Ndef(\test, {
var freq_1, amp_1, etc

freq_1 =  Array.fill(8, {
LFDNoise3.ar(0.01).range(400.0, 800.0)
});

      amp_1 = ......

How can possessing read from freq_1 and change the size of a circle for example??

Best,
i


Replies(3)

Copy code
  1. //--supercollider code:
  2. (
  3. Ndef(\test).play;
  4. Ndef(\test, {
  5.   var freq_1;
  6.   freq_1 =  Array.fill(8, {
  7.     LFDNoise3.ar(1).exprange(400.0, 800.0);  //x positions
  8.   });
  9.   SendReply.ar(Impulse.ar(60), '/freqLFOs', freq_1);  //60 is updaterate (fps)
  10.   Splay.ar((SinOsc.ar(freq_1, 0, 0.1)));
  11. });
  12. n= NetAddr("127.0.0.1", 9876);  //for sending to processing
  13. OSCFunc({|msg|
  14.   //msg.postln;  //debug
  15.   n.sendMsg(*msg);
  16. }, '/freqLFOs');
  17. )


Copy code
  1. import oscP5.*;
  2. OscP5 oscP5; 
  3. float[] freqs= new float[8];
  4. void setup() {
  5.   size(800, 600, P2D);
  6.   frameRate(60);
  7.   oscP5= new OscP5(this, "127.0.0.1", 57120, 9876, "oscEvent");
  8. }
  9. void draw() {
  10.   background(0);
  11.   for (int i= 0; i<8; i++) {
  12.     ellipse(freqs[i], (i*(height/8))+30, 30, 40);
  13.   }
  14. }
  15. void oscEvent(OscMessage oscIn) {
  16.   if (oscIn.checkAddrPattern("/freqLFOs")) {
  17.     if (oscIn.checkTypetag("iiffffffff")) {
  18.       for (int i= 0; i<8; i++) {
  19.         freqs[i]= oscIn.get(i+2).floatValue();
  20.       }
  21.     }
  22.   }
  23. }

wow great example!
I will work on it!!

Thank you!

Best,
i