mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Escape entityName in ssml
This commit is contained in:
parent
967fb3c6d5
commit
68a932ad0b
2 changed files with 3 additions and 2 deletions
|
|
@ -8,6 +8,7 @@ import {
|
|||
SpeechSynthesizer,
|
||||
} from 'microsoft-cognitiveservices-speech-sdk'
|
||||
import { endSsml, htmlToSsmlItems, ssmlItemText, startSsml } from './htmlToSsml'
|
||||
import * as _ from 'underscore'
|
||||
|
||||
export interface TextToSpeechInput {
|
||||
text: string
|
||||
|
|
@ -150,7 +151,7 @@ export const synthesizeTextToSpeech = async (
|
|||
// for utterance
|
||||
const start = startSsml(ssmlOptions)
|
||||
wordOffset = -start.length
|
||||
const ssml = `${start}${input.text}${endSsml()}`
|
||||
const ssml = `${start}${_.escape(input.text)}${endSsml()}`
|
||||
const result = await speakSsmlAsyncPromise(ssml)
|
||||
return {
|
||||
audioData: Buffer.from(result.audioData),
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ describe('htmlToSsmlItems', () => {
|
|||
primaryVoice: 'test-primary',
|
||||
secondaryVoice: 'test-secondary',
|
||||
language: 'en-US',
|
||||
rate: 1,
|
||||
rate: '1.0',
|
||||
}
|
||||
|
||||
describe('a simple html file', () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue