mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Revert back change on wordOffset
This commit is contained in:
parent
1b8d6d761c
commit
321895844f
1 changed files with 3 additions and 1 deletions
|
|
@ -52,6 +52,7 @@ export const synthesizeTextToSpeech = async (
|
|||
const synthesizer = new SpeechSynthesizer(speechConfig)
|
||||
const speechMarks: SpeechMark[] = []
|
||||
let timeOffset = 0
|
||||
let wordOffset = 0
|
||||
|
||||
synthesizer.synthesizing = function (s, e) {
|
||||
// convert arrayBuffer to stream and write to stream
|
||||
|
|
@ -89,7 +90,7 @@ export const synthesizeTextToSpeech = async (
|
|||
speechMarks.push({
|
||||
word: e.text,
|
||||
time: (timeOffset + e.audioOffset) / 10000,
|
||||
start: e.textOffset,
|
||||
start: wordOffset + e.textOffset,
|
||||
length: e.text.length,
|
||||
type: 'word',
|
||||
})
|
||||
|
|
@ -139,6 +140,7 @@ export const synthesizeTextToSpeech = async (
|
|||
}
|
||||
// for ssml
|
||||
const startSsmlTag = startSsml(ssmlOptions)
|
||||
wordOffset -= startSsmlTag.length
|
||||
const text = _.escape(input.text)
|
||||
const ssml = `${startSsmlTag}${text}${endSsml()}`
|
||||
const result = await speakSsmlAsyncPromise(ssml)
|
||||
|
|
|
|||
Loading…
Reference in a new issue