New Tool (2.7): Tempo Tool

First little tool idea that’s been simple enough for me to learn the basics on LUA and knock up myself. Hope you find it useful.

Currently, at V0.1, you have two keyboard shortcuts added to Global:Tool as Increment Tempo and Decrement Tempo.

The will increase the tempo by a fixed 0.1 BPM. Keyboard repeat is kept so you can keep your finger held down. Due to floating point rounding errors the changes are not exactly 0.1 but think close enough for just about any use.

Hopefully to come at some point is a GUI and MIDI control allowing amount to change set by a knob and then button(s) press to change BPM value.

Reason I wanted to do it: Been at a couple of shows recently with a live act of two people each using their own laptop but not having either synced to the other. Timing slipped and requeuing is required to keep the two perfectly in time. Also know people who try and play their tracks in live to a mainly DJ set and would rather still be able to tweak live, rather than just mix in with Traktor or similar. May not be of much use to many but as I idea to help me learn the very basics I thought it was a good one and hadn’t seen it yet.

Keys I’ve gone for are Shift+Ctrl+NumPad+/NumPad- ;)

http://www.deaddogdisko.co.uk/Stuff/uk.deaddogdisko.TempoTool.xrnx

nice thanks B) B) B) B)

No worries. Something I thought might be useful to some but couldn’t remember having seen as of yet. I think the MIDI and GUI side will take me quite a lot longer to get my head around so expect some wait for a 0.2 release…

How do you mean? I saw two functions so would that be two buttons, or two knobs?

For MIDI I’d like to expand it a little. A few possible modes.

Most simple would be two buttons, which work the same as the current keyboard shortcut. Not very flexible though.

Then Single Knob/Single button. 0-64 gives a negative change (amount depending on distance from centre) and 64-127 gives positive, when the button is pressed. Very hard to nudge up and then back to original value with this.

Single Knob/Dual Button. 0-127 give larger change, button to apply negative, another to apply positive.

Maybe a Single Knob mode too… 0-48 negative, 48-80 no change, 80-127 positive. Or something similar. The people can choose how much in the way of controllers they have spare to use with it ;)

Or something along those line… Probably try and expand it a bit at a time as my understanding increases though.

Okay.

--[[===================================================================================  
MIDI Control for Tempo  
  
Author: Dale Powell (Kazakore) <dj_kaza><br>
Version: 0.0.1<br>
version: 0.0.2 added Midimapping / rejigged the code around - Esa Ruoho (esaruoho) <esaruoho><br>
===================================================================================]]--<br>
<br>
<br>
--Variables<br>
  --local x = MIDI input...<br>
local t=renoise.tool()<br>
  local x=0.1<br>
<br>
--GUI call and design<br>
<br>
--Mode Selection<br>
<br>
--Change and Display Tempo<br>
t:add_keybinding {<br>
 name = 'Global:Tools:Increment Tempo',<br>
 invoke = function() increment() end}<br>
t:add_keybinding {<br>
 name = 'Global:Tools:Decrement Tempo',<br>
 invoke = function() decrement() end}<br>
t:add_midi_mapping {<br>
 name = 'Global:Tools:Increment Tempo',<br>
 invoke = function() increment() end}<br>
t:add_midi_mapping {<br>
 name = 'Global:Tools:Decrement Tempo',<br>
 invoke = function() decrement() end}<br>
 <br>
<br>
    <br>
function increment()<br>
 renoise.song().transport.bpm = renoise.song().transport.bpm + x<br>
 renoise.app():show_status("tempo is now "..renoise.song().transport.bpm)<br>
end<br>
<br>
function decrement()<br>
 renoise.song().transport.bpm = renoise.song().transport.bpm - x<br>
 renoise.app():show_status("tempo is now "..renoise.song().transport.bpm)<br>
end<br>```

<br>
<br>
Works with midibuttons (tried akai mpk mini pads and akai mpk mini knobs (the knobs kinda give too much information to it so if you move from 127 to 0, you'll get stuck waiting for renoise to actually react <img src="https://files.renoise.com/forum/emoticons/default/wink.gif" class="bbc_emoticon" alt=";)"> )))<br>
This oughta at least get you started.</esaruoho></dj_kaza>

Cheers. Not actually had a MIDI device connected for ages! Been trying to get my head around ViewBuilder just to add a valuebox for people to enter their own amount for the keyboard shortcuts and that was throwing me into confusion! Been looking at a couple of other simple things and slowly trying to wrap my head around the whole lot…

So you want a button or a number-box to define a value, which is then used to alter the bpm amount by the amount of the value?
This could be interesting.

Just a vb:valuebox - Should be simple…

Been trying to follow the GUI Tool example in the Starter Pack and not getting very far. Found it hard enough to get multiline text (in fact I gave up and did normal text with /n for newline) and then getting the value vox below, let alone returning its value, stumped me and I have been tinkering with other things.

can you just draw out what you want the gui to look out?

This doesn’t work and think I’ve had it closer at some point during my many efforts but this is where I have been struggling.

[luabox]–GUI call and design

renoise.tool():add_menu_entry {
name = “Main Menu:Tools:Tempo Tool”,
invoke = function() gui() end
}

function gui()
local vb = renoise.ViewBuilder()
local DEFAULT_MARGIN = renoise.ViewBuilder.DEFAULT_CONTROL_MARGIN
local dialog_title = “Tempo Tool”
local dialog_content = vb:column {
margin = DEFAULT_MARGIN,
vb:text {
text =
“Adjustments are currently in “…x…” BPM steps\n”…
“Set new adjustment amount below and click OK”
} }

– valuebox
local amount = vb:column {
margin = DEFAULT_MARGIN,
vb:text {
text = “Amount”
},
vb:valuebox {
min = 0.01,
max = 5,
value = x,
tostring = function(value)
return (“0x%.2X”):format(value)
end,
tonumber = function(str)
return tonumber(str, 0x10)
end,
notifier = function(value)
show_status((“valuebox value changed to ‘%d’”):
format(value))
x = value
end
}
}

local dialog_buttons = {“OK”}

renoise.app():show_custom_prompt(
dialog_title,
dialog_content,
amount,
dialog_buttons
)

end[/luabox]

Basically a standard message box:

Title - “Tempo Tool”
Text - “Adjustments are currently in “…x…” BPM steps\n”…
“Set new adjustment amount below and click OK”
VALUE BOX TO SET NEW AMOUNT.
OK Button…

Sure you get the idea, very basic for the moment and even that stumps me!

VB column: VB Row: text. end row. VB Row: text. end row. VB: Row text. end row. VB:row. button+text. end row. end column.

Well first of all, you never defined what “x” is (that’s why it shoots the first error.
now you’re trying to create a ViewBuilder valuebox that is limited to 0.01 - 5 max size, so 160(my current tempo) will shoot an error).

Sorry cut out some variables, related to boundaries but not used, of which one was x=0.1 for the 0.1 steps. So in the main program x is defined.

As the valuebox is setting the value of x, which is the amount to change on each keypress (or button-press with MIDI) and in no way related to the current Tempo(BPM) I though 0.01-5 should be ample range…

Maybe I’ll just take this to the dock and see if I can even just do a knob that sets the bpm.

As in MIDI knob? That’s probably actually easier…

No, just a bloody gui window that actually shows up. I’m getting nothing working.

Thanks Bantai, now the dialogue shows with the valuebox (terribly aligned) I just need to understand more about the formats and getting the values from and to a variable ;)

please post the functioning code

Thanks so much Bantai! That works pretty much exactly as expected (as in what I was aiming for initially.)

A couple of things.

Is it possible to change the stepping amount of the valuebox when clicking on the arrows? With a range of 0.01 - 5.0 I think a left-click step of 1 is too much!

Thinking it might be better to try and do it with a slider anyway… ;)

Almost ready to release version 0.2 officially then :)