Detect Speak end in freeTTS for java

I use the freeTTS library to convert text to speech. I can program my code using this library, where I can play speech for a specific text using the following code:

Voice voice = VoiceManager.getInstance().getVoice("kevin16");
if (voice != null) {
    voice.allocate();
}
voice.speak("Hello world");

Is there any way I can get a callback when tts lib completed the conversation process?

+5
source share
1 answer

I myself found the answer. We do not need a callback when lib has completed the conversation process. control moves to the next line only after the completion of the negotiation process.

what i did is:

    Thread t = new Thread() {
        @Override
        public void run() {
            super.run();
            try {
            voice = initializeTTS(); // a func to initialize TTS lib.
            voice.speak("Hello world");
            // do whatever you want to do from here only.
            } catch (Exception e) {
               e.printStackTrace();
            }
        }
};
t.start();
+3
source

All Articles