Can I set a GlobalBPM widget to increase/decrease at increments of 10bpm?

As the question says really, I can set a min/max Global BPM values on the widget, which is super helpful, but I am very OCD and only use 120, 140, 150, 160 and 170 BPM in my songs, nothing really in between.

Is there a neat scriptlet or option that would allow me to turn the knob in increments of 10 BPM instead of 1 BPM?

Many thanks
Jonathan

Screenshot 2021-08-27 at 22.59.54

There are many ways to accomplish this.

Here’s a good starting point, a simple global rackspace script using an unassigned widget with a GP Script name of BPM. You can probably improve and customize this very quickly, just putting it here to get you started.

Var
   BPM : Widget

On WidgetValueChanged(a : double) from BPM
If a == 0.0 then SetBPM(110)
elsif a > 0.1 and a < 0.2 then SetBPM(120)
elsif a > 0.2 and a < 0.3 then SetBPM(130)
elsif a > 0.3 and a < 0.4 then SetBPM(140)
elsif a > 0.4 and a < 0.5 then SetBPM(150)
elsif a > 0.5 and a < 0.6 then SetBPM(160)
elsif a > 0.6 and a < 0.7 then SetBPM(170)
elsif a > 0.7 and a < 0.8 then SetBPM(180)
elsif a > 0.8 and a < 0.9 then SetBPM(190)
elsif a > 0.9 and a < 1.0 then SetBPM(200)
elsif a ==1.0 then SetBPM(210)
End
End
3 Likes

This seems to work as well. You can set the min and max BPM and the increment/step size you want.
As with @edm11’s example, it assumes you have a knob widget with a handle called ‘BPM’.

Var
    BPM : Widget
    minBPM : Integer = 60
    maxBPM : Integer = 240
    stepSize : Integer = 10
    stepNumber : Integer = Round((maxBPM - minBPM) / stepSize)

On WidgetValueChanged(newValue : double) from BPM
    Var newBPM : Integer = (Round(ScaleRange(newValue, 0, stepNumber)) * stepSize) + minBPM
    SetBPM(newBPM)
    SetWidgetLabel(BPM, newBPM)
End
4 Likes

As @edm11 already started, you can do this easily with a script.

Here are two methods that could get you more control over the range.

# First method is to set the lowest and highest BPM
# you want and have a script round it up.

var bpmMin : integer = 120
var bpmMax : integer = 170
var bpmSet : Widget

On WidgetValueChanged(newValue : double) from bpmSet
    SetBPM ( Ceiling ( ( ScaleRange ( newValue, bpmMin, bpmMax ) + 1 ) / 10 ) * 10 )
End
# Second method is to create an array of desired BMPs
# and using a script select them by changing widget value

var bpmValues : Integer Array = [ 70, 120, 130, 160, 170 ]
var bpmSet : Widget

On WidgetValueChanged(newValue : double) from bpmSet
    SetBPM ( bpmValues [ ScaleRange ( newValue, 0, Size ( bpmValues ) - 1 ) ] )
End

M.

3 Likes

Thanks @tomaxxi! Lots of options :slight_smile:

1 Like

Just for general knowledge, whenever you have a pattern like the one above, you can generally just replace it with a single formula. In this case all you need is

On WidgetValueChanged(a : double) from TheBPM
      SetBPM( 110 + Round(10*a) * 10)
End

The examples provided by others are more flexible by allowing you to change the scaling.

3 Likes

Thank you, all, I very much appreciate your replies. This one worked best for my needs after trying a couple, so a massive thank you to you all! Very much appreciated. Never ceases to amaze me how kind people can be to take the time to do this stuff, I really appreciate it.

4 Likes

@jonathanthomas83

With widget curves, there can be miracles. Examples are below.

Download gig file:
BPM.gig (71.1 KB)

Curves:

Widget 1
Curve1

Widget 2

7 Likes

Brilliant! **No need for any scripting **

1 Like

You’ll need to explain this to me @npudar :slight_smile: I must admit I can’t wrap my head around the curve designer. I can’t actually tell if there is some maths behind those settings, or just a ‘closest match’?

3 Likes

I assume adding points would be exactly like adding the min/max values on the curve itself. Choose the values for the in between points on the designer.

Which is a great solution, I’m going to try it, thank you @npudar !

1 Like

Thanks to all who chimed in and submitted their own interpretations for solutions. We all learned something today!

2 Likes

The curve designer seems to be a smoother transition between values than any of the code snippets I’ve used. I’m grateful for all of the solutions provided, but I think the curve design works beautifully for my needs, thank you @npudar .

Goodness knows how you did it though, I’m going to have a go at replicating what you’ve done. EDIT: The curve designer is difficult to understand so a bit of learning required, I think!

1 Like

Well, I must admit that I did this in only a few minutes (before lunch :joy: ), it is very rough but I think that it will suit Jonathan’s needs :slight_smile: There is some maths, but it’s really logical.

Wow, I’m really glad that you like it. :beers:

Here are some hints: :slight_smile:

(1) First widget

Jonathan said that he wanted e.g. min to be 120; simply enter 120 BPM (red rectangle) and see the corresponding widget value (widget is attached to the System Actions plugin, please download and open the gig file from this post to see the parameter association). That is your min for the curve:

I created steps automatically with currently undocumented feature (easter egg!). Please see this post.

(2) The second widget

Well, I observed values very quickly :slight_smile: When I type:

  • 20 BPM, widget value is 0
  • 30 BPM, widget value is 1.6
  • 40 BPM, widget value is 3.2
  • 50 BPM, widget value is 4.8
  • 60 BPM, widget value is 6.4
  • 70 BPM, widget value is 8.0

Widget movements are by 0.1, therefore:

  • 0.0 → 0 (20 BPM)
  • 0.1 → 1.6 (30 BPM)
  • 0.2 → 3.2 (40 BPM)
  • 0.3 → 4.8 (50 BPM)

So, I basically need to multiply with something around 16 (why 16? E.g. 4.8/0.3 = 16).
It seems that higher values didn’t go well with 16, so I entered 16.1, and voila, that’s the curve that would fit Jonathan’s need for his scope of values:

As I said, this is very rough and can be improved :slight_smile:
So please have fun with curves and these hints, curves are really a great feature of GP4. Play with them.

:beers:

5 Likes

That’s going to be a very cool feature, thanks guys!

1 Like

I forgot about that undocumented Easter egg😀

You might want to mention that the widget is attached to the system actions plugin

1 Like

Yep, the whole gig file is posted above. :slight_smile:

I’ll edit the “hints post” and include the link, to avoid possible ambiguities.

1 Like

Forgive me, I still can’t see how you did this automatically and can’t reverse engineer how you did it.

OK, @dhj said that I can reveal this easter egg (there are more :slight_smile: ).

So, @jonathanthomas83 here is the missing piece:

(1) Shift + click the linear shape:

EasterEgg1

(2) A dialog box will open, prompting you to enter the number of steps (e.g. 8)

EasterEgg8steps

(3) And you’ve got yourself a nice shaped curve:

EasterEgg-result

~

You can also set Min and Max and repeat the procedure, or vice versa (create steps and then set Min and Max).

:beers:

8 Likes

@npudar that is awesome! Very helpful advice and a great feature. Thank you very much! I’ll add that to my rig asap! Thanks also @dhj

EDIT: Worked perfectly, amazing feature!

4 Likes