| // |
| // Licensed to the Apache Software Foundation (ASF) under one |
| // or more contributor license agreements. See the NOTICE file |
| // distributed with this work for additional information |
| // regarding copyright ownership. The ASF licenses this file |
| // to you under the Apache License, Version 2.0 (the |
| // "License"); you may not use this file except in compliance |
| // with the License. You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, |
| // software distributed under the License is distributed on an |
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| // KIND, either express or implied. See the License for the |
| // specific language governing permissions and limitations |
| // under the License. |
| // |
| |
| = DevFaqMakeItTalk |
| :jbake-type: wiki |
| :jbake-tags: wiki, devfaq, needsreview |
| :jbake-status: published |
| |
| First add a dependency to link:https://sourceforge.net/projects/phonemic/[Phonemic], the library that does the magic, which is conveniently wrapped within the SodBeans modules. Here's the link:http://sodbeans.sourceforge.net/downloads/updates/sappy/updates.xml[update center for SodBeans]. |
| |
| The only thing you need is two lines of code: |
| |
| [source,java] |
| ---- |
| |
| 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: |
| |
| image:Dependencies.jpg[] |
| |
| 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 link:https://sourceforge.net/projects/phonemic/[Phonemic] is a plain jar you can use it out of the platform as well. |
| |
| You can read more about Phonemic link:https://sourceforge.net/apps/trac/phonemic/[here]. |
| |
| === Apache Migration Information |
| |
| The content in this page was kindly donated by Oracle Corp. to the |
| Apache Software Foundation. |
| |
| This page was exported from link:http://wiki.netbeans.org/DevFaqMakeItTalk[http://wiki.netbeans.org/DevFaqMakeItTalk] , |
| that was last modified by NetBeans user Javydreamercsw |
| on 2011-09-19T18:21:04Z. |
| |
| |
| *NOTE:* This document was automatically converted to the AsciiDoc format on 2018-01-10, and needs to be reviewed. |