js-tts-wrapper
Version:
A JavaScript/TypeScript library that provides a unified API for working with multiple cloud-based Text-to-Speech (TTS) services
33 lines (32 loc) • 787 B
TypeScript
/**
* Word boundary information
*/
export interface WordBoundary {
/**
* The word text
*/
word: string;
/**
* Start time in seconds
*/
start: number;
/**
* End time in seconds
*/
end: number;
}
/**
* Estimate word boundaries for a given text
*
* This is a simple estimator that assumes a constant speaking rate.
* It's not accurate but provides a reasonable approximation when
* the TTS engine doesn't provide word boundary information.
*
* @param text Text to estimate word boundaries for
* @param options Options for estimation
* @returns Array of word boundary objects
*/
export declare function estimateWordBoundaries(text: string, options?: {
wordsPerMinute?: number;
startTime?: number;
}): WordBoundary[];