So are you really want to talk with your computer ? Need java code to do it for you ?
You are at correct place so start with very start ...
A Java Program which can speak :)
Follow these steps and start -
Step 1 -
You need to download api freetts for text to speech converter in java. don't get panic here is the link - Download Freetts Package
done :)
you can refer document for your ease - Refer Document
Step 2 -
Now setup environment is as follows -
a) extract freetts package
b) navigate to lib folder and double click on jsapi exe file. it will create a jsapi jar file.
c) Copy speech.properties file from freetts folder to home directory folder. ie. if your computer name is ABC then your home directory will be like - C:\Users\ABC
done :)
Step 3 -
Open NetBeans IDE and add usable packages -
a) Create a new project ie. TextToSpeech
b) Right click on your project TextToSpeech click on properties.
c) Now a new pop up window will appear , now click on "Libraries" from left pane.
d) Now click on add jar/folder tab and add these jar files in same order as given bellow -
now go to lib folder and add these jar files :
1. en_us.jar
2. mbrola.jar
3. jsapi.jar
4. freetts-jsapi10.jar
Step 4 - Now start code work. write a java file named as - Text2Speech
Code -
import javax.speech.*;
Now save file and run.
Note - always run jar file , you can find jar file of your project in dist folder.
Output -
Feeling any problem ? feel free to leave comment .
Or Try our video tutorial -
don't miss to like our facebook page for further updates.
working nice , finally got a good solution , thanks.
ReplyDeletewhy this exception?
ReplyDeleteException in thread "main" java.lang.NoClassDefFoundError: com/sun/speech/freetts/ValidationException
speech.properties file copied to your home or not ???
DeleteThis comment has been removed by the author.
DeleteIm getting Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/speech/freetts/ValidationException
ReplyDeleteused to get another error, but then i putted the speech.properties at my home folder, then i just get that one.
getting this eror java.lang.IllegalThreadStateException
ReplyDeleteadd these jar files :
ReplyDelete1. en_us.jar
2. mbrola.jar
3. jsapi.jar
4. freetts-jsapi10.jar
in same order as given here , copy speech.prop file to your home folder ..
and then let me know , what is the whole problem .
Or remove the synth.deallocate(); from code and then try.
ReplyDeleteAdd all the jars in lib. Then that classDefnotfound error won't come.
ReplyDeletehow to run this via cmd
ReplyDeleteTo run by cmd follow these steps -
Delete1) Add jar files to your classpath
2) Compile your code
3) Convert it to jar file
4) Run it.
really helpful man ...thank .
ReplyDeleteInstead of kevin16.. can i use female voices.. I tried using mbrola but didnt work. pplease let me know how to use female voices?
ReplyDeleteI like it most.10000000000000 likes from me. This is very helpful post for me. Thank you..
ReplyDeletehello ! i have problem that this code gets compiled successfully but when i run it displays nullPointerException
ReplyDeleteThanks for sharing this amazing post plz visit Text Speaker 3.3 Full Crack
ReplyDeleteAre you a YouTuber? A content creator? Or a movie maker?
ReplyDeleteAs a result, you might need voice services.
You can try this tool to listen to the natural pronunciations from a ton of languages: Talk With AI. It is a FREE online tool to convert text into audio files
https://tts.adcrew.us
Intro Video:
https://youtu.be/NaWcJr07UTM
How to Use:
https://youtu.be/p_Hk7Hi4obo