DEV Community

Cover image for Keep Short Drama Storyboard Audio in Sync With Python
Daniel Foster
Daniel Foster

Posted on

Keep Short Drama Storyboard Audio in Sync With Python

You add two seconds to a storyboard shot so the audience can see a clue. Suddenly the dialogue in the next shot starts before the clue appears. Fixing one timing mistake by hand is easy. Across several episodes, keeping the scratch audio aligned with revised panels becomes a bookkeeping problem.

A small Python script can calculate the new cue times from a list of panel durations. Use these times to reposition the temporary dialogue in your editor. The script leaves the audio files untouched, so you keep control over the actual cut.

Start with the action that triggers the line

Imagine a short drama set in an upholstery shop. Lia lifts a fabric sample to reveal a burn mark and says, "There. Under the seam." Her customer leans forward to inspect it.

Panel Duration before Duration after Picture
06 3 s 5 s Lia lifts the fabric.
07 4 s 4 s Her finger rests beside the visible mark.
08 3 s 3 s The customer leans closer.

The line begins half a second into panel 07. Before the edit, that means 3.5 seconds into the scene. After the edit, it means 5.5 seconds. The same half-second delay still gives viewers time to see what Lia is pointing at.

If you're working from a multi-episode Word script, DramaPilot Storyboard Writer can help you review the episode split and generate the panels. Number the approved stills consistently in your own cue sheet. That way, a change to one panel has a clear reference for the editor.

Calculate cue positions with Python

You need Python 3 and a list of panels in playback order. Create a file named cue_times.py with the following example. Times are in seconds. The panel data stands in for a timing sheet you maintain.

panels = [("06", 5), ("07", 4), ("08", 3)]
cues = [("07", 0.5, "There. Under the seam.")]

starts = {}
durations = {}
elapsed = 0.0
for panel, seconds in panels:
    if panel in starts or seconds <= 0:
        raise ValueError("Check panel IDs and durations")
    starts[panel] = elapsed
    durations[panel] = seconds
    elapsed += seconds

for panel, offset, line in cues:
    if panel not in starts or not 0 <= offset < durations[panel]:
        raise ValueError(f"Invalid cue for panel {panel}")
    print(f"{starts[panel] + offset:.2f}s | {panel} | {line}")
Enter fullscreen mode Exit fullscreen mode

Run python cue_times.py. The revised timing should be:

5.50s | 07 | There. Under the seam.
Enter fullscreen mode Exit fullscreen mode

Change panel 06 back to three seconds and run it again. The cue returns to 3.50 seconds. A later panel can change independently without affecting this earlier cue.

Use the results in your animatic

An animatic is a timed preview of storyboard stills. Tools such as Boords let you adjust frame lengths against an uploaded soundtrack. In an editing timeline, locate the start of the spoken phrase and check whether it begins at the calculated time. Some edits already move the audio with the pictures. Listen before applying another shift.

The script calculates cue starts relative to the beginning of the scene. It doesn't measure how long an actor takes to say a line or change the audio file. If a phrase runs into the next panel, check whether the overlap is intentional. Preserve enough time for the customer to respond.

Before locking the scene, replay the reveal at normal speed. The audience should see the mark before Lia names it. If the line still sounds early despite the correct timestamp, revise the cue offset or the panel itself. A timestamp gives you a repeatable starting point for that decision.

Top comments (0)