I am trying to get an OSC message from a p5js sketch, being an array of arrays. As far as I understand it, the OSC spec allows for sending several arrays in a message.
I am sending this:
[ [0, 5] , [56, 78] ]
And expecting this:
[/getVectors, [ [ 0.0, 5.0 ] , [ 56.0 , 78.0 ] ] ]
But messages looks like this:
[ /getVectors, [, 0.0, 5.0, ], [, 56.0, 78.0, ] ]
Messages are being sent from Javascript via a WebSocket dispatcher:
osc.js:
const sendSuper = function (address, args) {
port.send({
address: address,
args: args
});
};
sendSuper("/getVectors", [[0, 5],[56, 78]]);
This might be an issue with osc.js, but I’ve also tried with
I’ve also tried Python with pythonosc.
def localSclangSend(server_ip, osc_addr, args):
sclang_server = udp_client.SimpleUDPClient(server_ip, 57120);
sclang_server.send_message(osc_addr, args)
localSclangSend("127.0.0.1", "/getVectors",[[0, 5],[56, 78]])
Which looks like this: [ /getVectors, [, 0, 5, ], [, 56, 78, ] ]
The OSC spec says that an array type tag is simply prefixing with the [
delimiter. From the documentation for both osc.js nor pyosc, I think the messages are formatted correctly at the sender, so I am leaning towards this being a SuperCollider issue?
I am thinking about workarounds atm, such as sending a string and reading that as YAML / JSON using the .parseJSON
. I’d rather avoid that though. Any leads?
EDIT:
Ok so looking again at the OSC spec, the array type tag is “non-standard”. The documentation states that:
“r” (RGBA color), “S” (symbol), and “[” and “]” (array start and end) are not supported.
So my question is then, does anyone have a workaround for this?