I’m using the SRTReader and i need to set a value for the duration of each subtitle whenever a new line is displayed.
The Reader has outputs for time elapsed and time remaining which are identical as far as I can tell, so what I need to do as grab the value every time that goes from zero to something, grab that something and set that value so i have the duration of the subtitle in seconds, with that value staying persistent and not changing until a new line of subtitles is displayed.
For context i’m trying to get the time in seconds where a specific word is spoken using the sift node alongside the length of the subtitle later on in my patch, sort of like a karaoke machine that fills up with words as they get sung, but in this case just giving me a rough offset in seconds to apply as a delay to get a bang to happen around the point in time that word is spoken.
Elapsed and Remaining do not display the same value, but what the names suggest.
Elapsed shows time since the beginning of the subtitle while Remaining shows time until the end.
To get the total time you could add the two or sample Remaining at the beginning as you have suggested.
Adding the two together will be more precise as the first seen Remaining value will depend on your framestep.
To sample and hold a value, you can use the S+H node. To find out whether a value became non-zero a combination of > and TogEdge can be used.