Prompt48 commited on
Commit
d81ecd8
·
verified ·
1 Parent(s): 40f83d4

Upload edit\cutmap.py with huggingface_hub

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