How to make my application talk?

Apache NetBeans Wiki Index

Note: These pages are being reviewed.

First add a dependency to Phonemic, the library that does the magic, which is conveniently wrapped within the SodBeans modules. Here’s the update center for SodBeans.

The only thing you need is two lines of code:

TextToSpeech speech = TextToSpeechFactory.getDefaultTextToSpeech();
speech.speak("Hello, World!");

This call also already handles making your calls thread safe and is efficient enough to handle thousands of TTS "requests" in rapid succession.

Although this is the only import you will need in your code a screen reader needs to be installed in the client running the code. To overcome this just make sure to add the following modules so they are available in your application:

Dependencies

If you want your application to be blind accessible just include Sappy dependencies. This is not magic but does a great work on common things in the IDE. Some dependencies like Text to Speech Options are really optional but they provide option panes to customize Sappy (i.e. selecting voice, etc).

And your application talks. Since Phonemic is a plain jar you can use it out of the platform as well.

You can read more about Phonemic here.