8000 feat(import): line up an imported transcript with its audio by adeelahmad · Pull Request #700 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(import): line up an imported transcript with its audio - #700

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-xfmkzn
Oct 19, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-xfmkzn

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: a transcript imported without times (plain text, Word, PDF, Markdown, Name: text lines) got estimated times, and attaching its audio kept them. Clicking a line played the wrong moment.

After: such an asset says times: "estimated". Once it has audio, its page shows "Times estimated" with one button, Line up with the audio. A background job hears the audio through the same transcription path Lens already uses (same engine and fallbacks, vocabulary, activity ledger, budgets, quiet hours). It matches the imported words to the words heard with difflib, rare words first and then the gaps, and gives each line its matched words' times. Lines that matched nothing are placed between their neighbours.

The text and speakers stay exactly as imported. Analyze, embed and report then run again, so chapters, search passages and the report follow the new times. The asset then says times: "aligned" with how many words were heard.

Agents can do the same: POST /resources/{rid}/align (process permission, 202 with the job, 400 without audio or when the times are real) and the MCP tool align_transcript. get_recording now gives times.

Motivation and Context

Personal feature plan, Phase 1 "Bring existing transcripts": forced alignment was the gap left after the rest of the plan landed.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

Done questions (AGENTS.md)

  • Goal: delivers what the user wanted, merged on green CI.
  • Agents: POST /resources/{rid}/align and MCP align_transcript.
  • Zero setup: reuses the configured transcription engine; no new model or dependency.
  • Fewest clicks and keystrokes: one button on the asset page.
  • Configurable: align is one of the heavy steps in Settings › Workers › Quiet processing.
  • Light: runs 8000 only when asked; heavy step, respects quiet hours.
  • Private and secure: same process permission as reprocess, audited as recording.align; no new outward surface.
  • Cost: one transcription, through the activity ledger and budgets, only on request.
  • User decides: nothing runs on its own; defaults unchanged.
  • Upgrades: an estimated-times upgrade step marks older text imports whose lines have the estimate's spacing; it only touches assets without times, so it is safe to run twice (docs/database.md).
  • Honest: the page says whether times are estimated or from the audio, with the share of words heard; README built list and docs/requirements.md updated.
  • Tests, docs and generated files updated (make openapi).
  • Open standards; no new dependencies.
  • Result reported. Refine later: undo (recompute the estimate), the button on phones while the asset is idle, and refreshing a summary's key-point times without summarising again.
  • Reuse: ingest.transcribe_one split into a reusable ingest.hear(); jobs, quiet processing and the job banner reused.

Local CI: pytest tests/api/test_align.py tests/api/test_jobs.py tests/api/test_mcp.py tests/domain/test_importing.py tests/domain/test_migrations.py tests/domain/test_quiet.py (78 passed), ruff, mypy, jest align.test.tsx (4 passed) and __tests__/recording*, tsc --noEmit, ci/check_requirements.py, mkdocs build --strict all clean; OpenAPI regenerated with no drift.


Generated by Claude Code

A transcript imported without times now says its times are estimated
(`times`), and once its audio is attached a person or agent can line it up:
an align step transcribes the audio through the same engine path as the
transcribe step (ledger, budgets, quiet hours), matches the imported words to
the words heard with difflib, and gives each line their times; unmatched lines
sit between their neighbours. Text and speakers are unchanged. Then analyze,
embed and report run again. POST /resources/{rid}/align, the MCP tool
align_transcript and one button on the asset page. Off until asked; an
upgrade step marks older imports whose lines carry the estimate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QFUNzy1QZy5HhKAyJxTAYJ
@adeelahmad adeelahmad self-assigned this Oct 19, 2026
@adeelahmad
adeelahmad merged commit 0f26c68 into main Oct 19, 2026
12 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-xfmkzn branch October 19, 2026 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None ye 4AFF t

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0