File size: 1,275 Bytes
d81ecd8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | """Shared cut map: source intervals removed, and source->output time mapping."""
# (start, end) in SOURCE seconds to REMOVE (dead-air / loading / thinking pauses)
REMOVED = [
(268.92, 269.70), # "fire this up." pause
(271.58, 273.16), # model "thinking" dead-air (keep a beat, drop the rest)
(315.70, 316.60), # loading pause before "20 tokens per second"
]
SRC_DURATION = 393.79
def keep_segments():
"""Complement of REMOVED over [0, SRC_DURATION]."""
segs = []
cur = 0.0
for a, b in REMOVED:
if a > cur:
segs.append((cur, a))
cur = b
if cur < SRC_DURATION:
segs.append((cur, SRC_DURATION))
return segs
def map_time(t: float) -> float:
"""Map a SOURCE timestamp to the OUTPUT (post-cut) timeline."""
removed_before = 0.0
for a, b in REMOVED:
if t >= b:
removed_before += (b - a)
elif t > a: # inside a removed gap -> clamp to gap start
return a - removed_before
return t - removed_before
def out_duration() -> float:
return map_time(SRC_DURATION)
if __name__ == "__main__":
print("keep segments:", [(round(a, 2), round(b, 2)) for a, b in keep_segments()])
print("output duration:", round(out_duration(), 2))
|