I have a class that uses the Android TTS API to transcribe text to audio. I can control the pitch and speed; but I noticed the engine requires a text string and also a hash object. I noticed some words are pronounced too quickly to be easily recognized, and inflection seems too unnatural. Is there a way I can control these two things; possibly through the HashMap
? The following is how I'm using the engine:
mTts = new TextToSpeech(Globals.context, this); // context, listener
}
@Override
public void onInit(int status) {
HashMap<String, String> myHashRender = new HashMap();
myHashRender.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, speech);
mTts.setPitch(0.8f);
mTts.setSpeechRate(0.6f);
mTts.synthesizeToFile(speech, myHashRender, fileOutPath);
while (mTts.isSpeaking()) try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
mTts.stop();
mTts.shutdown();
Tap the Settings icon . Scroll down and tap Accessibility. Scroll down and tap Text-to-speech output. Adjust the sliders for Speech Rate and Pitch.
Created May 2019. Text-to-speech (TTS) is the underlying software used by screen readers, such as TalkBack and Select to Speak, when they convert text into spoken content. You can customise the text-to-speech voice to make it easier to follow.
AddSpeech(String, String) Adds a mapping between a string of text and a sound file.
Google TTS does not currently support that, but here is what you can do: During parsing of your text, you can change parts of it to get the intonation and inflection you want.
For example, if you encounter the word 'Hey' you rewrite it on the fly to 'Heeeey' before you send it to the TTS engine to get a different pronounciation.
It is not pretty but it is a workaround.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With