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?
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
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
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
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.
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.
Youāll need to explain this to me @npudar 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ā?
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 !
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!
Well, I must admit that I did this in only a few minutes (before lunch ), it is very rough but I think that it will suit Jonathanās needs There is some maths, but itās really logical.
Wow, Iām really glad that you like it.
Here are some hints:
(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 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
So please have fun with curves and these hints, curves are really a great feature of GP4. Play with them.