Hi All,
I recently ran into an issue where having already timestamped lyric sheets and added MIDI events to automate device patch changes, I had a need to add 1-2 bars to the start of most songs.
This was obviously going to throw out all the timestamps and require a lot of manual effort to re-timestamp everything.
While I knew what would be required in theory for a code approach to regex through my lyric sheet, determine what was a time stamp, determine whether the MS value was in 2 digits (10th of a second) or 3 digits ('true' milliseconds), and then add a defined amount of milliseconds to every timestamp, I'm no coder.
So I turned to ChatGPT. A few hours later I have 192 lines of python code that I can package as a Windows .exe that I can drag and drop either a Word document (I use these as my starting point for lyric sheets and include all the ST formatting and timestamps) or a plain text file (what I copy my Word doc into and then also have all of my MIDI automation events in) or even just a multiline window if I want to quickly transform a few lines and can just as easily copy and paste in and out.
So to explain how I plan to use this, this is an example:
- A need arises to add 1 bar extra to the start of a backing track
- I go into my DAW, add the 1 bar (and whatever is actually needed, Cues, additional count-in, whatever.) and re-export my new backing track, click/cues track, etc. Now that I've essentially added 1 bar duration to the start of my audio tracks, all of the timestamps in my lyric sheet are going to be 'out' by the duration of the 1 bar.
- From my DAW I calculate, in seconds to 3 decimal places, how much time this 1 bar has added to my backing tracks. This is how much time I need to add to all the timestamps on my existing lyric sheet, so that the lyric highlight and MIDI events still occur at the right place in the song. So, as an example, the song is 109bpm and is in 4/4 and that 1 bar extra has added 2.202 sec to my audio track exports.
- I drag and drop the lyric sheet (Word docx or plain text format) for the song onto my app to load it (or use the Browse button).
- I enter "2.202" into the delta time field
- I click "Run Update"
- A new version of the file, with _updated appended to the filename is produced
- In ST3, for that song, I load up the new audio files and lyric sheet
This is a very quick and dirty app, but from my tests, it does what I need and does it accurately.
Very simply:
- It will parse through a docx or txt file
- Find all "timestamps" in the format [MM:SS.MS] or [midi@MM:SS.MSS:
- It will take a number you enter in seconds (positive or negative value, up to 3 decimal places) and add it to those timestamps
- It will produce a new version of the Word docx (with all formatting retained) or plain text file with the updated timestamps
It's written in Python and I'll include a Windows executable package that anyone running Windows can simply run, as well as the python script so others can use in whatever way suits them.
I've built it all in Python 3.12.3 and anyone using the script will need to import 2 libraries - python-docx tkinterdnd2 (i.e. pip install python-docx tkinterdnd2
)
I won't be providing support for this. Heck, I didn't really write it (ChatGPT did) so I couldn't really even if I wanted!
Equally, suggestions for improvement, feature requests, etc. aren't on my radar. This does what I need and that's all that I need. That said, feel free to do whatever you want with the code if you want to build on it, improve it, etc.
https://mega.nz/file/4fxH2KQQ#CDygIAHD-ib_jVdBD8FHewtRjLOGpwDOb4VJAxqJiN4