Forum

OSC patch help

Hello, i have found this code:

import ddf.minim.*;

AudioInput in;
import oscP5.;
import netP5.
;

OscP5 oscP5;
NetAddress myRemoteLocation;

void setup()
{
size(10, 50);
frameRate(30);
oscP5 = new OscP5(this,12000);
myRemoteLocation = new NetAddress(“127.0.0.1”,7110);
Minim.start(this);
in = Minim.getLineIn(Minim.STEREO, 512);
}
float t = 0;

void draw()
{
background(0);
float level = constrain(in.left.level(), 0, 1);
rect(0, 0, width, heightlevel);
sendBoneMsg(“level”, level);
sendBoneMsg(“level_inverz”, 1-level);
sendBoneMsg(“level_random”, random(level));
t+=level;
sendBoneMsg(“level_pulse”, 0.5 + sin(t
0.1)/2.);
}

void sendBoneMsg(String name, float n) {
OscMessage myMessage = new OscMessage("/anibone");
myMessage.add(name);
myMessage.add(n);
oscP5.send(myMessage, myRemoteLocation);
}

its for processing and sends OSC data to another software named Animata, somebody could explain me how make a VVVV patch what produce the same messages?

and… i need to know too, if is possible send the position of and object, for example a color tracker object position through OSC?, you know an object in constant movement.

Thanks in advance.

helo vladimir,

this looks quite straight forward. this processing programm is sending OSC messages to localhost (= ip-adress 127.0.0.1) on port 7110. for this you’ll need a UDP (Network Client) node with those settings.

connected to the udp nodes input you need an OSCEncoder (Network) node. this takes a spread of 4 addresses:
/anibone/level
/anibone/level_inverz
/anibone/level_random
/anibone/level_pulse

all 4 addresses seem to take only one float argument. so as typetag you only need to specify a single “f”, specifying a spread of
f
f
f
f
should do the same.

then in the oscencoders arguments input you feed in a spread of the four corresponding values as a spread of strings.

  • and… i need to know too, if is possible send the position of and object, for example a color tracker object position through OSC?, you know an object in constant movement.

of course it is.

good lukc. don’t forget to post your results. sounds interesting…

Oh, thanks for the answer and thanks for your help, im starting to understand, but i dont know how send the data, in the processing code, the minim library sends audio data, but if i connect an audioin and FFT nodes to the argument, using AsString node, but nothing send, just a weird and crazy flow of messy data…what im doing wrong?

the other thing is, i need to send the position of an object tracked by colorTracker node, how could i do that???

OSC.v4p (5.1 kB)

joreg, dude, i see the code in other way, im serious lost…

the OSC message must be send to the /anibone adress, with two parameters, a “name” and a “value”, in the software which receive the OSC data the name must be the same, the name is the for a bone, and the value determines the lenght in relationship with a joint, i dont know if im clear…

this is the set of data what i need send from vvvv

animata receives the following OSC messages on port 7110

/anibone name(string) value(0-1 float)
changes the length of the bone, between the minimum and maximum lenght values

/joint name(string) x(float) y(float)
sets joint position

/layervis name(string) value(boolean)
turns on/off a layer

/layeralpha name(string) value(float)
sets layer’s alpha

here you can download the software if you wanna try…

http://animata.kibu.hu/

and basically this is what i want to do:

in that video they used eyesweb…but is too much for me learn each software needed, i hope what vvvv could do the same…

Thanks in advance.
vladimir.

Hi vladimir , probably easier if you test first inside vvvv that what you send is working well, then try to send it somewhere else , just my humble suggestion ;D regards

OSC.v4p (18.0 kB)

Segun creo Colorsound habla español, muy bonito ese parche que me enviaste pero aqui en mi pc no funciona, ni siquiera manda la señal dentro del mismo patch, pero si le añado una linea al codigo del processing println(n); puedo ver los valores que se estan enviando y con println(name); puedo ver el nombre, el mensaje que necesito enviar va dirigido a la direccion /anibone y debe contener el nombre del hueso hacia el cual va dirigido el mensaje, los nombres son level, level_inverz, level_random, level_pulse, pero segun creo puede ser cuaquier nombre, lo importante es que dentro del Animata coincidan y el segundo valor es numerico float entre 0 - 1, lo cual se puede lograr con un nodo map(value), es decir la direccion /anibone es para comunicarse con los huesos, la direccion /joint es para comunicarse con las coyunturas, la direccion /layervis es para activar y desactivar capas y la direccion /layeralpha es para el valor del alpha de la capa, entonces segun lo entiendo a esas direccion hay que enviarle mensajes compuestos

animata revibe los siguientes OSC messages on port 7110

/anibone name(string) value(0-1 float)
changes the length of the bone, between the minimum and maximum lenght values

/joint name(string) x(float) y(float)
sets joint position

/layervis name(string) value(boolean)
turns on/off a layer

/layeralpha name(string) value(float)
sets layer’s alpha

y cada direccion recibe mensajes distintos, como hago eso?

Finally i did it, with this patch a bone change in length and a joint moves, the bone behave well but joint…i dont know yet how to move it correctly in (x, y) but it moves…(:.

somebody could explain me about the Subtype pin in the AsString(value) node and if you have some hint to give me about OSC packager management ill appreciate it, and optimization, because im afraid what i gonna need a lot of messages…X)

newOSC.v4p (19.2 kB)

helo vladimir,

sorry for the delay.
the AsStrings subtype input is not so elegant. you can mostly leave it at its default, as with your case you need floats anyway. the FormatValue (String) node does similar things and is much more intuitive to use.

concerning management note that you can feed the OSCEncoder with a spread of addresses. this way you can send several messages as one bundle.

hope that helps!?