Announcement

Collapse
No announcement yet.

convert incoming float to integer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • convert incoming float to integer

    hello

    have a little issue and just struggling to work out a solution. i am using touchOSC as an interface for controlling an arduino driving some linear actuators, the arduino code is set up to receive integers but as far as i can tell touchOSC only sends floats.. I was hoping to use Osculator to convert the incoming floats to integers.. I presume the OSC routing editor is the way to do it but I am just struggling with it.. I essentially want to convert a message : MotorIn/Forward 1.000(float) to MotorIn/Forward 1(int) .. there are a number of actuators and each one is addressed sequentially using integers as their id's .. I was hoping to convert the message as the touchOSC would be a perfect interface for this application.. anyone have any ideas?

    thanks

  • #2
    Hi Kazimier,

    All you have to do is to create an OSC Routing that converts its input to integer.
    This OSC Routing does not have to change the input OSC address, so you can re-use it many times to convert from float to integer different input messages. The only requirement is that those input messages have a single argument. If you have message with multiple argument, then you need to defined other OSC Routing correspondingly.

    Here are the steps I did to create the attached example:

    • Open the Parameters window and go to OSC Routing
    • In the Targets table, define the OSC target: enter the host and port of your OSC device in the first slot, and change the default target to any other slot than 1, you don't want your device to be default. (the default target is identifier by this funny looking Ð, check the manual for more info)
    • Click the + symbol at the bottom of the window to create a new OSC Route.
    • Assign this route the target at slot 1 (first column of the Routes table)
    • Double click the route to bring up the route editor
    • Delete all token in the Arguments field
    • Drag and drop the arg[0] token in the templates below
    • On the dropped token, click the disclosure triangle to open a contextual menu, choose "as integer"
    • Close the Parameters window.


    Now send a message to OSCulator, it will appear in the main list.
    All is remaining to do is to assign this received message the OSC Routing event we just created to convert its first argument to integer.

    Please check the example file for more details.


    Best,
    Cam
    Attached Files

    Comment

    Working...
    X