Engineering · · 3 min read
Three Rounds of Alignment Fixes, All Wasted: I Had the Wrong Edition of the Text
Making a recitation video of the Infinite Life Sutra, subtitle alignment stayed stuck at 30–50%. I rewrote the algorithm three times; each version passed my checks, and each time the feedback got worse. The problem was never the algorithm.

My recitation-video pipeline takes a recording and a copy of the scripture's text from the web. whisper transcribes the recording; the transcript is then aligned with the text character by character, which tells me the second at which each character should light up.
I had run dozens of classics through it, usually with alignment above 90%. Then came the Infinite Life Sutra.
Stuck at 30–50%
As usual I took the text from Wikisource — the Saṅghavarman translation. The first alignment run matched only 33–49%, the worst in the whole series.
My first guess was a hard-to-transcribe recording, so I ran the same audio through whisper small, medium and large-v3. All three made the same mistakes in the same places. That meant the models weren't mishearing; the recording was fine.
So it had to be the aligner. I rewrote it three times:
- Proportional mapping: a character's position in the text maps to the same relative time in the audio.
- Pause snapping: sentence boundaries snap to silences in the recording.
- Multi-anchor interpolation: characters that certainly match become anchors; everything between is interpolated.
Every version passed my checks: no characters with odd durations, still frames that looked right, no drift along the timeline.
The feedback after actually watching: first "it's wrong from the start", then "the text runs well ahead of the voice", then "nothing matches at all". Worse every time.
Back to the dumbest possible method
After round three I stopped looking at the algorithm and simply listened, sentence by sentence, with the text in front of me.
It showed up quickly. The recording says "Amitābha Buddha" and "Ultimate Bliss"; the Wikisource text says "Buddha of Infinite Life" and "Peace and Joy" — older translation terms, not how the sutra is usually chanted today. Worse, the recording contains a whole passage about Prince Ajātaśatru offering a jewelled canopy that does not exist anywhere in that edition.
In other words, the recording wasn't reading this edition at all. No aligner, however clever, can match words that aren't in the text. All my checks had verified how time was assigned to the characters; none had asked whether those characters were ever spoken.
A different text, and nothing else to change
I found the common edition whose wording and passages match the recording (in the end, the one on quanxue.cn). With it, the original, standard aligner — not a line changed — reached 96–97%.
All three rounds of algorithm work had been for nothing.
How I decide now
Buddhist sutras and old Chinese texts often survive in several editions with systematic differences in wording. My rule today:
- If the first alignment is clearly below the series' normal level (90% for me), check the source text before touching the algorithm.
- Pick a few clear, distinctive sentences from the whisper transcript and search for them in the text.
- Found, in a sensible order → the text is fine; keep investigating transcription and alignment.
- Not found, but a paraphrase is (a different Buddha's name, place name or term) → almost certainly the wrong edition; find the one whose wording matches the recording.
- Whole passages missing without a trace → possibly a splicing or ordering problem in the audio; investigate that path instead.
And a more general one: when the same kind of check passes two or three times in a row but the result is still wrong, step outside the method and question a more basic assumption. Algorithms can't rescue bad data.