Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integer data type #17

Open
smadds opened this issue Feb 9, 2018 · 5 comments
Open

Integer data type #17

smadds opened this issue Feb 9, 2018 · 5 comments

Comments

@smadds
Copy link

smadds commented Feb 9, 2018

Like @nfavrod I am also trying to control a Behringer X32 with this node.

Some commands need the response defined as an integer - e.g.:
/ch/01/mix/on ,i 0

It seems to fail with the ,f number type. Is there any way to force the ,i prefix when outputting data from the OSC node?

@smadds
Copy link
Author

smadds commented Feb 10, 2018

I think I've found a partial answer to this, by sending a json payload to OSC in this format:
{"type":"i","value":0}

image

Yay - this works!, but I have yet to figure out how to send multiple values without OSC thinking it's a return message from the device. e.g. these both fail:
{"type":"si","value":"scene 0"}
{"type":"si","value":["scene", 0]}

Any ideas??

@njh
Copy link
Owner

njh commented Jun 24, 2018

I am sorry it has taken so many months to respond. I don't seem to have received an email when this issue was created.

That Behringer X32 mixer looks like fun! Did you manage to get it to work?

JavaScript / JSON does not make a distinction between Floats and Integers and it looks like the osc.js library defaults to using floats. Some client implementations (eg. liblo) will auto cast a float to an integer if it is expecting an integer.

The syntax for sending both a string and an integer is:

[
  {
    "type": "s",
    "value": "scene"
  },
  {
    "type": "i",
    "value": 0
  }
]

This is documentation on this formatting in the osc.js README:
https://github.com/colinbdclark/osc.js

I just did some tests using Node-RED and oscdump and got the output:

ded9633a.358d25ed /foo/bar si "scene" 0

@terwarf
Copy link

terwarf commented Sep 26, 2020

Hello and thanks for the nice plugin.
I can confirm the x32 accepts this format. Tested with
[ { "type": "s", "value": "/ch/01/mix/fader" }, { "type": "i", "value": 30 } ]
with topic /subscribe subscribes to value on first fader for the next 10 seconds (the integer limits the amount of messages the mixer sends back).

@alexszilagyi
Copy link

@terwarf : Thanks for the input!

Can you share maybe the node-red flow? I would be highly interested to see how you've set it up. I am trying to setup the following OSC command:

/load ,si scene 00

But I was unable to do that using the following flow:

[
    {
        "id": "da099c9102c4e8ab",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "08c102dd8ef2d7a8",
        "type": "inject",
        "z": "da099c9102c4e8ab",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 140,
        "y": 160,
        "wires": [
            [
                "e86b9f9871d5e9f6"
            ]
        ]
    },
    {
        "id": "220366b7f70d5845",
        "type": "osc",
        "z": "da099c9102c4e8ab",
        "name": "",
        "path": "",
        "metadata": true,
        "x": 490,
        "y": 160,
        "wires": [
            [
                "b33821c7c260cf81"
            ]
        ]
    },
    {
        "id": "b33821c7c260cf81",
        "type": "udp out",
        "z": "da099c9102c4e8ab",
        "name": "",
        "addr": "192.168.1.10",
        "iface": "",
        "port": "10023",
        "ipv": "udp4",
        "outport": "",
        "base64": false,
        "multicast": "false",
        "x": 730,
        "y": 160,
        "wires": []
    },
    {
        "id": "e86b9f9871d5e9f6",
        "type": "function",
        "z": "da099c9102c4e8ab",
        "name": "",
        "func": "msg.payload = { \"packets\": [{ \"type\": \"s\", \"value\": \"scene\" }, { \"type\": \"i\", \"value\": 0 }] };\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 310,
        "y": 160,
        "wires": [
            [
                "220366b7f70d5845",
                "49a46685da1b43cc"
            ]
        ]
    },
    {
        "id": "51eb5aa2fd856f3e",
        "type": "comment",
        "z": "da099c9102c4e8ab",
        "name": "Send a bundle over OSC",
        "info": "",
        "x": 170,
        "y": 120,
        "wires": []
    },
    {
        "id": "49a46685da1b43cc",
        "type": "debug",
        "z": "da099c9102c4e8ab",
        "name": "debug 4",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 440,
        "y": 80,
        "wires": []
    }
]

Any thoughts?

@terwarf
Copy link

terwarf commented Jul 22, 2023

@alexszilagyi I remember trying to switch scenes, but i couldn't get it to work.
So I gave up on this topic and stopped controlling the mixer with node-red.

If I remember correctly, i just used an injection node for the test mentioned above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants