Replies: 4 comments 1 reply
-
Here's what i'm returning vs: what the timecodes are in the session: |
Beta Was this translation helpful? Give feedback.
-
In
When |
Beta Was this translation helpful? Give feedback.
-
Thanks for the tip @iluvcapra. I actually realized that since all i'm doing is counting frames, my error was actually using the real frame-rate, rather than the full integer equivalent, since there are 24 frames per second as far as timecode goes, it's just not a "real" second. So all i needed to do was set my calculation framerate to 24 if 23.976 etc... and now it seems it's working. |
Beta Was this translation helpful? Give feedback.
-
I personally use this Library for timecode stuff. Here is a new version of your code using it. I can't test it right now, but i think it should work. #list memory locations
import sys
from ptsl import open_engine
from ptsl import PTSL_pb2 as pt
delimiter='###'
def samples_to_timecode(samples, sample_rate):
# split string reponse at "Fps" and use second half to get "23976"
frame_rate = pt.SessionTimeCodeRate.Name(engine.session_timecode_rate()).split("Fps")[1]
# insert dot into string if needed
if len(frame_rate) > 2:
frame_rate = frame_rate[:2] + "." + frame_rate[2:]
frames = round(int(samples) / (sample_rate / float(frame_rate)))
# pip install timecode || https://github.com/eoyilmaz/timecode
from timecode import Timecode
tc = Timecode(framerate=frame_rate, frames=frames)
return(tc)
with open_engine(company_name="py-ptsl",
application_name=sys.argv[0]) as engine:
print("Marker List:")
marker_list = engine.get_memory_locations()
for marker in marker_list:
mode = list(" ")
timecode = samples_to_timecode(marker.start_time, engine.session_sample_rate())
print(marker.number,delimiter,marker.name,delimiter,timecode) |
Beta Was this translation helpful? Give feedback.
-
Hi! I'm trying to return the timecode of the memory locations from a session and having some issues (i assume i'm doing some bad math somewhere....) Is there an easier way to do this? Pulling the data from AppleScript on large sessions is SUPER slow, and this pulls the memory location list super fast even on very large sessions, but my timecodes get off by a few frames.
My script is below: forgive my code, i'm a sound designer, not a programmer ;)
Beta Was this translation helpful? Give feedback.
All reactions