Giter VIP home page Giter VIP logo

oscp5's People

Contributors

sojamo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

oscp5's Issues

There is indaction that this is published to Maven but it doesn't seem to be

It would be helpful to have this package in Maven to include as my project as a dependency. I can find this listed in maven however when I try to get Maven to download dependent packages it can't seem to find this one. I dug in a bit further, though there is a Maven page for this project I can't seem to find this dependency hosted anywhere on internet. It would be much appreciated if you could republish the Maven package for people to use in their projects.
Thanks

timetag format

Hi, I am not getting proper timetag with OSC bundle. Sender timetag differs to recieved timetag() extracted from OSC message.

Minimal code example:

import oscP5.*;
import netP5.*;

OscP5 oscP5;
NetAddress myRemoteLocation;

void setup() {
  size(400, 400);
  frameRate(60);
  oscP5 = new OscP5(this, 12000);
  myRemoteLocation = new NetAddress("127.0.0.1", 12000);
}


void draw() {
  background(0);
}


void mousePressed() {
  OscBundle myBundle = new OscBundle();
  OscMessage myMessage = new OscMessage("/test");
  myMessage.add("abc");
  myBundle.add(myMessage);

  long ts = System.currentTimeMillis();
  println("timetag send: "+  setTimetag(ts)+" millis: "+ts);
  myBundle.setTimetag( System.currentTimeMillis() );
  oscP5.send(myBundle, myRemoteLocation);
}



// incoming osc message are forwarded to the oscEvent method.
void oscEvent(OscMessage theOscMessage) {
  println("timetag recieved : "+ theOscMessage.timetag()  );
}

long setTimetag(long theTime) {
  final long secsSince1900 = theTime / 1000;
  final long secsFractional = ((theTime % 1000) << 32) / 1000;
  long l = (secsSince1900 << 32) | secsFractional;
  return l;
}

This produces:
When creating the OSC message:
timetag: 7231581490502040551 millis: 1683733773069

When the message is recieved:
timetag : -1727627929977226265

Why there is a negative sign? In what format is the timetag? Why is it not the same when setting it?

Can you clarify please? Thanks!

BroadCast macServer windowsClient

I am using the oscP5 library. I want to set a server from my computer(macosx) and I want other computers to connect to my server. Since the ip address is constantly changing I thought it would be better to put the name of my machine instead.

this is the client code :
myBroadcastLocation = new NetAddress("MyName-MacBook-Pro.local", 32000);
I already tested this way between macs and it works perfectly. Now I'm wondering if it also works if the client is windows?

TCP reconnect

I'd like to reconnect a TCP client (in oscP5) to a TCP server (scsynth).
I am unsure how to get there, though I found that there is a reconnect method in TCP server but I don't know

  • how to determine that the connection is lost from within the sourcecode
  • how to get to the TCPClient instance from an oscP5 object instantiated via
oscP5 = new OscP5(this, "127.0.0.1", 57110, OscP5.TCP);

osc.send parameters

Hello,
I'm trying to work with Processing and Pure Data using OSC Protocol . Looking for some examples in "basic" folder I found the osc.send parameters are wrong osc.send( receiver , "/test" , random( 255 ) , random( 255 ) , random( 255 ) ); and the sketch does not run.
In the example sketches on OscP5 website the object osc.send present different parameters oscP5.send(myMessage, myRemoteLocation).
Am I doing something wrong?
Thanks!

Parse bundle wrong data is taken

There is a bug in the method parseBundle() in OscPatcher where you choose the wrong data map. Instead of the one you just split, you take the bundle map:

...
m0.put( "data" , Bytes.copy( bytes , myPosition , myMessageLength ) );
m0.put( "socket-ref" , m.get( "socket-ref" ) );
m0.put( "socket-address" , m.get( "socket-address" ) );
m0.put( "socket-port" , m.get( "socket-port" ) );
m0.put( "local-port" , m.get( "local-port" ) );

messages.add( new OscMessage( m ) );
...

So it should be:

messages.add( new OscMessage( m0 ) );

Took me some hours to notice this bug.
Cheers Florian

Can't find a way to check if OscP5 is actually connected

Hello,
I'm trying to find a way to know if OscP5 managed to connect to the provided listening port (meaning that if the port has already been claimed by another application and I won't receive anything I want to know it).
The lib doesn't output any error in that case and I couldn't find any method/variable containing this information.
Did I miss something or is this feature absent from the lib ?
Thanks

Receiving OSC Bundle does not work as expected

I tried to receive an OSC Bundle but instead of getting an OSC Bundle, I just receive the messages in the bundle. So the method void oscEvent(OscMessage theOscMessage) is called multiple times.

Is there something I am missing?

In a C# OSC library I receive the data like this which is way more intuitive:
image

Cheers Florian

OscArgument

Hello, I try to make a pullrequest but like usual I fail.

My suggestion is add method to the class OscArgument, to manipulate this one easily:

	public Object get() {
		return value;
	}

	public String getTypetag() {
		if(value instanceof Integer) return "i" ;
		else if(value instanceof Float) return "f";
		else if(value instanceof Charracter) return "r";
		else if(value instanceof String) return "S";
		else if(value instanceof Double) return "d";
		else if(value instanceof Long) return "l";
		else if(value instanceof Boolean) return "b";
		else if(value instanceof byte[]) return "byte array or blod value";
		else return "Midi value";
	}

Problem capturing a large number of quick successive messages in oscEvent method on Android

When I try to send many OSC messages at once, it seems the oscEvent method only listens to some of the messages (around anywhere between 20 and 50 out of around 200) so and disregards the rest.

Below there is quick code to test this on Android. When run on a device this will print to the run console all incoming OSC messages. here it is showing only 27 messages captured by the oscEvent method:

27

I am sending 200 messages each with a unique address (loading a preset on a computer, this preset should update all the parameters on the Android device).

Steps to recreate:
1 - Run below code on Android device
2 - Update preset on OSC capable music synthesizer vsti plugin on the computer
Expected result: all addresses and messages caught by oscEvent method and logged in run console.
Actual result: only a fraction of the messages are caught.

Using network sniffing with Wireshark, I can confirm that the source is sending all these messages and Wireshark is picking them up in an orderly fashion:

shark

Quick testing code:

import android.os.StrictMode;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import netP5.NetAddress;
import oscP5.OscMessage;
import oscP5.OscP5;

public class MainActivity extends AppCompatActivity {

    int evenCount = 0;
    OscP5 oscP5;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        oscLink();
    }

    void oscLink(){
        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);

        oscP5 = new OscP5(this,9000);
    }

    public void oscEvent(OscMessage theOscMessage) {

        evenCount = evenCount + 1;

        System.out.println(" addrpattern: " + theOscMessage.addrPattern());
        System.out.println(" typetag: " + theOscMessage.typetag());
        System.out.println(" msg: " + theOscMessage.get(0).intValue());

        System.out.println(evenCount);
    }
}

limit for OSC message

Hello,
I try to send message, but I found a different limit for each type of argument.
That's depend of my computer or it's a limit of the OSC ? It(s possible to increase this limit ?
Or don't stop Processing and just limit the the size of the package must be sent and print a warning to inform the user ?

and thx for your work.

Processing 3.3.4 OS Sierra Osc 2.0.4

String limit 1524 java.lang.ArrayIndexOutOfBoundsException

Array float limit 1842 Could not send datagram java.net.SocketException: Message too long

Array int limit 306 java.lang.ArrayIndexOutOfBoundsException

Boolean limit 9207 Could not send datagram java.net.SocketException: Message too long

Here the little sketch I code to find the limit.

import oscP5.*;
import netP5.*;

OscP5 oscP5;
NetAddress myRemoteLocation;
// OscP5 osc_receive_controller ;

void setup() {
  size(400,400);
  /* start oscP5, listening for incoming messages at port 12000 */
  int port = 10_000 ;
  oscP5 = new OscP5(this,port);
  myRemoteLocation = new NetAddress("127.0.0.1",port);
}


void draw() {
  background(0);
  send() ;
}



int count_send = 0 ;
String string_limit = ("");
void send() {
  count_send++ ;
  
  OscMessage myMessage = new OscMessage("test");
  /*
  string_limit = string_limit + "a" ;
  myMessage.add(string_limit); // add an int to the osc message
  println("String limit", string_limit.length()) ;
  */


  boolean [] bool_limit = new boolean[count_send];
  for(int i = 0 ; i < bool_limit.length ; i++) {
    bool_limit[i] = true ;
    myMessage.add(bool_limit[i]); // add an int to the osc message
  }
  
  println("Boolean limit", bool_limit.length);
  
  
  /*
  int [] array_int = new int[count_send] ;
  for(int i = 0 ; i < count_send ; i++) {
    // array_int[i] = floor(random(MAX_INT)) ;
    array_int[i] = i ;
  }
  myMessage.add(array_int); // add an int to the osc message
  println("Array int limit", array_int.length) ;
  */
  

  /* 
  float [] array_float = new float[count_send] ;
  for(int i = 0 ; i < count_send ; i++) {
    // array_int[i] = floor(random(MAX_INT)) ;
    array_float[i] = i ;
  }
  myMessage.add(array_float); // add an int to the osc message
  println("Array float limit", array_float.length) ;
  */
 
  
  /*
  myMessage.add(123); // add an int to the osc message
  myMessage.add(12.34); // add a float to the osc message
  myMessage.add("some text"); // add a string to the osc message
  myMessage.add(new byte[] {0x00, 0x01, 0x10, 0x20}); // add a byte blob to the osc message
  myMessage.add(new int[] {1,2,3,4}); // add an int array to the osc message
  */

  /* send the message */
  oscP5.send(myMessage, myRemoteLocation); 
}

multiple apps listening on the same UDP port

Hello, thank you for this great library.

I have the case where 2 processing applications running on the same computer need to receive messages on the same UDP port.

In my test with current version only the first application launched receives the messages.

In other cases using an artnet library in processing I was able to receive UDP messages on the same port. It might relate to an option to "reuse" the socket address. I think that the artnet library does it in this point:
https://github.com/cansik/artnet4j/blob/c923f4bd01e89d8912515d38407f6a875944f04a/src/main/java/ch/bildspur/artnet/ArtNetServer.java#L170

Is there a similar option in ocsP5?

Thank you
Marco

feature request: decoding an OscMessage from a byte[]

Hi,

First off, thank you for sharing this awesome library!

I was wondering if it's possible to construct an OscMessage from a byte[] (essentially decode a byte[] of valid OSC bytes for a message). I haven't found anything in the library yet.
Would it be possible to have an extra constructor or a static method that takes in a byte[] and returns the decoded OscMessage ?

At the moment my workaround is to create an OscP5 instance and a NetAddress instance using the same port to flush the byte[] to the same sketch so it gets decoded into an OscMessage. It works, but I'm hoping there's a simpler/more elegant way ?

Thank you very much,
George

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.