Fastest way to update fader values from module

Hi!
Still writing my server/client to control alsa devices, Focusrite scarlett 18i20 in my case. It provides 56 Meter values for input and output levels. Whats the fastest way to update around 20 or more faders from a module with new values multiple times a second? Is "receive()" in the module the way to go or is there an alternative?
Best regards, Oliver

receive() is the way to go. If you want to reduce the number of messages you can send all the values in one call and dispatch them with a script widget on the client side.

Thanks! So send one message containing all meter values to, let's say "/meters", where a script widget listens, which then sets the actual values? Sounds way more efficient than sending each value individually :smiley:

Yes, you could even do something like that in the script to skip values that didn't change:

// onCreate
locals.n_faders = 10 
locals.lastValues = Array(locals.n_faders).fill(0)

// onValue
if (value.length === locals.n_faders) {
  for (var i in value) {
    if (value[i] !== locals.lastValues[i]) {
      locals.lastValues[i] = value[i]
      set('meter_fader_' + i, value[i]
    }
  }
}
1 Like

Nice! Thank you very much, I'll implement that in my preset (and share it here, once it's useful for other people)

1 Like

Hi! Can Focusrite Control app be controlled using OSC/MIDI? Really?

The official one? No idea... I'm writing my own tool to control the interface on linux.

1 Like