diff --git a/packages/text-to-speech/src/htmlToSsml.ts b/packages/text-to-speech/src/htmlToSsml.ts index 2a1417d34..ef55b09b1 100644 --- a/packages/text-to-speech/src/htmlToSsml.ts +++ b/packages/text-to-speech/src/htmlToSsml.ts @@ -55,8 +55,7 @@ const ANCHOR_ELEMENTS_BLOCKED_ATTRIBUTES = [ function ssmlTagsForTopLevelElement() { return { - opening: `

`, - closing: `

`, + opening: ``, } } @@ -180,10 +179,6 @@ function emitElement( } } - if (isTopLevel) { - emit(textItems, topLevelTags.closing) - } - return Number(maxVisitedIdx) } diff --git a/packages/text-to-speech/src/textToSpeech.ts b/packages/text-to-speech/src/textToSpeech.ts index b60fdfeda..5b35aae48 100644 --- a/packages/text-to-speech/src/textToSpeech.ts +++ b/packages/text-to-speech/src/textToSpeech.ts @@ -138,7 +138,7 @@ export const synthesizeTextToSpeech = async ( } } // for ssml - const audioData: Buffer = Buffer.from([]) + let audioData: Buffer = Buffer.from([]) // split ssml into chunks of 200 characters to stream faster const ssmlChunks = input.text.match(/.{1,200}/g) // TODO: not split on words and bookmarks @@ -151,7 +151,7 @@ export const synthesizeTextToSpeech = async ( } timeOffset = timeOffset + result.audioDuration wordOffset = wordOffset + ssmlChunk.length - Buffer.concat([audioData, Buffer.from(result.audioData)]) + audioData = Buffer.concat([audioData, Buffer.from(result.audioData)]) } }