input.ssml` is longer than the limit of 5000 bytes"

71 Views Asked by At

I am trying to generate audio from ssml file using google text-to-speech. For this purpose I am using @google-cloud/text-to-speech NPM package. It is throwing error like

input.ssml is longer than the limit of 5000 bytes.

The code

const client = new textToSpeech.TextToSpeechClient()


        const request = {
            input: { ssml: fs.readFileSync(ssmlFilePathLocal).toString() },
            voice: { languageCode: tempLanguage.pollyLanguageCode, ssmlGender: ssmlGender },
            audioConfig: { audioEncoding: 'MP3' },
        }
        
        const [response] = await client.synthesizeSpeech(request)

Can anyone help me out to achieve my result using google text to speech?

I can not use TextToSpeechLongAudioSynthesizeClient as it is not allowing ssml as input.

0

There are 0 best solutions below