Improvements for 2 way communications with hardware

Hi!

would it be possible to somehow just send the value of a knob if you “untouch” it.
openstagecontrol4reaper_v2.js (8.7 KB)
(i guess this is possible with the new touch state of some widgets)

Here in the working script a lot of values are sent to the hardware (kemper) and back.
(if you move a knob it somewow iterates value by value to the position -> not really fast).

As alternative, and further improvement would be to calc the value as db string to print it to the panel (now i send per incoming value a sysex request for the string representation of the value).

The calculation of the 14bit hex value is allready answered in another thread (thanks @jean-emmanuel
Midi SYSEX Error ) -> this leads to 2 ways the values should be converted:

  1. 0 - 8192 : -5 to 0 db and 8192 to 16383 : -> 0 to +5db
  2. 0 - 8192 : -infinty to 0 db and 8192 to 16383 : -> 0 + 12db

Any hints how to do this?
Thanks!

would it be possible to somehow just send the value of a knob if you “untouch” it.
(i guess this is possible with the new touch state of some widgets)

You nailed it, there's an example in the docs.

Any hints how to do this?

Since you ask for hints :), here're some search keywords that should help:
js value scale range

Got the first one working! YEAH!!! Maybe the second is then not needed anymore, i will see.
(It would be nice if you mention that the bypass on the widget should be activated to not interfer / sending unwanted messages -> help others out). Your Documentation is really good, no meaning of criticism here :slight_smile:

Would it be somehow doable to use this touch in an external module (not per widget)? -> I guess this would mean a lot of work…

(interesting google search string, i wouldn’t have thought of this one)

Yep, will do :slight_smile:

Would it be somehow doable to use this touch in an external module (not per widget)? -> I guess this would mean a lot of work…

What do you mean by "external module" ?

thanks! -> custom module, my bad!

Ok, you can send the touch information from the widget’s script property and catch the message with the custom module’s oscOutFilter function.

Sorry for being unprecise here...

I'll give you my example here.
There are several knobs with the script widget is on every knob the same:
(sending out the value when "untouching" the knob, preventing in between sends of a lot of values)

if (touch !== undefined){
if (touch == 0) {
send('/@{this.id}', get("this"))
}
}

now it would be nice instead of copying this 1:1 from widget(script property) to widget it would be
nice if we could do something like this in a custom module

if (address === '/xxx') || (address ==='/yyy'){
if (address.touch !== undefined) {
....
}
}

You can’t access the touch information from the custom module unless the widget sends it.

To avoid repeating the code, you could write this once in a dummy knob’s script (or in any widget’s property actually):

if (touch === 0) {
  // note the use of getProp() instead of @ { }
  send('/' + getProp('this', 'id') , value)
}

and write this in the widgets that should use this script:

@{dummy_knob_id.script}