How to implement Text to Speech with SSML tags in React Native?

Viewed 178

Currently I have implemented using react-native-tts like so:

Tts.speak('How is your day going?')

The configuration for voice looks like this:

Tts.setDefaultRate(0.5, true);
Tts.setDefaultVoice('com.apple.ttsbundle.Moira-compact');
Tts.setDefaultPitch(1.25);

The voice is unnatural and also does not take into account text like this:

    <speak>
        Here is a number <w role='amazon:VBD'>read</w> 
        as a cardinal number: 
        <say-as interpret-as='cardinal'>12345</say-as>. 
        Here is a word spelled out: 
        <say-as interpret-as='spell-out'>hello</say-as>. 
    </speak>

It speaks out the whole SSML with tag text.

0 Answers
Related