MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / stripBeforeOnset

Function stripBeforeOnset

packages/cli/src/whisper/normalize.ts:484–488  ·  view source on GitHub ↗
(words: Word[], onsetSeconds: number)

Source from the content-addressed store, hash-verified

482 * Whisper can hallucinate words over non-speech sections at the start of audio.
483 */
484export function stripBeforeOnset(words: Word[], onsetSeconds: number): Word[] {
485 // 0.5s tolerance: keep words whose timestamps straddle the onset boundary,
486 // since whisper may assign a slightly early start to the first spoken word.
487 return words.filter((w) => w.start >= onsetSeconds - 0.5);
488}
489
490export function patchCaptionHtml(dir: string, words: Word[]): void {
491 if (words.length === 0) return;

Callers 2

transcribeAudioFunction · 0.85
normalize.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected