OSC RX & Javascript



Encoder OSC RX Tutorial


To add a JavaScript to the incoming OSC message, proceed as follows.
  • First click on [OSC RX]
  • You are now in the [OSC RX] settings window
  • (1.) activate the 'OSC Receive Port' (default 50001 )
  • (2.) Then press [add] to get a new input mask.
1. you will get the default example 'osc-message'.
2. here you can write your 'javascript-code'.
3. press the question mark to open the 'help' window.
Help-windows for the OSC-message

NEW in v.2.2.1n-beta with 'JavaScript-Editor'!

Custom OSC Help:

Access to OSC data:
s.path([index]);
Returns the specified part of the OSC path.
Example: /this/is/my/path -> s.path(3); -> 'my'
s.arg([index]);
Returns the specified argument of the OSC message.
Example: /demo 1 2 3 -> s.arg(2); -> 2

Access to current data:
s.getX([index]);
s.getY([index]);
s.getZ([index]);
s.getA([index]);
s.getE([index]);
s.getD([index]);
s.getName([index]);

Manipulation of data set:
s.setXYZ([index], [x], [y], [z]);
Sets XYZ coordinates of the specified source index.

Example:
s.setXYZ(1, 1.0, 0.5, 0.1);
s.setXYZbyName([name], [x], [y], [z]);
Sets XYZ coordinates of the source with the specified name.
Example:
s.setXYZbyName("flute", 0.5, 0.5, 0);
s.setAED([index], [x], [y], [z]);
s.setAEDbyName([name], [x], [y], [z]);

Same for AED coordinates.

Group manipulations:
s.setGroupXYZ([index], [x], [y], [z], [optional: moveSub]);
Sets XYZ coordinates of the specified group index.

Example:
s.setGroupXYZ(1, 1.0, 0.5, 0.1, 1);
s.setXYZbyName([name], [x], [y], [z], [optional: moveSub]);
Sets XYZ coordinates of the source with the specified name.
Example:
s.setXYZbyName("woodwinds", 0.5, 0.5, 0, 0);
s.setGroupAED([index], [x], [y], [z], [optional: moveSub]);
s.setGroupAEDbyName([name], [x], [y], [z], [optional: moveSub]);
Same for AED coordinates.
s.rotateGroup([index], [x], [y], [z]);
Rotates the attached sources around the group point.
x, y, z define the relative axis-rotation in degrees.
Example:
s.rotateGroup(1, 0.0, 0.0, 10.0);
s.rotateAroundOrigin([index], [x], [y], [z], [optional: moveSub]);
Rotates the group point around the origin (0,0,0).
x, y, z define the relative axis-rotation in degrees.
Example:
s.rotateGroupAroundOrigin(1, 0.0, 0.0, 10.0);
s.rotateGroupByName([name], [x], [y], [z]);
s.rotateAroundOriginByName([name], [x], [y], [z], [optional: moveSub]);

Same with identification of the group by name.

The optional parameter moveSub defines:
0: group point only
1: group point and attached sources, preserving relative positions.

Local buffer:

The local buffer allows to store values between OSC messages.
Up to 1000 float values can be stored and recalled anytime.
s.setBufferValue([index], [value]);
Saves the specified value at buffer position [index].

Example:
s.setBufferValue(1, 25.0);
s.getBufferValue([index]);

Gets the value stored at buffer position [index].
Example:
s.getBufferValue(1);

Note: all 'index' parameters are 1-based

<< content