Old 01-06-2016, 02:12 PM   #1
swiiscompos
Human being with feelings
 
swiiscompos's Avatar
 
Join Date: Mar 2011
Location: London
Posts: 1,211
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: London
Posts: 1,211
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: Indonesia Raya
Posts: 684
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, 2957 views)
File Type: gif userinput2.gif (27.7 KB, 2895 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: 9,866
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: London
Posts: 1,211
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: Indonesia Raya
Posts: 684
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
Old 01-07-2016, 03:23 AM   #7
swiiscompos
Human being with feelings
 
swiiscompos's Avatar
 
Join Date: Mar 2011
Location: London
Posts: 1,211
Default

Quote:
Originally Posted by jrengmusic View Post
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.
Will answer and will do very soon! I still need to find a way to make the gui more intuitive (it's mostly a matter of words choice I think).

EDIT: I will post the code soon meanwhile here are the answers to your questions:

_One shorter bar allowed, automatically counted from what remains (remainder from the euclidean division). Which means the user doesn't need to input its time signature.
_+1 beat and -1 beat buttons are here to add or remove one beat because maybe you want the shorter bar to be a 2/4 instead of 3/4)
_Yes, the user inputs the target tempo. The purpose of the script is to get as close from this tempo as possible.
_When the user hits the apply button it creates the tempo/timeSig markers and it closes the gui.
_So far I need:
__1 tick box to enable the shorter bar
__1 switch to decide if the shorter bar should be at the beginning or at the end
__2 text inputs for time signature
__1 text input for target tempo
__2 buttons for +1 beat and -1 beat
__1 display screen with the number of bars created, their time signature and the calculated tempo.
__1 button to apply and close the script.

Thank you for your help!

Last edited by swiiscompos; 01-07-2016 at 03:38 AM.
swiiscompos is offline   Reply With Quote
Old 01-07-2016, 03:50 AM   #8
jrengmusic
Human being with feelings
 
jrengmusic's Avatar
 
Join Date: Jun 2015
Location: Indonesia Raya
Posts: 684
Default

just an idea,

i thought if there were options to choose between target tempo or target bar number (user can only choose one mode) it would be more useful.

in bar target mode, user only need to input the time sig and how many target bar.
jrengmusic is offline   Reply With Quote
Old 01-07-2016, 04:04 AM   #9
swiiscompos
Human being with feelings
 
swiiscompos's Avatar
 
Join Date: Mar 2011
Location: London
Posts: 1,211
Default

This is already an existing action, I don't think it would be very useful to rewrite the code... From my experience scoring, movies most of the time it's a target tempo that you have and you play around with time signatures and hit points to get as close from this target tempo as possible.

EDIT: Here is the existing code, very incomplete and with terrible formatting but it's fairly simple so you shouldn't have to much difficulty figuring it out.

Code:
function main()

t_sec = end_time-start_time --gives the time selection length in seconds  
a=0 -- 0 means only whole bars, 1 allows one shorter bar
t_tempo=121.00 --target tempo, user input
time_sig=4 --main time signature, user input (still have to include the denominator)
t_min=t_sec/60 --time in minutes


q = math.floor(t_tempo*t_min/time_sig)--number of whole bars we can fit, euclidean division.
r=t_tempo*t_min-q*time_sig --remainder of the eucliean division
inc_bar = math.floor(r + 0.5) --Round number, incomplete bar time sig


if a == 0 then
  if r<(time_sig/2) then
    tempo = q*time_sig/t_min
    n_bars_norm = q
    else 
    tempo = (q+1)*time_sig/t_min
    n_bars_norm = q+1
  end
  else
  tempo = (q*time_sig+inc_bar)/t_min
  n_bars_norm = q
end


reaper.ClearConsole()
reaper.ShowConsoleMsg(" Result="..q.." ".."Rest="..r.." ".."incomplete time sig="..inc_bar.." tempo="..tempo)
end

--RUN

-- GET TIME SELECTION EDGES
start_time, end_time = reaper.GetSet_LoopTimeRange(false, false, 0, 0, false)

-- IF TIME SELECTION
if start_time ~= end_time then
main()
end

Last edited by swiiscompos; 01-07-2016 at 04:47 AM.
swiiscompos is offline   Reply With Quote
Old 01-07-2016, 04:24 AM   #10
jrengmusic
Human being with feelings
 
jrengmusic's Avatar
 
Join Date: Jun 2015
Location: Indonesia Raya
Posts: 684
Default

it's just an idea, sometimes we need both hand in hand. like having one tool only to do similar things (for time signature). instead of calling different actions.

anyway, carry on
jrengmusic is offline   Reply With Quote
Old 01-07-2016, 04:38 AM   #11
swiiscompos
Human being with feelings
 
swiiscompos's Avatar
 
Join Date: Mar 2011
Location: London
Posts: 1,211
Default

I edited my previous post and added the code.

While both tools are about tempo and time signature, I think we use them in very different contexts, that's why I think it's good to keep them separated.
swiiscompos is offline   Reply With Quote
Old 01-07-2016, 08:15 AM   #12
swiiscompos
Human being with feelings
 
swiiscompos's Avatar
 
Join Date: Mar 2011
Location: London
Posts: 1,211
Default

Sorry, duplicate post.

Last edited by swiiscompos; 01-07-2016 at 08:29 AM.
swiiscompos is offline   Reply With Quote
Old 01-07-2016, 08:26 AM   #13
swiiscompos
Human being with feelings
 
swiiscompos's Avatar
 
Join Date: Mar 2011
Location: London
Posts: 1,211
Default

This time it's a working code! It still only works with quarter notes.

Code:
function maths()
--INIT
    t_sec = end_time-start_time --gives the time selection length in seconds  
    a=1 -- 0 means only whole bars, 1 allows one shorter bar
    b=1 -- 0 means shorter bar is at the beginning 1 at the end
    t_tempo = 121.00 --target tempo, user input
    time_sig = 4 --main time signature, user input (still have to include the denominator)
    t_min = t_sec/60 --time in minutes

 --Maths
    q = math.floor(t_tempo*t_min/time_sig)--number of whole bars we can fit, euclidean division.
    r = t_tempo*t_min-q*time_sig --remainder of the eucliean division
    inc_bar = math.floor(r + 0.5) --Round number, incomplete bar time sig


    if a == 0 then   
    if r<(time_sig/2) then
        tempo = q*time_sig/t_min
        n_bars_norm = q
        else 
        tempo = (q+1)*time_sig/t_min
        n_bars_norm = q+1
    end
    else
        tempo = (q*time_sig+inc_bar) / t_min
        n_bars_norm = q
    end
end

function deleteExistingTempoMarkers()
    delete_check = true
    while (delete_check == true)
    do
        exist_tempo_marker = reaper.FindTempoTimeSigMarker(0, end_time-1e-5)
        local retval, time_position, measureposOut, beatposOut, bpmOut, timesig_numOut, timesig_denomOut, lineartempoOut = reaper.GetTempoTimeSigMarker(0, exist_tempo_marker)
        if time_position >= start_time then
            delete_check = reaper.DeleteTempoTimeSigMarker(0, exist_tempo_marker)
        else
            delete_check = false
        end
    end
end

function insertNewTempoMarkersComplete()
    if a == 1 then
        if b == 0 then
            tempo_marker_pos = start_time + 60/tempo*inc_bar
        else
            tempo_marker_pos = start_time
        end
    else
        tempo_marker_pos = start_time 
    end
    reaper.AddTempoTimeSigMarker(0, tempo_marker_pos, tempo, time_sig, 4, false)
end

function insertNewTempoMarkerShorter()
    if b == 0 then
        short_tempo_marker_pos = start_time
    else
        short_tempo_marker_pos = start_time + n_bars_norm*time_sig*60/tempo
    end
    reaper.AddTempoTimeSigMarker(0, short_tempo_marker_pos, tempo, inc_bar, 4, false)
end

function main()
--- GET TIME SELECTION EDGES
    start_time, end_time = reaper.GetSet_LoopTimeRange(false, false, 0, 0, false)

--- IF TIME SELECTION
    if start_time ~= end_time then
        maths()
        deleteExistingTempoMarkers()
        if a == 1 then
            if b == 0 then
                insertNewTempoMarkerShorter()
                insertNewTempoMarkersComplete()
            else
                insertNewTempoMarkersComplete()
                insertNewTempoMarkerShorter()
            end
        else
            insertNewTempoMarkersComplete()
        end
        reaper.UpdateTimeline()
    end
end

--RUN
main()
Here is an example of the script in action. Of course without GUI I had to manually enter in the script the preferences. Target tempo: 120, allow shorter bar, and shorter bar is at the end.
swiiscompos is offline   Reply With Quote
Old 01-07-2016, 09:32 AM   #14
jrengmusic
Human being with feelings
 
jrengmusic's Avatar
 
Join Date: Jun 2015
Location: Indonesia Raya
Posts: 684
Default

let me know when you're done. the final code you want to GUI-ised.

just a reminder, REAPER also able to have odd number denominator. so the script should work with any number of denominator not just power of two (maybe limit up to 32, if you want to get crazy).
jrengmusic is offline   Reply With Quote
Old 01-07-2016, 10:22 AM   #15
swiiscompos
Human being with feelings
 
swiiscompos's Avatar
 
Join Date: Mar 2011
Location: London
Posts: 1,211
Default

I guess that to have a gui the script needs to run in a defer loop? So far the script is "static", how can I make it "dynamic"? Or is that part of the GUI-isation?
swiiscompos is offline   Reply With Quote
Old 01-07-2016, 10:25 AM   #16
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Here's a slightly related Lua script:

Lua: "BPM viewer / Time measuring" tool
http://forums.cockos.com/showthread....08#post1565908

spk77 is offline   Reply With Quote
Old 01-07-2016, 10:52 AM   #17
jrengmusic
Human being with feelings
 
jrengmusic's Avatar
 
Join Date: Jun 2015
Location: Indonesia Raya
Posts: 684
Default

Quote:
Originally Posted by swiiscompos View Post
I guess that to have a gui the script needs to run in a defer loop? So far the script is "static", how can I make it "dynamic"? Or is that part of the GUI-isation?
defer is part of gui-sation. just make main function worked. and comment it clearly which variable user input-able.
jrengmusic is offline   Reply With Quote
Old 01-07-2016, 03:47 PM   #18
swiiscompos
Human being with feelings
 
swiiscompos's Avatar
 
Join Date: Mar 2011
Location: London
Posts: 1,211
Default

Finished! I commented only what concerns you and put it at the top.

Code:
--[[
Compound meter mode:

if time_sig % 3 == 0 and time_sig_den == 8 then
    display tick box with text "Compound Meter". If ticked it will set compound_meter to 1 and enable the compound meter mode.
else
    compound_meter = 0
end
------------
Text output:
if a == 0 or a == 1 and inc_bar == 0 then
    print (n_bars_norm.." x "..time_sig.."/"..time_sig_den)
elseif b == 0 then
    print ("1 x "..inc_bar.."/"..time_sig_den.." + "..n_bars_norm.."x"..time_sig.."/"..time_sig_den)
elseif b == 1 then
    print (n_bars_norm.."x"..time_sig.."/"..time_sig_den.." + 1 x "..inc_bar.."/"..time_sig_den)

    
Thanks for your help!
]]

function init()
    t_sec = end_time-start_time  
    a = 0 -- Tick box. Allows creation of shorter bar. 1 is enabled, 0 disabled. Default is 0. When unticked, added_beats should be set to 0. 
    b = 0 -- Switch to set shorter bar position. 0 means short bar is at the beginning, 1 at the end
    compound_meter = 0 --see top.
    t_tempo = 120.00 --text input, target tempo. When modified, added_beats should be set to 0
    time_sig = 4 -- text input, time signature. Force intergers. Default is 4
    time_sig_den = 4 -- text input, time signature denominator. Default is 4
end

function addRemoveBeats()
    added_beats = 0 -- 2 buttons. 1 to add one beat, the other one to remove one beat
    if added_beats ~= 0 then
        total_beats = inc_bar + added_beats
        if total_beats >= 0 then
            inc_bar = total_beats % time_sig
            if inc_bar ~= 0 then
                n_bars_norm = n_bars_norm + math.floor(total_beats/time_sig)
            else
                n_bars_norm = n_bars_norm + total_beats/time_sig
            end
        elseif total_beats < 0 then
            inc_bar = (total_beats % time_sig) 
            if inc_bar ~= 0 then
                n_bars_norm = n_bars_norm - 1 + math.floor(total_beats/time_sig)
            else
                n_bars_norm = n_bars_norm + total_beats/time_sig
            end
        end
    end
end

function maths1()
    time_sig_den_b = 4 / time_sig_den
    time_sig_b = time_sig * time_sig_den_b
    t_min = t_sec/60
    if  compound_meter == 1 then
        t_tempo = t_tempo * 3 / 2
    end
    
    q = math.floor(t_tempo * t_min / time_sig_b)
    r = (t_tempo * t_min - q * time_sig_b) 
    inc_bar = math.floor(r / time_sig_den_b + 0.5)
    inc_bar_b = inc_bar * time_sig_den_b
    
    if a == 0 then   
        if r<(time_sig/2) then
            n_bars_norm = q
            else 
            n_bars_norm = q + 1
        end
        else
            n_bars_norm = q
    end

end

function maths2()
    if a == 0 then   
            tempo = n_bars_norm * time_sig_b / t_min
        else
            tempo = (n_bars_norm * time_sig_b + inc_bar_b) / t_min
    end
end

function deleteExistingTempoMarkers()
    delete_check = true
    while (delete_check == true)
    do
        exist_tempo_marker = reaper.FindTempoTimeSigMarker(0, end_time-1e-5)
        local retval, time_position, measureposOut, beatposOut, bpmOut, timesig_numOut, timesig_denomOut, lineartempoOut = reaper.GetTempoTimeSigMarker(0, exist_tempo_marker)
        if time_position >= start_time then
            delete_check = reaper.DeleteTempoTimeSigMarker(0, exist_tempo_marker)
        else
            delete_check = false
        end
    end
end

function insertNewTempoMarkersComplete()
    if a == 1 then
        if b == 0 then
            tempo_marker_pos = start_time + 60 / tempo*inc_bar_b
        else
            tempo_marker_pos = start_time
        end
    else
        tempo_marker_pos = start_time 
    end
    reaper.AddTempoTimeSigMarker(0, tempo_marker_pos, tempo, time_sig, time_sig_den, false)
end

function insertNewTempoMarkerShorter()
    if b == 0 then
        short_tempo_marker_pos = start_time
    else
        short_tempo_marker_pos = start_time + n_bars_norm*time_sig_b*60/tempo
    end
    reaper.AddTempoTimeSigMarker(0, short_tempo_marker_pos, tempo, inc_bar, time_sig_den, false)
end

function main()
--- GET TIME SELECTION EDGES
    start_time, end_time = reaper.GetSet_LoopTimeRange(false, false, 0, 0, false)

--- IF TIME SELECTION
    if start_time ~= end_time then
        init()
        maths1()
        deleteExistingTempoMarkers()
        if a == 1 then
            addRemoveBeats()
            maths2()
            if b == 0 then
                insertNewTempoMarkerShorter()
                insertNewTempoMarkersComplete()
            else
                insertNewTempoMarkersComplete()
                insertNewTempoMarkerShorter()
            end
        else
            maths2()
            insertNewTempoMarkersComplete()
        end
        reaper.UpdateTimeline()
    end
end

--RUN
main()
swiiscompos is offline   Reply With Quote
Old 01-08-2016, 09:37 AM   #19
jrengmusic
Human being with feelings
 
jrengmusic's Avatar
 
Join Date: Jun 2015
Location: Indonesia Raya
Posts: 684
Default

i've read the code.

add remove beat is a confusing for me to design the UI either later as user. we need to type then click the button to decrease or increase.

why not just typing second time signature for shorter bar if shorter bar is allowed?
jrengmusic is offline   Reply With Quote
Old 01-08-2016, 09:59 AM   #20
swiiscompos
Human being with feelings
 
swiiscompos's Avatar
 
Join Date: Mar 2011
Location: London
Posts: 1,211
Default

Do you mean it's complicated to implement? The code has been conceived so that you simply need to add or remove 1 to added_beats each time you press the buttons.
The purpose is not to add several bars (even if you could) but simply to have a very quick way to add or remove one or two beats which is something you often want to do when working on movies. The purpose of the script is to allow the user to try quickly different options without having to figure out any maths. It's a tool for tight deadlines... or lazy people!

But I understand how it's confusing right now, the buttons should probably be below the result output.

EDIT: and the purpose of the shorter bar is to get a tempo closer from the target tempo, so it would make no sense to input its time signature manually.

Last edited by swiiscompos; 01-08-2016 at 10:37 AM.
swiiscompos is offline   Reply With Quote
Old 01-08-2016, 12:34 PM   #21
jrengmusic
Human being with feelings
 
jrengmusic's Avatar
 
Join Date: Jun 2015
Location: Indonesia Raya
Posts: 684
Default

i mean it's complicated to understand, the way it works.

i know how to count bars for composing music illustration.

i'm even lazier, sometimes i just play and forget about the grid or click at all. and it just works.

but imagine, you have a pace or hit points. with a tempo in mind you open the scripts type in a bunch of input, yet you have to click more buttons and options and time measurement only created after you commit apply.

which it may fit or it may not, so you might have to open and calculate several time. typing and clicking many options until it fits.

i thought the purpose of this script is to make things easier and faster.
jrengmusic is offline   Reply With Quote
Old 01-08-2016, 12:58 PM   #22
swiiscompos
Human being with feelings
 
swiiscompos's Avatar
 
Join Date: Mar 2011
Location: London
Posts: 1,211
Default

No, when you input the target tempo the script will automatically calculate the number of bars, including the shorter bar if the option is on an then it will output the result as text (for example "12 x 4/4 + 1 x 3/4, tempo: 120.83", like on the mockup). At this point you can simply hit "Apply".

Now imagine that your target tempo was 120. Maybe you prefer to have a 2/4 rather than 3/4 and in this case you can simply click the "-1 beat" button to get a preview of what the new tempo would be. If you don't want to use the buttons, you don't have to, the script will still run correctly.

Also you hit "Apply" only at the very end of the process, that's why you have a text output, to let you preview the created bars before you hit "apply".

The script has been created so that each time an option/input is modified you simply have to run the whole script once.

EDIT:
So basically you can just enter a target tempo and hit apply. It will create a new bars, all 4/4 time signature.

Or you can enable the creation of a short bar, position it at the end, enter a target tempo, decide you are not totally happy with the result, use the +1/-1 beat buttons to see how far another time signature would be from your target tempo, and finally hit apply when you are satisfied.

Last edited by swiiscompos; 01-08-2016 at 01:11 PM.
swiiscompos is offline   Reply With Quote
Old 01-08-2016, 03:13 PM   #23
jrengmusic
Human being with feelings
 
jrengmusic's Avatar
 
Join Date: Jun 2015
Location: Indonesia Raya
Posts: 684
Default

Quote:
Originally Posted by swiiscompos View Post
No, when you input the target tempo the script will automatically calculate the number of bars, including the shorter bar if the option is on an then it will output the result as text (for example "12 x 4/4 + 1 x 3/4, tempo: 120.83", like on the mockup). At this point you can simply hit "Apply".

Now imagine that your target tempo was 120. Maybe you prefer to have a 2/4 rather than 3/4 and in this case you can simply click the "-1 beat" button to get a preview of what the new tempo would be. If you don't want to use the buttons, you don't have to, the script will still run correctly.

Also you hit "Apply" only at the very end of the process, that's why you have a text output, to let you preview the created bars before you hit "apply".

The script has been created so that each time an option/input is modified you simply have to run the whole script once.

EDIT:
So basically you can just enter a target tempo and hit apply. It will create a new bars, all 4/4 time signature.

Or you can enable the creation of a short bar, position it at the end, enter a target tempo, decide you are not totally happy with the result, use the +1/-1 beat buttons to see how far another time signature would be from your target tempo, and finally hit apply when you are satisfied.

That's exactly my point.

"12 x 4/4 + 1 x 3/4, tempo: 120.83", shows the result of the calculation. But it doesn't show anything about how well does the calculation fit the user need. How could i know that 12 bar of 4/4 with one bar 2/4 or 3/4 with extra clicking will hit my hit points? That would be extra effort just to digest the info.

and "12 x 4/4 + 1 x 3/4, tempo: 120.83" is a very long and complex string to fit in the UI. It definitely will make the UI window need to be larger. Which easily makes everything look messed up with so many text input, button, options.

i'd rather click drag the grid to my hit points, to exact point and exact duration where i need to my measure to be. which there are already SWS actions for that. No typing and button clicking, no thinking about meter and math by reading long info.

another to consider in UI prespective are, typing and button clicking never get along together except it will slow you down by changing hand position, which is cumbersome.

Last edited by jrengmusic; 01-08-2016 at 03:19 PM.
jrengmusic is offline   Reply With Quote
Old 01-08-2016, 03:20 PM   #24
swiiscompos
Human being with feelings
 
swiiscompos's Avatar
 
Join Date: Mar 2011
Location: London
Posts: 1,211
Default

It does always hit the hit point, it's the point of the script. It uses the time selection to find how to hit the hit point (end of time selection). The point (no pun intended) of the script is to create bars between two hit points.

And yes, it's a long string, that's why the tempo is in a separate line in my mockup.

Here is one of my workflows when working on a movie: I feel that the right tempo for a cue is around 80, I have to start exactly at the beginning of the clip and my first hit point is 15 seconds later. I will make a time selection from the beginning to the first hit point, run the script, input the time signature and the target tempo and look if I'm pleased with the result (using the text output). If necessary I can adjust the result with the +/-1 beat buttons.
For me, and all the people trained in my school (and that's a lot of film scoring students), a script working this way would be extremely useful and I really think that all these options are a huge plus.

And since the tempo mapping process implies several creative decisions, it's ok if we loose some time going from typing to clicking as long as it allows to make a better choice in the end. We are trained on DP which uses many of these windows with typing and clicking and it's not that bad for this kind of task.

Last edited by swiiscompos; 01-08-2016 at 03:29 PM.
swiiscompos is offline   Reply With Quote
Old 01-09-2016, 03:14 AM   #25
swiiscompos
Human being with feelings
 
swiiscompos's Avatar
 
Join Date: Mar 2011
Location: London
Posts: 1,211
Default

I won't have internet access until next Wednesday. Since the buttons don't seem to difficult to implement, why not make a version with and a version without the +/- 1 beat buttons? If they really bother you you can even simply discard them and I will probably figure out how to add them.
swiiscompos is offline   Reply With Quote
Old 01-09-2016, 05:35 AM   #26
jrengmusic
Human being with feelings
 
jrengmusic's Avatar
 
Join Date: Jun 2015
Location: Indonesia Raya
Posts: 684
Default

actually it was piece of cake. it's just a matter of workflow that confuses me as user. which vaporise the main purpose of scripting in the first place.

the way it turns out i don't think this script would be useful for me anymore

anyway, as you wish boss

Attached Files
File Type: lua ATT.lua (12.4 KB, 409 views)
jrengmusic is offline   Reply With Quote
Old 01-09-2016, 05:57 AM   #27
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,866
Default

@Jreng
Wow, that was fast !
Nice GUI BTW !


Note: I took a look at your code. it is so condesned haha, don't you like empty lines ? :P

Also, consider having header metadatas, so that the users can have basic infos about this file, especially it's version (to see it is up to date).

Have you plan to have a github or something to store all your scripts ?
X-Raym is offline   Reply With Quote
Old 01-09-2016, 06:03 AM   #28
jrengmusic
Human being with feelings
 
jrengmusic's Avatar
 
Join Date: Jun 2015
Location: Indonesia Raya
Posts: 684
Default

Quote:
Originally Posted by X-Raym View Post
@Jreng
Wow, that was fast !
Nice GUI BTW !


Note: I took a look at your code. it is so condesned haha, don't you like empty lines ? :P

Also, consider having header metadatas, so that the users can have basic infos about this file, especially it's version (to see it is up to date).

Have you plan to have a github or something to store all your scripts ?
i've wrote a much more complicated GUI than this, so much more

haha that github things
jrengmusic is offline   Reply With Quote
Old 01-09-2016, 10:46 AM   #29
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,866
Default

@jrengmusic
It is not about complexity, but efficiency :P And this one does look great !

Quote:
haha that github things
Yep. Same old. :P

We are trying to push scripts on more central databases (like ReaTeam) so that users can find them more easily, and so that updates are stored more easily as well (contrary to scripts that are uploaded here and there in 15 different versions).

Also, scripts pushed in such directories could benefit from the ReaPack scripts download in progress

But I'll understand if you are not interested. That is some extra steps that may sounds a bit boring to do.
X-Raym is offline   Reply With Quote
Old 01-13-2016, 03:54 PM   #30
swiiscompos
Human being with feelings
 
swiiscompos's Avatar
 
Join Date: Mar 2011
Location: London
Posts: 1,211
Default

Quote:
Originally Posted by jrengmusic View Post
actually it was piece of cake. it's just a matter of workflow that confuses me as user. which vaporise the main purpose of scripting in the first place.

the way it turns out i don't think this script would be useful for me anymore

anyway, as you wish boss

Haha, you're the best! Or at least you're very good, thank you so much!! For some reason it makes more sense for me to put the -1 beat on the left... but I can change that myself. If you want to change the script to fit your needs feel free to do it!

EDIT: just one question: is it possible to go from on text input to the next using the tab key (for the top line)?? That would be awesome and speed up quite a bit the workflow.
swiiscompos is offline   Reply With Quote
Old 01-13-2016, 04:52 PM   #31
swiiscompos
Human being with feelings
 
swiiscompos's Avatar
 
Join Date: Mar 2011
Location: London
Posts: 1,211
Default

v1.1
+ moved "- BEAT" button to the left
+ added some header metadatas
# fixed a bug with +/- BEAT buttons

(maybe that's why you didn't understand why I wanted these buttons??)

Licecap:
Attached Files
File Type: lua ATT_v1.1.lua (13.1 KB, 420 views)
swiiscompos is offline   Reply With Quote
Old 01-14-2016, 12:07 AM   #32
jrengmusic
Human being with feelings
 
jrengmusic's Avatar
 
Join Date: Jun 2015
Location: Indonesia Raya
Posts: 684
Default

* v1.2 (14-Jan-2014) ------------ JRENG!
# bug fix textbox curState
# add key TAB to cycle textboxes
# add key ENTER to apply
Attached Files
File Type: lua ATT_v1.2.lua (13.5 KB, 354 views)
jrengmusic is offline   Reply With Quote
Old 01-14-2016, 04:34 AM   #33
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: South, UK
Posts: 14,214
Default

cool! I'll try this out soon, many thanks for it!
__________________
subproject FRs click here
note: don't search for my pseudonym on the web. The "musicbynumbers" you find is not me or the name I use for my own music.
musicbynumbers is offline   Reply With Quote
Old 01-14-2016, 08:45 AM   #34
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,866
Default

@jreng
Good job

When creating a measure, the script quit. Why not just leave it open ?
X-Raym is offline   Reply With Quote
Old 01-14-2016, 09:08 AM   #35
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

This is insane ... wow !!
vanhaze is offline   Reply With Quote
Old 01-14-2016, 09:16 AM   #36
swiiscompos
Human being with feelings
 
swiiscompos's Avatar
 
Join Date: Mar 2011
Location: London
Posts: 1,211
Default

Quote:
Originally Posted by X-Raym View Post
@jreng
Good job

When creating a measure, the script quit. Why not just leave it open ?
Probably because I asked for that, but actually it makes much more sense to leave it open!

* v1.3 (14-Jan-2014) ------------ Ducky Duc
# Stays open after creating measures
# Create end tempo marker only when necessary
Attached Files
File Type: lua ATT_v1.3.lua (13.7 KB, 429 views)

Last edited by swiiscompos; 01-14-2016 at 10:04 AM.
swiiscompos is offline   Reply With Quote
Old 01-14-2016, 10:20 AM   #37
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,866
Default

playing with it a bit, I start to see its potential !

Maybe a bug : if I had to create 120 BPM 2X5/4 and I press Beat -, it display 1 4/4 + 0X5/4 (instead of 1X4/4 + 1X5/4) (so it jump from 120 bpm to 48).
Do you confirm ?

Also, there is a Beat+, Beat_, maybe if should be a indictaor that there is no beat offset. Like having dark greay background on both button if they don't have offset, and light green on the side where there is an offset. So that we can reset offset easily, and see what side of the offset (minus or plus) was activated.
What do you think of that ?
X-Raym is offline   Reply With Quote
Old 01-14-2016, 10:29 AM   #38
swiiscompos
Human being with feelings
 
swiiscompos's Avatar
 
Join Date: Mar 2011
Location: London
Posts: 1,211
Default

I confirm, also it made me discover a new bug... And I agree for the offset, maybe we should rather have a "Reset Offset" button that turns from gray to green, or appears, as soon as there is an offset.
swiiscompos is offline   Reply With Quote
Old 01-14-2016, 10:49 AM   #39
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,866
Default

I vote for Reset button, and background color or offset button according to offset direct :P And maybe the number of Beat that was added too ?
There is a lot of possibilities with such script :P
X-Raym is offline   Reply With Quote
Old 01-14-2016, 10:51 AM   #40
swiiscompos
Human being with feelings
 
swiiscompos's Avatar
 
Join Date: Mar 2011
Location: London
Posts: 1,211
Default

Quote:
Originally Posted by X-Raym View Post
and background color or offset button according to offset direct
I don't understand this part... Anyway, first I will fix this nasty bug!
swiiscompos 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 12:16 AM.


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