Freetts is not working with external speakers

I have used Freetts.jar file in my java application that announces the token number. My application is working perfectly in my laptop but is not working in my desktop that has an external speaker. I get a null pointer exception. NOTE: I use Windows 7 in both my computers.

The Below Code is the Sample Format I used.

package tsapp; import java.util.Locale; import javax.speech.Central; import javax.speech.synthesis.Synthesizer; import javax.speech.synthesis.SynthesizerModeDesc; import javax.swing.JOptionPane; public class TextSpeech { public static void main(String[] args){ try { System.setProperty("freetts.voices", "com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory"); Central.registerEngineCentral ("com.sun.speech.freetts.jsapi.FreeTTSEngineCentral"); Synthesizer synthesizer = Central.createSynthesizer(new SynthesizerModeDesc(Locale.US)); synthesizer.allocate(); synthesizer.resume(); String str; str=JOptionPane.showInputDialog(null,"Voice Check"); if(str==null) return; synthesizer.speakPlainText(str, null); synthesizer.waitEngineState(Synthesizer.QUEUE_EMPTY); synthesizer.deallocate(); } catch(Exception e) { System.out.println(e.getClass()); e.printStackTrace(); } } }


Can we do one simple thing:

<ol> <li>Download binary https://netix.dl.sourceforge.net/project/freetts/FreeTTS/FreeTTS%201.2.2/freetts-1.2.2-bin.zip</li> <li>Add to your project <img src=https://www.e-learn.cn/content/wangluowenzhang/"https://i.stack.imgur.com/W80bt.png" alt="enter image description here"></li> <li>Write simple code.</li> </ol>

Like this

import com.sun.speech.freetts.Voice; import com.sun.speech.freetts.VoiceManager; public class TestVoice { public static void main(String[] args) { String text = "Voice check!"; Voice voice; VoiceManager voiceManager = VoiceManager.getInstance(); voice = voiceManager.getVoice("kevin"); voice.allocate(); voice.speak(text); } }

Just be sure that all these libs are on your desktop too.


  • iOS 10.3 text to speech works on simulator but not on device
  • Add audio to Map on iOS
  • I having trouble assigning strings in an if else statement
  • How to define sum result's width?
  • Connect to database using JDBC [duplicate]
  • Problems of checkName() and storing user input to ArrayList and boolean[]
  • System.Speech throws “No voice installed on the system or none available with the current security s
  • Modify how a node in drupal will look when viewed
  • Java InputStream fails to read file from within JAR
  • how can i know if my code is Synthesizable? [Verilog]
  • PowerShell: Start a process with unquoted arguments
  • Wait for Swing to finish updating JProgressBar before continuing
  • Setting WEAK to a non @property variable
  • Does Swing come with Calendar and time field components?
  • Threads in jMonkey and Nifty?
  • Using nodejs server with request package and function pipe()?
  • java drawing on JPanel with timer/delay
  • Inputting a number then reversing it
  • XMPPConnection Error in android
  • Java PrintWriter output looks weird in notepad
  • How concerned should we be about thread safety with JSF managed beans?
  • C#, “Object reference not set to an instance of an object.” error
  • Why isn't \\\\ interpreted as a blackslash in this regex?
  • iOS 6 dateFromString returns wrong date
  • Cassandra NoClassDefFoundError: com/google/common/util/concurrent/AsyncFunction
  • java.lang.IndexOutOfBoundsException occuring on ArrayList
  • How to Make a Spinner (In a Fragment) That Changes the App's Language?
  • HttpServletRequest getLocale returns OS locale not browser locale
  • drawing random circles, storing their coorindates in an array
  • Android Database Error - getWriteableDatabase
  • Using Generics on right hand side in Java 6?
  • What is the purpose of TaskExecutor in spring?
  • how to find common suffix in java by using method
  • Android activity accessing service's static reference before the service is ready
  • Swing - Get new component under mouseReleased
  • How to get address from latitude and longitude android google map v2 [duplicate]
  • JTable with a ScrollPane misbehaving
  • unknown Exception android
  • failed to connect to specific WiFi in android programmatically
  • How can I use threading to 'tick' a timer to be accessed by other threads?