Control Tempo with Midi CC Knob/Widget

Is this possible? Does anyone have a script for it?

I sure hope so…

By “control tempo” do you mean setting the BPM value or doing tap tempo?

There are Script functions for both of these, e.g,

https://gigperformer.com/downloads/GPScript/SystemFunctionList.html#SetBPM

Hi. :slight_smile:

This script will do it:

var
test_knb : widget

t_factor : double

Initialization
    t_factor = 200 //max. BPM
End


// Called when a widget value has changed
On WidgetValueChanged(newValue : double) from test_knb
    
    //set the widgets caption to the momentary value (this line may be deleted)
    SetWidgetLabel(test_knb, GetWidgetValue (test_knb)*t_factor)
    
    //multiply the widgets value (0...1) by the t_factor and set the global BPM
    SetBPM(GetWidgetValue (test_knb) * t_factor)
End

Just create a knob-widget and name it as ‘test_knb’ which you then may learn with a hardware controller.

But controling the tempo that way, may lead to unexpected tempo variations because the new value coming from the widget may differ dramatically from the actual tempo-value!

Maybe it would be more appropriate to be able to adjust/correct the inital tempo (given by the rackspace definition) only within a certain range of ±20 or so…

This is done with the following script:

var
test_knb : widget

act_bpm : double
corr_val : double
new_bpm : double


Initialization
    act_bpm = GetBPM() //read the initial tempo when the rackspace is intialized
    corr_val = 20 //correction value (plus/minus)
End


// Called when a widget value has changed
On WidgetValueChanged(knobValue : double) from test_knb
        
    //calculate the new tempo with symmetrical corrected value
    new_bpm = act_bpm + (knobValue - 0.5) * corr_val * 2
    
    
    //set the widgets caption to the momentary value (this line may be deleted)
    SetWidgetLabel(test_knb, new_bpm)
    
    //set the tempo to the calculated value
    SetBPM(new_bpm)
End

Remember that scripts only work per rackspace and NOT globally, so you have to use this script in each single rackspace where it is needed!
Hope this helps…

1 Like

Wow I’ll have to try the 2nd one (would be perfect!) this weekend

THANKS!!

You’re welcome. :slight_smile:Tell me if it worked…
Just a note: The center position of the widget means a correction value of 0, all to the left is -20, all to right is +20

to schamass: i tried the second script and i get this error message: Gig (GigScript) - Semantic error in “Main”: Line 2, Col 12: Allowed in rackspace script only. This type is only allowed in rackspace script

i realize you have said that scripts only work per rackspace and NOT globally, but i’m not sure how to alter the script for a single rackspace. any ideas?
thanks, rob

ooops, sorry Schamass. i figured it out.
tnx, rob

This was many years ago. With GP4, you can run this in the global rackspace.

1 Like