mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Do not breaking on words and bookmarks
This commit is contained in:
parent
9545d1d532
commit
35f7b0b90b
1 changed files with 4 additions and 3 deletions
|
|
@ -139,11 +139,12 @@ export const synthesizeTextToSpeech = async (
|
|||
}
|
||||
// for ssml
|
||||
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
|
||||
// split ssml into chunks of 2000 characters to stream faster
|
||||
// both within limit & without breaking on words and bookmarks
|
||||
const ssmlChunks = input.text.match(/.{1,2000}(?= |$)(?! mark=)/g)
|
||||
if (ssmlChunks) {
|
||||
for (const ssmlChunk of ssmlChunks) {
|
||||
console.log('ssmlChunk', ssmlChunk)
|
||||
const ssml = `${startSsml(ssmlOptions)}${ssmlChunk}${endSsml()}`
|
||||
const result = await speakSsmlAsyncPromise(ssml)
|
||||
if (result.reason === ResultReason.Canceled) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue