sending OSC on the same computer without wifi connection

edited January 2015 in Library Questions

Hi, i send OSC messages both ways using P5 and SuperCollider on the same computer. Just noticed when wifi is off OSC communication stops. Why i need wifi for this and how to keep communication without it?

Answers

  • are you using the loopback address 127.0.0.1?

  • edited January 2015

    yes! what to do?

  • need to sort it asap,please help!

  • Hi, the following works for me, please read the comments

    // tested on osx 10.9 (wifi turned off), Processing 2.2.1, oscP5 2.0.2
    import oscP5.*;
    import netP5.*;
    
    OscP5 osc;
    NetAddress receiver;
    
    void setup() {
      size( 400 , 400 ); 
      osc = new OscP5( this,12000 );
      receiver = new NetAddress( "127.0.0.1" , 57120 ); // supercollider default port
    }
    
    void draw() {
      if(frameCount%10==0) {
        // send an OSC message to supercollder
        osc.send( receiver , "/freq" , random( 100,400 ));
      }
    }
    
    void oscEvent(OscMessage m) {
      // prints '127.0.0.1:57120 | pong i' into the console (sent from sc)
      println(m, millis());
    }
    
    /*
    
    // Supercollider code (SuperCollider version 3.6)
    // select 'Boot Server' from the menu-bar (under Language) to make sure server is running
    // boot the server
    s.boot;
    
    // set remote address 
    n = NetAddr("127.0.0.1", 12000);
    
    // create a SynthDef which we will control via OSC
    SynthDef(\ping, {|freq= 800| Out.ar(0, Line.kr(0.5, 0, 1.2, doneAction:2)*SinOsc.ar(freq))}).send(s);
    
    // create an OSC listener for address pattern /freq listens at default port 57120
    OSCFunc({|msg|
      Synth(\ping, [\freq, msg[1]]);"ping".postln;n.sendMsg("\pong",1);
    }, '/freq');
    
    
    */
    
Sign In or Register to comment.