Beginner question: how to retrieve track names from Behringer X32 console

Hi all,

I am a new OSC user and understand only the basics of Javascript. My apologies in advance for such an elementary question, but I’m not able to figure it out with my limited understanding of the language.

I am using OSC to control a Behringer X32 mixing console. I have a series of button widgets mapped to different channels on my X32 no problem. I would like for the button labels to pull their values from the X32 as soon as my OSC instance starts up.

I do have a custom module running, and it is submitting an ‘/xremote’ command. This does indeed change the track names but only when a track name is changed. What I’m looking for is something that will fetch the track names right away.

Is this something that I should be adding to the init function of my custom module? Or is there (likely) a much easier way that I am not understanding?

Thanks for reading.

If I understand the X32 manuel correctly (espacially this and this), sendig /ch/01/config/name will make the X32 send back the first channel’s name on the same address (I assume that’s the address you use to receive name updates). You’ll need to send that request for all channels from the custom module, but not in the init function because it’s called too early (before any client interface is loaded) and the replies won’t make to your widgets:

app.on('sessionOpened', (data, client)=>{
  // this event is emitted when a client loads a session
  // perfect moment to fetch the X32 values
  for (var i = 1; i <= 32; i++) {
    var n = String(i).padStart(2, "0") // to get "01" instead of "1"
    send(X32_IP, X32_PORT, `/ch/${n}/config/name`)
  }
})

module.exports = {
  // etc
}

Links:

Thank you so much for the extremely quick response! This makes sense. To get the returned value mapped to my button label, could I just change line 6 above to:

button_{i}.label = send(X32_IP, X32_PORT, `/ch/{n}/config/name`);

Thank you!

send() won't return any value, it only sends an osc message. The label should then be sent by the X32 to O-S-C with another message.

button_{i}.label

You can't access widgets like this in the custom module, all you can do is send messages to the client/widgets using receive().

This worked perfectly.

I’m running OSC from a terminal. So with the -debug option set, I can see that indeed 32 OSC out messages are generated, and then the X32 sends 32 OSC in messages back with the requested values. Solved. Thanks again.