In brief
We asked a character to say “Let's stop here for today.” Sometimes the synthesized audio kept going after the script ended. To find a cut that preserves the last syllable, we look for a pause, transcribe both sides, and align the transcript to the waveform. In one production smoke test, we removed about 2.9 seconds while preserving the full scripted line.
The script and the two audio clips
The script is 「今日はここまでにしよう。」 (“Let's stop here for today.”) The first clip continues with 「明日はまた会おうね。」 (“Let's meet again tomorrow.”). We synthesized both lines without reference audio and joined them to recreate the failure for this demo. The second clip is what the actual trimming code returned from the same waveform.
Before trimming
After trimming
The waveform above marks the retained audio in green and the removed section in orange. The demo was cut at 2.232 seconds. We also checked the production path on a separate clip where the model actually generated extra words.
A 160 ms pause gives us a candidate
A scripted line can contain a natural pause. In one test clip for 「うん……大丈夫だよ。」 (“Yeah… it's okay.”), the detector found a 1,024 ms gap. The speaker was still partway through the script at that point, so the clip stayed intact. We needed the words on either side to decide whether to cut.
We first look for unusually long audio relative to the script. The filter covers short chunks containing Japanese with 2–28 characters after normalization. Voice activity detection (VAD) then locates spans of speech. We inspect up to the last two gaps of at least 160 ms between those spans. Looking one gap earlier helps when the last gap falls inside the extra speech itself. faster-whisper VAD implementation
Transcribe both sides of the gap
Qwen3-ASR transcribes the audio on either side of a candidate separately. Before the cut, the transcript must match the full script after changes such as removing punctuation and spaces. Sentence-ending sounds such as 「ね」 and 「よ」 and the long-vowel mark 「ー」 count toward the match. If the first segment loses the ending, we discard that cut.
If the second segment yields words, we also transcribe the full clip. It must start with the script, and the next two characters must match the start of the isolated tail's transcript. A breath or whisper can turn into text when transcribed in isolation. This check asks whether the extra words are still recognizable in context. Qwen3-ASR official repository
Find room between the last sound and the next utterance
Qwen3-ForcedAligner matches the full transcript to the waveform and gives us timestamps for the end of the script and the start of the extra speech. We also require the aligned start of the extra speech to fall within 100 ms of the next speech span found by VAD. Qwen3-ASR technical report
We cut only if there is room to leave a margin on both sides. The chosen point stays inside that interval, and a 15 ms fade smooths the edge. When the alignment is ambiguous or there is too little space, the original audio plays.
The test included clips that should be kept
In a separate test set, we made zero cuts across 26 clips labeled to keep, including natural pauses and quiet endings. Of six clips flagged by speech recognition as possibly containing extra speech, three met the timing criteria and were trimmed. These results describe the selected test set. Production detection rates would require a broader sample.
In the production smoke test, Irodori generated extra speech after 「今日はここまでにしよう。」. The trimmer took that clip from 4.480 to 1.592 seconds. The resulting transcript matched the script, and the check took 471 ms.
Put a deadline on the check
The extra recognition runs only after the text and audio lengths pass the filter and VAD finds a candidate. If the shared recognition model or the checking worker is busy, we skip the check. Playback waits up to 750 ms for a result, then uses the original clip.
Extra speech that starts right after the scripted line and transcripts that differ from the script remain hard cases. Kotonia runs the trimmer on character audio and applies cuts when it has evidence for the boundary.
