Tutorial on setting up freetts with maven

By: neztec Viewed: 153303 times  Printer Friendly Format    


I had similar problems setting everything up with all those path issues - especially since I was doing it through maven.

One thing to note, this was for setting up Sound Captcha for jcaptcha so my solution includes another dependency on "jcaptcha-extension-sound-freetts" and I can't get it to work without this jar (see below for pom dependencies).

To get this working I first got a copy of the FreeTTSHelloWorld source and played around with it in my webapp until I finally got it to run.
The only thing I had to do to the copied source code was add the freetts.voices at the beginning:

public static void main(String[] args) { 
    	System.setProperty("freetts.voices", "com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory");

Other than that, I turned to the demos and found that the demo depends on cmu_us_kal.jar and cmulex.jar so I installed those in my local repo:
mvn install:install-file -DgroupId=captcha-sound -DartifactId=kevin-voice -Dversion=1.0 -Dpackaging=jar -Dfile=cmu_us_kal.jar
mvn install:install-file -DgroupId=captcha-sound -DartifactId=lexicon -Dversion=1.0 -Dpackaging=jar -Dfile=cmulex.jar

Then finally added the following dependencies to my pom.xml:
<!-- Audio Captcha -->
		<dependency>
			<groupId>captcha-sound</groupId>				
			<artifactId>kevin-voice</artifactId>
			<version>1.0</version>
		</dependency>	
			
		<dependency>
			<groupId>captcha-sound</groupId>				
			<artifactId>lexicon</artifactId>
			<version>1.0</version>
		</dependency>   <dependency>
			<groupId>com.octo.captcha</groupId>				
			<artifactId>voice-en</artifactId>
			<version>1.0.0</version>
		</dependency>	
			
		<dependency>
	        	<groupId>com.octo.captcha</groupId>
	       	 	<artifactId>jcaptcha-extension-sound-freetts</artifactId>
	        	<version>1.0-SNAPSHOT</version>
    	        </dependency>


Most Viewed Articles (in Java )

Latest Articles (in Java)

Comment on this tutorial