LeetDreamer

Generate narrated algorithm visualization videos from JSON specs.

python build.py scenes/two_sum/hashtable/scene.json -v

Audio-First Pipeline

LeetDreamer generates TTS audio first, extracts durations, then drives animation timing from those durations. Narration and visuals stay perfectly synchronized without manual tweaking.

Single Source of Truth

One JSON file controls both animation state and narration text. No sync issues.

Adapter Architecture

Swap TTS engines, recording backends, and merge strategies without changing scene specs.

Schema Validation

Pydantic validates every scene spec. Catch errors before rendering starts.

Jinja2 Templates

HTML templates receive step data and timing. Full control over visualization style.

How It Works

  1. Parse scene spec โ€” Load JSON, validate with Pydantic schema
  2. Generate audio โ€” TTS adapter creates WAV files for each narration step
  3. Extract durations โ€” Measure each audio clip to drive timing
  4. Render animation โ€” Jinja2 template produces timed HTML animation
  5. Record video โ€” Playwright captures the animation to WebM
  6. Merge tracks โ€” FFmpeg combines video + audio into final MP4

Next Steps

Read the Architecture docs to understand the pipeline internals, or jump to Usage to start building scenes.