From 2eb6255ff381a4dc8b11fd5b4a625db810bd117e Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Thu, 8 Sep 2022 16:19:12 +0800 Subject: [PATCH] Revert change on wordOffset --- packages/text-to-speech/src/textToSpeech.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/text-to-speech/src/textToSpeech.ts b/packages/text-to-speech/src/textToSpeech.ts index c09acdb88..05df7807b 100644 --- a/packages/text-to-speech/src/textToSpeech.ts +++ b/packages/text-to-speech/src/textToSpeech.ts @@ -51,7 +51,7 @@ export const synthesizeTextToSpeech = async ( const synthesizer = new SpeechSynthesizer(speechConfig) const speechMarks: SpeechMark[] = [] let timeOffset = 0 - const wordOffset = 0 + let wordOffset = 0 synthesizer.synthesizing = function (s, e) { // convert arrayBuffer to stream and write to stream @@ -149,6 +149,7 @@ export const synthesizeTextToSpeech = async ( } // for utterance, just assemble the ssml and pass it through const start = startSsml(ssmlOptions) + wordOffset = -start.length const ssml = `${start}${input.text}${endSsml()}` const result = await speakSsmlAsyncPromise(ssml) return {