Sending an OSC Array

Forgive me for the completely basic question, but I have never really tried to send an OSC array before from Open Stage Control, and the need has now arisen! I thought this would be possible putting something like:

[
[ 0, "@{fader_1}" ],
[ 1, "@{fader_2}" ],
[ 2, "@{fader_3}" ],
[ 3, "@{fader_4}" ]
]

in the value (or is it preargs?) of a variable widget (with the necessary osc target and address completed), but this unfortunately doesn't appear to send anything on the console when I move one of these faders. I need both the value and the index of the value sending via the osc message.

I'm am sure this is simple to do, so I apologise in advance for asking such a rudimentary question!

Any help greatly appreciated!

Open Stage Control doesn't support sending osc arrays as referred in the specification with the typetags delimiters [ and ]. I've never seen an application that uses it and usually you can do without it by sending all your arguments at the same level:

[
  0, "@{fader_1}",
  1, "@{fader_2}",
  2, "@{fader_3}",
  3, "@{fader_4}"
]

However, not seing anything in the console is unexpected, there must be an error somewhere, because arguments that can't be send as is are converted to JSON and sent as strings by O-S-C (which allows sending any object/array structure as long as the receiving end is capable of decoding JSON).

Thanks for the quick response with this, I am still unfortunately struggling to send the array with a single osc address. With the array, can it be triggered from a script/variable widget whenever one of the values in it gets updated? I have tried sticking the array in the 'value' parameter of one of these widgets with my osc address set up, but guessing it is more involved than this, as moving a fader linked to the array doesn't produce an osc message in the console. I have attached the attempt that I have made with this, as this may more clearly show where I am obviously going wrong!

Array_Test.json (6.4 KB)

Many apologies for failing to grasp what to do here!

Thanks very much

It's not obvious actually :), the script widget doesn't send anything by default, its value is just passed to its script property, you could send it with something like this:

send('/address', ...value)

Note: writing ...value here equals writing
send('/address', value[0], value[1], value[2], etc)

Thanks for helping with this, much appreciated, I think I have come up with a workaround of sorts now for this array thanks to your help. I realised that by adding :
[
0,
0
]

to the preargs field of the fader that I wished to send the value of would create an osc array message with the index dependent on how many '0's were added here. If all my faders share the same osc address, this seems to create an indexed osc array at the other side (which in this case is the osc receive array macro in Reaktor 6). Didn't think I was going to crack this one in the end, so I am so happy with this solution! Thanks again for all your assistance with this, all the best!

Sorry to bother you again, but just had a quick query about osc arrays: Will sending reasonably large osc arrays cause any lag? Not at all familiar with the technicalities of the protocol, so was wondering if it would be a disadvantage to send a single osc message (with for example 50 values in its array), in comparison to a message with just a single value, or does an array of this size not really impact on performance (send speed etc)? Don't want to go too far down the array 'rabbit hole' only to find them impractical to use (as the benefit is only one osc address for a mulitude of values which is pretty useful when mapping controls in a Reaktor 6 rack!). Thanks again!

If I understand your solution, each fader only sends one message with multiple arguments and the receiving end takes care of reassembling them, it sounds very efficient to me. adding multiple arguments to a message won't have a significant impact on performance.

That is great to know, thanks very much Jean-emmanuel, all now working perfectly in sync with Reaktor (just had to build in a bit of logic to unpack the array inside a Reaktor block and now good to go!). Makes me really appreciate how powerful and flexible Open Stage is once again, can finally get a hands on experience of my software modular now, loving it!

Okay, really sorry, this is the last thing I would like to check about with this array! I can return an array with two values from Reaktor back to Open Stage, and it 'looks' like it matches the array sent out from the Open Stage fader, but the fader itself does not respond to to the Osc message received in Open Stage (I did notice the format of the message out differs slightly from the message in). Here is a quick screenshot:

Array In

Looking at that, should the fader in Open Stage respond to the array? (I can see the 'in' message doesn't stipulate type: 'f' and has way more decimals, but a single non array value like this gets picked up fine). I have the Preargs for this particular fader set like this:

Preargs

Sorry about the slew questions, obviously doing something silly but just a bit stumped with this one, as always had seamless bi-directional control of faders so something is set up incorrectly by me! Really appreciate any help with this, as last thing to crack with this now!

In order to reach a widget, a message must match its preArgs exactly, in this case, the first argument must be 0, nothing else (General mechanics - Open Stage Control).

Thank you so much, that makes perfect sense now, thought I must have missed something simple! That will be an easy fix on the Reaktor side, great stuff!

Ha, sorry I have one more array issue (I promise this should be the last!). I am noticing some strange behaviour when a '0' is received via on Osc array on the second index of a two indexed array it isn't updating the fader value. So:

0.0001

will effectively update the fader position to '0', but receiving this:

0

doesn't update the fader position to '0' (the fader will just stay on its last value). Is this by design, or could it be a bug? (I only noticed this as a 'snapshot' sent an exact round'0' via OSC, usually there is not a pure round zero sent when moving the fader in Reaktor, the lowest OSC value is typically something like '0.000123456 etc, so I've never noticed this before).

I have written a workaround in Reaktor so it will actually send '0.0001' instead of '0' and this works perfectly fine, just wondered if there was anything I can do on the Open Stage Control side to avoid this behaviour?

Thanks again for any help with this!

I think you have a conflict between another fader with preArgs to [0, 0] and this one. The best way to avoid this would be to simply use the first item in preArgs as an index instead of using the number of preArgs.

Ah, yes I can see a conflict now with this message, thank you so much, couldn't work out what was going on! Yes the index in first value of array is a much better way than what I am using, again brilliant support (I am no programmer so these solutions don't come easy to me!). Thank you again!