Making noise

Now that we have a small collection of voices to choose from, see our previous article, let us turn our attention to making some noise from our Java application.

Just to get us going we will select a voice and use it to play a quote.  The quote we will use for now is “Believe in yourself.  You are braver than you think, more talented than you know, and capable of more than you imagine.”  The voice we will use is the 8-bit Kevin.

So, if we go back to our code in the previous example we can add the following lines:

When we run the code our program will now speak the words from our sample phrase. You can select some of the other voices to see how things change.

The final code for the class looks like this:

There is no download for this post as the code for this is only a few lines different from the first posting and all the external files were provided as well. Take a look at the JavaFX and adding basic speech post for the download link.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.