FreeTTS noclassdeffounderror Try these instructions





Speech Synthesis in Java Using FreeTTS




Would you like your computer to talk? Would you like it to be in a stilted, robotic manner? Of course you would. What’s cooler than that? But you’d better get started right away, because a bunch of movie characters from the 1980′s have about thirty years of head start on you already, and if you don’t get on the stick they’re going to scoop up all the hot 1980′s babes before you can impress them with your rad 1980′s robot.


Make sure it tells them it’s programmed for love!


1. Download FreeTTS. FreeTTS is an open source implementation of JSAPI (the Java Speech API). JSAPI is a set of interfaces that can be used to perform speech synthesis, or “text-to-speech”, from Java programs. As of this writing, the archive file containing the latest version of the FreeTTS libraries is named “freetts-1.2.2-bin.zip”, and can be downloaded from the URL http://sourceforge.net/projects/freetts/files/.


2. Locate the downloaded FreeTTS archive file and extract it to any convenient location.


3. Open the extracted FreeTTS folder and navigate down the directory structure to the “lib” directory. The lib directory contains several jar files that will be needed to compile the test program.


4. In any convenient location, create a new directory named “SpeechSynthesisTest”.


5. Copy the files “cmu_us_kal.jar”, “cmulex.jar”, “en_us.jar”, and “freetts.jar” from the lib directory to the SpeechSynthesisTest directory.


6. In the SpeechSynthesisTest directory, create a new file named “SpeechSynthesisTest.java” containing the following text.

import com.sun.speech.freetts.*;

public class SpeechSynthesisTest
{
public static void main(String[] args)
{
Voice voiceKevin16 = new Voice("kevin16");

String[] thingsToSay = new String[]
{
"hi everybody",
"my name is kevin sixteen",
"my voice is built into free t t s",
"but it isn't very mellifluous",
"it could be worse, though",
"every time my friend alan tries to talk",
"about anything more exciting than what time it is",
"he barfs up a bunch of exceptions",
"and passes out",
};

voiceKevin16.say(thingsToSay);
}
}

class Voice
{
private String name;
private com.sun.speech.freetts.Voice systemVoice;

public Voice(String name)
{
this.name = name;
this.systemVoice = VoiceManager.getInstance().getVoice(this.name);
this.systemVoice.allocate();
}

public void say(String[] thingsToSay)
{
for (int i = 0; i < thingsToSay.length; i++)
{
this.say( thingsToSay[i] );
}
}

public void say(String thingToSay)
{
this.systemVoice.speak(thingToSay);
}

public void dispose()
{
this.systemVoice.deallocate();
}
}


7. Still in the SpeechSynthesisTest directory, create a new file named “ProgramBuildAndRun.bat” containing the following text, and substitute the path of the directory containing javac.exe and java.exe in the indicated place.

set javaPath="[path of directory containing javac.exe, java.exe]"
%javaPath%\javac.exe -cp freetts.jar *.java
%javaPath%\java.exe -cp .;freetts.jar SpeechSynthesisTest


8. Double-click the icon of the ProgramBuildAndRun.bat file to run it. A console window will appear, the program will be built and executed, and a short speech will be delivered using FreeTTS’s built-in voice “kevin16″.


Notes


  • This example uses the “kevin16″ voice that comes with FreeTTS, and presumably is named after Kevin A. Lenzo, one of the major contributors to open source speech synthesis. One can only hope that the real Kevin sounds a little more natural than his namesake, though. Supposedly, there are all manner of voices that you can use with FreeTTS, if you know how, but as of this writing, I don’t. FreeTTS bears all the hallmarks of being a system built by academics, which means that its breathtaking ingenuity blends seamlessly into its gaping, reeking lack of usability.

  • When the program runs, you may notice that it mentions something about how it “will not use MBROLA voices”. MBROLA seems to be, in this context at least, a database of “diphones” (which are transitions between one sound and another) and possibly full voices. If so, they might sound a little better than kevin16. All I can really figure out from the internet is that it can’t legally be used for commercial or, oddly, military purposes. But if you can’t make money with it or break something with it, what good is it?




No comments:

Post a Comment

Do pass your comments here.