Old 01-06-2016, 02:12 PM   #1
swiiscompos
Human being with feelings
 
swiiscompos's Avatar
 
Join Date: Mar 2011
Location: Lausanne (CH)
Posts: 1,092
Default Lua: Advanced Tempo Tool

This script calulate the best number of measures to fit in a time selection to get as close from a target tempo as possible . You can choose to have a shorter measure at the beginning or at the end of the time selection. You can also offset the number of beats, use a compound meter mode or lock the number of measures to experiment with different time selections. These features makes it an ideal tool for media composers who want to experiment with different tempo mapping ideas.

v1.5 has been released! Huge thank you to JRENG! for helping with the GUI!

* v1.5 (16-Jan-2014) ------------ Ducky Duc
# bigger preview area and font
+ button to lock number of measures



Code:
* v1.1 (14-Jan-2014) ------------ Ducky Duc
+ moved "- BEAT" button to the left
+ added some header metadatas
# fixed a bug with +/- BEAT buttons 

* v1.2 (14-Jan-2014) ------------ JRENG!
# bug fix textbox curState
# add key TAB to cycle textboxes
# add key ENTER to apply 

* v1.3 (14-Jan-2014) ------------ Ducky Duc
# Stays open after creating measures
# Create end tempo marker only when necessary 

* v1.4 (14-Jan-2014) ------------ Ducky Duc
# small code optimizations
+ add offset indicator, click on it to reset offset
# fix bug with negative inc_bar
# more consistent preview 

* v1.41 (14-Jan-2014) ------------ Ducky Duc
# bug fix with toggle short bar

* v1.5 (16-Jan-2014) ------------ Ducky Duc
# bigger preview area and font
+ button to lock number of measures
Download: http://forum.cockos.com/attachment.p...1&d=1453000686

Screenshot of v1.5:

Last edited by swiiscompos; 01-16-2016 at 08:27 PM.
swiiscompos is offline   Reply With Quote
Old 01-06-2016, 04:45 PM   #2
swiiscompos
Human being with feelings
 
swiiscompos's Avatar
 
Join Date: Mar 2011
Location: Lausanne (CH)
Posts: 1,092
Default

I finished the maths, it was very easy. Now I need help with how to input the target tempo (maybe an input box would be actually better than a slider), the time signature and how to create a tick box. Thanks!

EDIT: script is basically finished and works well, I just need help with UI (inputs, tick boxes and "tempo"/"time sign of shorter bar" output.

Last edited by swiiscompos; 01-06-2016 at 05:50 PM.
swiiscompos is offline   Reply With Quote
Old 01-06-2016, 08:32 PM   #3
jrengmusic
Human being with feelings
 
jrengmusic's Avatar
 
Join Date: Jun 2015
Location: New York
Posts: 410
Default

REAPER only have one type of user input. textbook input, max of 8 input.

with reaper.GetUserInputs(), this is what you'll get



it only took a single line, and single function to call.

or with a little bit effort and a dozen functions, using gfx functions this is what you can get



actually you can draw anything using gfx. from text input, checkbox, or anything you can imagine.

but most of the code of the script itself would be GUI, and how user interact with them, which can be a lot and complicated.

oh, and it could take more of cpu resources (but i think, if it only runs to get user input nothing to be worried).

which one do you prefer?
Attached Images
File Type: gif userinput1.gif (32.6 KB, 1050 views)
File Type: gif userinput2.gif (27.7 KB, 1038 views)

Last edited by jrengmusic; 01-06-2016 at 08:42 PM.
jrengmusic is offline   Reply With Quote
Old 01-07-2016, 12:53 AM   #4
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,140
Default

@Jreng
Actually, Reaper has also ShowMessageBox (and MB) function for input, with several type of basic window with OK, OK-CANCEL, OK-RETRY-CANCEL etc :P

For sliders, spk77 has built slider class, checkbox, and button (and knobs) if you want more GUI things, without recrating the wheel.

@swiiscompos
Maybe you could provide some mockups/draft of what you want in order to help your potential helpers underwtand what it is all about :P
X-Raym is offline   Reply With Quote
Old 01-07-2016, 02:27 AM   #5
swiiscompos
Human being with feelings
 
swiiscompos's Avatar
 
Join Date: Mar 2011
Location: Lausanne (CH)
Posts: 1,092
Default

Here is a quick and terrible mockup but hopefully you get what I mean.
"Main Time Signature" is formed of two input boxes. It will give the time signature for all the bars except the shorter one if option is enabled (the 3/4 bar in my mockup).

swiiscompos is offline   Reply With Quote
Old 01-07-2016, 03:15 AM   #6
jrengmusic
Human being with feelings
 
jrengmusic's Avatar
 
Join Date: Jun 2015
Location: New York
Posts: 410
Default

designing functional UI must be as simple as possible. short words, but informative and intuitive.

i'm interested to help you with UI, i thought this tool would be useful. i already have a bunch GUI functions in LUA and EEL.

could you elaborate more
  • how many shorter bar are allowed?
  • or is it just one bar (automatically counted) whatever remains from time selection?
  • does user need to input the shorter bar time signature?
  • what does +1 beat and -1 beat button are for?
  • does user need to input the target tempo? or is it just showing the result?
  • what happened after user click the apply button? is the UI still opened? or the script closed immediately?
  • in conclusion, could you elaborate which values user need to input and how? (e.g two text input for beat and denominator, button for shorter bar, button for shorter bar position, etc)

before, i was thinking for time signature input we could provide two big boxes with button to increase and decrease, but then i just found out that REAPER allowed odd number denominator (that's not power of two). which might be easier just make an text input box.

it would be much easier if you post the code, and show us which value needed from user.
jrengmusic is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:45 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.