Replace <p> with <break> in ssml

This commit is contained in:
Hongbo Wu 2022-09-26 17:18:46 +08:00
parent e1123cc422
commit 9545d1d532
2 changed files with 3 additions and 8 deletions

View file

@ -55,8 +55,7 @@ const ANCHOR_ELEMENTS_BLOCKED_ATTRIBUTES = [
function ssmlTagsForTopLevelElement() {
return {
opening: `<p>`,
closing: `</p>`,
opening: `<break />`,
}
}
@ -180,10 +179,6 @@ function emitElement(
}
}
if (isTopLevel) {
emit(textItems, topLevelTags.closing)
}
return Number(maxVisitedIdx)
}

View file

@ -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)])
}
}