Skip to content

Cross-track visual library: share segments across similar songs #72

Description

@rancur

Problem

5,000 tracks generating unique visuals is $115K. Many tracks share genre, BPM range, energy level, and mood -- their visuals could be interchangeable.

Proposal

Build a content-addressable visual library that indexes video segments by:

  • Genre cluster (DnB, House, Techno, etc.)
  • Energy bucket (low / mid / high)
  • Section type (intro / buildup / drop / breakdown / outro)
  • BPM range (120-130, 130-140, etc.)
  • Mood quadrant (euphoric, dark, chill, aggressive)

Before generating a new segment, query the library. If a matching segment exists within the same cluster, reuse it.

Math

  • ~20 genre/energy/mood clusters x 8 segments each = 160 unique segments
  • 160 x $1.50 = $240 total for the entire library
  • Effective cost: $0.05/track

Even at 100 clusters (finer granularity): $1,200 total = $0.24/track.

Implementation

  1. Extend KeyframeCache in cache.py with multi-dimensional indexing
  2. Add genre/energy/mood classification step before generation
  3. Replace Jaccard similarity in find_similar() with embedding-based matching (CLIP)
  4. Add a "visual library build" command that pre-generates the cluster library

Tradeoff

Visuals won't be unique per song. Two similar DnB tracks will share drop visuals. For a DJ library this is acceptable -- the audience never sees back-to-back identical visuals.

Files to Modify

  • src/generator/cache.py -- extend indexing
  • src/pipeline.py -- library lookup before generation
  • New: src/generator/visual_library.py -- clustering and library management

Labels: cost-optimization, feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions