Expression Pedal Postion HELP

And another version…
you’ll need a small “Global Script”, the “From Rackspaces” block in your local rackspaces and a parameter-connection for the Global widget to the local one (the Global widget has to have a OSC/Script name which must match the variable name in the script! → widget/Advanced tab).
You can view/edit this Global script under Menu/Window/Show Global Rackspace Script Editor
Remember to press the “Compile” button if you made some changes!


var
global_exp1 : widget

On Rackspace(oldRackspaceIndex : integer, newRackspaceIndex : integer)
    SetWidgetValue (global_exp1, GetWidgetValue(global_exp1) +0.000001)
End

The trick i use in the global script, is to induce a slight change to the global pedal widget (+0.000001) on every rackspace change… this forces the the global parameter to be updated each time this happens and nobody will ever notice the 0.000001 :wink: ).

Here is the gig file to try… if this suits your needs, you can then copy the code block and change the regarding names and add the additional two expression pedal widgets as new variables (remember to give them corresponding names in the widget/Advanced tab first!).

sync_global_expression.gig (83.0 KB)

@schamass This seems to work and I’ve added two other expression pedals and seems to still work!

It doesn’t work if the expression pedal is on 127 (or full value) prior to change. Any ideas for that Maestro! THANK YOU!!

2 Likes

Adding .000001 won’t do anything if the value is already 1.0

No but in that case it seems to take no action so defaults to the original rackspace value

Yeah, then there should be a check for extreme values… if 1.0 is reached, there should be a subtraction, so an actual change of the value will happen.

1 Like

Yes, that was my point!

We could also check if the NewRackspace is smaller than the OldRackspace and the subtract, other way add 0.00001, plus check for 0 and 1.0 and change polarity of the increment according to the situation.

We? :smile: I’m just barely learning scripts! How would “WE” do that :slight_smile:

MM

1 Like

I’m just inmidst of a rehearsal… no time for coding. :smiley:

1 Like
var
global_exp1 : widget

On Rackspace(oldRackspaceIndex : integer, newRackspaceIndex : integer)
   var 
      newValue : double = GetWidgetValue(global_exp1)
      if newValue == 1.0
         then newValue = newValue - 0.000001
         else newValue = newValue + 0.000001
     End 
    SetWidgetValue (global_exp1, newValue)
End

I didn’t try this (not at my computer) but it should do the trick

1 Like

Thanks so much. I tried to do it myself (best way to learn) and I think this worked. Any reason why it wouldn’t? THANKS for all the help!!

var
global_exp1 : widget
global_exp2 : widget
global_exp3 : widget

On Rackspace(oldRackspaceIndex : integer, newRackspaceIndex : integer)
    If GetWidgetValue(global_exp1)==1  Then 
    SetWidgetValue (global_exp1, GetWidgetValue(global_exp1) -0.000001) Else 
    SetWidgetValue (global_exp1, GetWidgetValue(global_exp1) +0.000001)
    End
    If GetWidgetValue(global_exp2)==1  Then 
    SetWidgetValue (global_exp2, GetWidgetValue(global_exp2) -0.000001) Else 
    SetWidgetValue (global_exp2, GetWidgetValue(global_exp2) +0.000001)
    End
    If GetWidgetValue(global_exp3)==1  Then 
    SetWidgetValue (global_exp3, GetWidgetValue(global_exp3) -0.000001) Else 
    SetWidgetValue (global_exp3, GetWidgetValue(global_exp3) +0.000001)
    End
End

Yes, what you wrote will work – however it will be a little bit slower because you’re making multiple function calls, e.g. GetWidgetValue(global_exp1) that always return the same value. The slowdown won’t be much (and mightn’t even matter at all) but using a local variable is still a little easier to manage.

That’s precisely why I wrote the line

var 
      newValue : double = GetWidgetValue(global_exp1)

so that I could use a simple variable, newValue, rather than calling the function three times.

However, if you have to repeat the same code multiple times (you’re doing it for three different widgets) then it’s worth creating a function call to do the work.
For example,

var
   global_exp1 : widget
   global_exp2 : widget
   global_exp3 : widget

   
Function UpdateWidget(aWidget : Widget)
   var 
      newValue : double = GetWidgetValue(aWidget)
      if newValue == 1.0
         then newValue = newValue - 0.000001
         else newValue = newValue + 0.000001
     End 
    SetWidgetValue (aWidget, newValue)
End
   
On Rackspace(oldRackspaceIndex : integer, newRackspaceIndex : integer)
   UpdateWidget(global_exp1)   
   UpdateWidget(global_exp2)
   UpdateWidget(global_exp3)
End
2 Likes

Try to use 1.0, which means a double (floating point) value, instead of just 1, which implies an integer value which is not allowed as a widget value. I could imagine that this might be an issue.

2 Likes