Data type for PureData

Dear OSC developers,

I'm very new to this wonderful software, and as a complete newby in every subject concerning Open Stage Control (OSC protocol, scripting, formatting) I'm struggling with producing the correct data types to be routed by my Pd patch accordingly.

I currently have a slider and a dropdown menu, and my goal is that at any movement of the slider, the latter could first output the current value of the dropdown menu, and then its own id and value.
In this way, in PureData I would have a [route dropdown] object going into a [route 1 2 3] object, tracking the value of the slider according to the value from the dropdown menu - in this example, the dropdown menu would have four values, 0, 1, 2, 3.

I've tried may variations of the following script in the Address field of the slider

JS{
if (@{dropdown} == @{dropdown.value} && @{dropdown.value} > 0) {
  return '/dropdown/'+@{dropdown.value}+'/slider' 
} 

but always unsuccessfully, as I would like the @{dropdown.value} being returned by the if statement to be interpreted by PureData as a float. However, actually it doesn't get processed as any proper atom type (neither float, symbol, nor pointer).

Do you have any suggestion about how to do this?

This could be safely reduced to

JS{
return '/dropdown/' + @{dropdown} + '/slider' 
}

or even simpler

/dropdown/@{dropdown}/slider

Now the thing is that the address of an osc message is always a string, interpreting part of it as a float is possible but that's a job for the receiving end.

The proper way to send floats is to not use the address field (and leave it as a simple string) and instead use the preArgs field that allows inserting arbitrary values in the message before the final value(s) that (in the case of open stage control's widgets) represent the widget's current value. For example a fader with

  • address: /slider
  • preArgs: 1

will send /slider 1 FADER_VALUE

A fader with

  • address: /slider
  • preArgs: @{dropdown}

will send /slider DROPDOWN_VALUE FADER_VALUE

1 Like

Thank you very much. I wasn't understanding this passage from the documentation - not because of bad writing, but just of my misunderstanding. Very easy, and works perfectly.