square-zero-labs commited on
Commit
b40231e
·
1 Parent(s): 20f1418

Fixed duplicate sound in last window

Browse files
Files changed (2) hide show
  1. README.md +16 -0
  2. ltx_foley_v2a/nodes.py +22 -3
README.md CHANGED
@@ -245,6 +245,22 @@ with its default RAM-pressure caching and is evicting node outputs mid-run.
245
  Start ComfyUI with `--cache-classic` (the RunPod script already does this). The
246
  generated audio is still correct either way — the re-execution only costs time.
247
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  ### Audio Artifacts On Some ComfyUI Versions
249
 
250
  The workflows have been tested on ComfyUI `v0.27.0` and run
 
245
  Start ComfyUI with `--cache-classic` (the RunPod script already does this). The
246
  generated audio is still correct either way — the re-execution only costs time.
247
 
248
+ ### Duplicate Sounds At Window Boundaries
249
+
250
+ In `foley-sliding-window.json`, neighboring windows overlap (default `1.0`
251
+ second) and each window generates its audio independently. If a distinct sound
252
+ event (a door close, a footstep) falls inside an overlap region, both windows
253
+ may render it slightly out of alignment, and you can hear the event twice
254
+ around a window boundary. The run log's `planned N windows starts=[...]` line
255
+ shows where the boundaries are (`start_frame / fps` seconds).
256
+
257
+ If you hear this, reduce the **Window overlap** (`overlap_seconds` on the
258
+ window-plan node), for example from `1.0` to `0.5`. A smaller overlap makes it
259
+ less likely an event lands in the shared region, at the cost of a shorter
260
+ crossfade between windows. Avoid large overlaps: the bigger the overlap, the
261
+ more of the video is generated twice, which increases the chance of doubled
262
+ sounds.
263
+
264
  ### Audio Artifacts On Some ComfyUI Versions
265
 
266
  The workflows have been tested on ComfyUI `v0.27.0` and run
ltx_foley_v2a/nodes.py CHANGED
@@ -60,7 +60,24 @@ def _window_specs(source_frames: int, fps: float, window_frames: int, overlap_se
60
 
61
  starts = list(range(0, last_start + 1, hop_frames))
62
  if starts[-1] != last_start:
63
- starts.append(last_start)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
  return [
66
  {
@@ -615,14 +632,16 @@ class LTXFoleyWindowPlan:
615
  "truncated_by_max_windows": truncated,
616
  "window_specs": specs,
617
  }
 
618
  if truncated:
619
  print(
620
  "[LTXFoley] diagnostic truncation: "
621
- f"planned {len(all_specs)} windows, running first {len(specs)} because max_windows={max_windows}",
 
622
  flush=True,
623
  )
624
  else:
625
- print(f"[LTXFoley] planned {len(specs)} windows", flush=True)
626
  return (plan, len(specs), json.dumps(plan, indent=2))
627
 
628
 
 
60
 
61
  starts = list(range(0, last_start + 1, hop_frames))
62
  if starts[-1] != last_start:
63
+ remainder = last_start - starts[-1]
64
+ if len(starts) > 1 and remainder <= overlap_frames:
65
+ # A snapped-to-end window this close to the previous start would
66
+ # show the model nearly the same frames twice, and the second
67
+ # generation can repeat events (e.g. a door close) near the end of
68
+ # the stitched audio. Merging is only safe up to overlap_frames:
69
+ # the window before the replaced start reaches exactly
70
+ # starts[-1] + overlap_frames, so any larger remainder would leave
71
+ # a zero-weight (silent) coverage gap instead.
72
+ print(
73
+ "[LTXFoley] merging final window: "
74
+ f"start {starts[-1]} -> {last_start} "
75
+ f"(remainder {remainder} <= overlap {overlap_frames})",
76
+ flush=True,
77
+ )
78
+ starts[-1] = last_start
79
+ else:
80
+ starts.append(last_start)
81
 
82
  return [
83
  {
 
632
  "truncated_by_max_windows": truncated,
633
  "window_specs": specs,
634
  }
635
+ start_frames = [spec["start_frame"] for spec in specs]
636
  if truncated:
637
  print(
638
  "[LTXFoley] diagnostic truncation: "
639
+ f"planned {len(all_specs)} windows, running first {len(specs)} because max_windows={max_windows} "
640
+ f"starts={start_frames}",
641
  flush=True,
642
  )
643
  else:
644
+ print(f"[LTXFoley] planned {len(specs)} windows starts={start_frames}", flush=True)
645
  return (plan, len(specs), json.dumps(plan, indent=2))
646
 
647