Forum

OSC Bundles

Hello,
I read here:

that the latest version supports OSC bundling.

I tried a test generating bundles from within a simple java app, but am having trouble figuring out how the OSCDecoder parses them into spreads, and how I can access them.

Do I use some sort of spread extraction?

ty,
sv

import com.illposed.osc.;
import java.net.
;

public class OSC2pb1

{
private static OSCPortOut oscPort;

static int port = 9000;
static String address = "/OSC1";

public static void main( String[]() commandline ) throws Exception

{

    System.out.println( "OSC pb Sample Started." ); 
    System.out.println( "Creating OSCPort to local host" );

    oscPort = new OSCPortOut( InetAddress.getLocalHost(), port );
    for (int i = 0; i < 1000; i++) {
        testBundle(i);          
    }   
    System.out.println( "End of OSC sample" );
          

}

public static void testBundle(float param) throws Exception {
    Object args[]() = new Object[2](2);
    OSCPacket mesgs[]() = new OSCPacket[2](2);
    
    args[0](0) = new Integer(1);
    args[1](1) = new Float(param);
    OSCMessage mesg = new OSCMessage(address, args);
    mesgs[0](0) = mesg;
    
    Object args2[]() = new Object[2](2);
    args2[0](0) = new Integer(2);
    args2[1](1) = new Float(param*2);
    OSCMessage mesg2 = new OSCMessage(address, args2);  
    mesgs[1](1) = mesg2;
    
    OSCBundle bundle = new OSCBundle(mesgs);
    oscPort.send(bundle);
}

}

mhh but do you receive a spread at all? if you hover the mouse over the outlet of the osc decoder you shoud see a number in brackets. this number indicates how many slices the spread contains.

if there is such a number it should be the same as the number of bundles you receive. there are different ways to extract slices of a spread. try the nodes: stallone, getslice, vector (Split)

you can also see the slices if you connect a iobox to the outlet. then click on the iobox and press ctrl-i. this opens the inspector where you can see all the slices of the spread.

Thanks for the info.
ah…ok…so Stallone, getslice, vector (Split) need to be string types to extract the slices, and then convert to original format?

Thanks for the help,
sv

ahh, this is just because the osc decoder delivers strings and not values.

convert the datatype to floats with the node “as Value” then use the nodes
stallone (spreads), getslice (spreads), vector (Split)

note that the (spreads) means that they work with floats.

there is also a node “stallone (string)” and “getslice (string)”
if you you use those, you can connect them directly to your oscdecoder without converting the strings to values…

you can convert it first to values and use then for example stallone (spreads)
or you can use stallone (string) direct with the decoder node and use "as value afterwards) of course you have to use that as value for each outlet of the stallone. the first version needs just one “as value” because it converts the WHOLE spread to values. depends what you like to do…

there are many nodes with the same function for different datatypes… for example there is a getslice (Spreads), getslice (String), getslice (Node), getslice (Color)

read about the datatypes here:
Pins and Data Types

oki doki…all makes sense now.
Could I suggest that your explanation be added to the OSCDecoder help…it was exactly what I needed to er…decode…my problem:-)

Tested both ways with a single OSC message packet with 2 params, both methods work fine.

I think I’ll leave the bundles and just go with single message formats + multi params.

Thanks again for the help [domo arigatou gozaimasu + deep bows](domo arigatou gozaimasu + deep bows),
sv

mhh maybe there should be a page in the documentation converting between different datatypes, because this is needed quite often. its not a specific osc problem hmm, maybe the osc helppage should just give the the hint that the decoder delivers strings…

if my english would be better and im not that lazy i could do a small tutorial ;) …

btw, what kind of data you transfer to vvvv with that java script?

I’m doing some prototyping for audiovisual performances with audio,gesture, and biofeedback interfaces. Still tossing up whether to use midi and/or osc, but I’ll decide which is better as I get further into it.