Skip to main content

Text-to-Speech NetBeans Module

Posted by richunger on January 9, 2008 at 6:46 PM PST

I'm getting back into the coding groove.  Just for fun, last night I integrated the FreeTTS engine into the NetBeans Platform.

The module does 4 things:

  1. Integrates the engine
  2. Provides an extension point in its layer file for new voices
  3. Provides an options dialog for selecting a voice
  4. Provides an API hook for speaking a String in the current voice.  Thus it would be trivial for a NB developer to add an action that says something (e.g. TTS.getDefault().speak("the time is " + getTimeString())  )

It was pretty easy.  I spent most of the evening unraveling the weird manifest and classloader tricks the freeTTS project does.  (IMHO there's no reason for a TTS library to create a classloader.  Ever.)

A few hints to library writers:

  1. overloading the Main-Class attribute in your jar's manifest to do anything other than specifying a class with a main() method is a bad idea.
  2. If the way you read in your configuration requires a hack to work with webstart, you're making too many assumptions.
  3. It's not the library code's job to figure out which classloader a user-supplied extension is in.  It's the users job to add their jar to the classpath.  By trying to do it in the library's source code, you're just ensuring that anyone integrating your library in a way you didn't foresee can't do it.

Seriously, I spent just a few minutes getting FreeTTS to work on the command line, maybe half an hour writing the netbeans code, and several hours figuring out just why the heck the engine wasn't finding any voices when it ran in NetBeans.


I have run into the same problems. Would be much obliged if you could share your solution sir

I am trying to do the same thing (use Free TTS from within NetBeans). How did you set it up? Thanks

Do you have any guide on how you achieved that? because I want to do something similar but don't have the knowledge on NetBeans yet.

Thanks, I'll try to look it up. BTW, you've got mail.

Oh, BTW, if you're just looking for a good tutorial on this type of integration, you should check out my AudioStation tutorial in the SunPress NetBeans RCP book. I've blogged about it before. The tricks I use here are pretty much the same.

That was my last job!

I can try to find some time to write it up, but it's a really busy time for me right now. In the meantime, if you email me (rich dot unger at gmail) I can send you the code. Mostly, I used existing wizards in netbeans, and most of the actual code is auto-generated.

I've tried recently, and it was kind of fun (bdl with the arctic set).

Well, it's a lot more complicated than that, unfortunately. There is no OSS cross-platform java speech rec engine.

The FreeTTS engine is not really even a great TTS option, either. This is really just a toy. It sounds terrible compared to the commercially available alternatives. Now, it is a concatenative engine, which means that if there were enough resources in developing high quality voices, you'd probably end up with something that sounds at least okay.

However, companies like Nuance pour a lot more R&D into making it sound great than you're likely to find in an OSS library. The same is true of speech rec, which is why Sphinx performs so badly compared to commercial engines. The commercial engines are not only better, but the data they have dwarfs the free data sets.

Commercial quality OSS speech recognition and synthesis are a long, long way away.

Cool man , don't stop now, what about speech recognition too, Java is just crying out for a simple way to get this done. I know of several companies that need this in Java without a bunch of hassle.

add Sphinx and we can start a dialog with the IDE :)

Hi Rich I wasted lots of time to integrate freetts with my module.I was putting all the jars in wrapper module and was using it from my module .But the big problem is i am getting exception If i run the same code from standalone swing code using class path setting for the jars(free tts jars) its working fine.But the problem is with netbean did u solved that...can you please tell