Search code examples
androidvoiceaudiotext-to-speech

How to get the Amplitude of TTS


I am trying to listen TTS voice amplitude and silence in between words. I will use this for showing some animations synchronized with the TTS voice

I could not find a way to make it work. Hope it is possible if I could convert TTS to sound file and read it, but not sure.

Please advice me


Solution

  • If you need to synchronize the audio with visual actions, you'll have to set an TextToSpeech.OnUtteranceCompletedListener (or since ICS: an UtteranceProgressListener) to the TTS engine. That way you can determine when a specific piece of text has been synthesized.

    Alternatively, you can synthesize the text to an audio file using the synthesizeToFile(String text, HashMap<String, String> params, String filename) method.