JeSpeak is a Java library that bridges eSpeak, which is a compact open source software speech synthesizer. JeSpeak uses JNI to make native call to libespeak.
Create and compile this class:
import com.jespeak.*;
public class JeSpeakTest {
public static void main(String[] args) {
// get a JeSpeak instance
JeSpeak jeSpeak = JeSpeak.getInstance();
// submit the 'Test 1' string to be spoken
jeSpeak.synthesize("Test 1\n");
// the isPlaying method returns true
assert jeSpeak.isPlaying() == true;
// submit the 'Test 2' string to be spoken
jeSpeak.synthesize("Test 2\n");
// this method returns only when everything is spoken
jeSpeak.synchronize();
// the isPlaying method returns false now
assert jeSpeak.isPlaying() == false;
// submit the 'Test 3' string to be spoken
jeSpeak.synthesize("Test 3\n");
// stop and remove everything submited, so in this case 'Test 3' will immediately stop
jeSpeak.cancel();
// after a cancel, nothing is playing
assert jeSpeak.isPlaying() == false;
}
}
Put the .jar and the .so into the same dir and execute:
$ $JAVA_HOME/bin/java -Djava.library.path=. -cp . JeSpeakTest
If you have questions, bugs, feature request, etc. use thoses links (please in this order):
JeSpeak is released under the GNU General Public License.