View Single Post
Old 01-21-2018, 05:43 PM   #76
Human being with feelings
_Stevie_'s Avatar
Join Date: Oct 2017
Posts: 2,744

Okay, so I found a method that works somehow. However, I need to make some adjustments to the script. Let me explain. The script does the following:

- get the edit cursor position (in seconds)
- subtract 2 bars of the position (in seconds)
- convert the position (in seconds) to TC (format hh:mm:ss:sss)
- copy the new TC to the clipboard (can be pasted into the project start field)

Apparently, I get some issues during the conversion to hh:mm:ss:sss.
The desired TC does not sit 100% on bar 3, instead it's shifted a bit to the right.
Maybe you have some expertise in that area?

pos = reaper.GetCursorPosition() -- get edit cursor position
nom, _, _ = reaper.TimeMap_GetTimeSigAtTime(0, pos) -- get nominator of time signature
project_start = reaper.GetProjectTimeOffset(0, false) -- get project start
two_bars = reaper.TimeMap2_beatsToTime(0, 2*nom, 0) -- convert 2 bars to time
new_pos = pos - two_bars -- subtract 2 bars from position
new_pos = new_pos + project_start -- add project start offset to position

new_tc = reaper.format_timestr(new_pos, "") -- convert new position to TC (format hh:mm:ss:sss)

My Reascripts forum thread | My Reascripts on GitHub | Stephan Römer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ is online now   Reply With Quote