Questions & Answers

[FR] Calculate project BPM for measure 5 (to match song BPM)

+5 votes
198 views
asked Jul 4, 2021 in Editing by justinmeyer (3,020 points)
edited Jul 4, 2021 by justinmeyer

Hello,

Can you please implement a function to re-calculate the project BPM in order to move the cursor to measure 00005.01.01.00?
This is useful to match the BPM of a reference song.

Let's say the project BPM is 120 and the reference song's BPM is ~ 93,6 BPM.
In such a case the user has to place the cursor on the reference song track where measure 00005.01.01.00 WOULD be.
(This is ok and probably too difficult for a program, even BPMCounters aren't that reliable.)

But now the user has to change the project BPM until the cursor has reached 00005.01.01.00.
This can be pretty time-consuming and tiresome.

I created an AHK script which makes it with 1 key press, but an internal function would be much better and safer!
F1::
MouseMove, 920, 1368, 0 ; Move mouse to position field
Send {rbutton} ; Right click on position field
Sleep, 100
Send {Down} ; Select field "Copy text to Clipboard"
Sleep, 10
Send {Enter} ; Copy current position, e.g. 0006.01.03.01
Sleep, 10
StringSplit, string, Clipboard, . ; Split Clipboard content on each dot
measure := string1 - 1, beat := string2 - 1, ticks := string3 -1 . string4 ; Assign values to variables
measureTicks := measure * 400 * 4 ; Get all measure ticks
beatTicks := beat * 400 ; Get all beat ticks
allTicks := measureTicks + beatTicks + ticks ; Count them all together, e.g 8201 ticks
Click, 1860, 1360, 1 ; Left click inside of BPM field
Sleep, 100
Send ^c ; Copy BPM
Sleep, 100
songBpm := 6400 / allTicks * Clipboard ; e.g. 6400 / 8201 * 120 = 93,64711620534081 BPM (6400 ticks = 00005.1.1.00)
Clipboard := songBpm ; Assign value to Clipboard to paste it later
Sleep, 100
Click, 1860, 1360, 1 ; Left click inside of BPM field
Sleep, 200
Send ^a ; Mark all values of BPM
Sleep, 10
Send {Delete} ; Delete marked values
Sleep, 10
Send ^v ; Paste songBPM
Send {Enter} ; Set new BPM and leave field
return

Thanks for reading and best regards!

P.S: No idea why the picture is so small. It just demonstrates the "before-after" effect of the script.

...