473,419 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

How to make Text to Speech in Java ?

Hello Friends,

I want to make a java file for Text to Speech purpose.

Means user enter his name and my .class will make sound of user entered text.

Can you help me for this ?
Aug 12 '10 #1
3 3112
Frinavale
9,735 Expert Mod 8TB
If I were you I'd look for software that already does this and that provides an API or Software Developer Kit (SDK) that allows your Java program to utilize.

Please take the time to research the problem before you post your question. The experts here are more than willing to help you with a specific problem but you have to do your part to learn the basics.
Aug 12 '10 #2
I am using following example but it give me null pointer exception. It is not created the object of synthesis .


Expand|Select|Wrap|Line Numbers
  1. import javax.speech.*;
  2. import javax.speech.synthesis.*;
  3. import java.util.Locale;
  4.  
  5. public class HelloWorld {
  6.     public static void main(String args[]) {
  7.         try {
  8.             // Create a synthesizer for English
  9.             Synthesizer synth = Central.createSynthesizer(
  10.                 new SynthesizerModeDesc(Locale.ENGLISH));
  11.  
  12.             // Get it ready to speak
  13.             synth.allocate();
  14.             synth.resume();
  15.  
  16.             // Speak the "Hello world" string
  17.             synth.speakPlainText("Hello, world!", null);
  18.  
  19.             // Wait till speaking is done
  20.             synth.waitEngineState(Synthesizer.QUEUE_EMPTY);
  21.  
  22.             // Clean up
  23.             synth.deallocate();
  24.         } catch (Exception e) {
  25.             e.printStackTrace();
  26.         }
  27.     }
  28. }
Can u help me to solve this ?
Aug 13 '10 #3
Dheeraj Joshi
1,123 Expert 1GB
Where it is throwing the null pointer exception? Please see the stack trace. And use try catch to isolate the problem.

Since i am not sure about these api i can not comment much. But look at the Java doc for corresponding api's and check the signatures etc.

Regards
Dheeraj Joshi
Aug 13 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Frédéric Gourul | last post by:
Hello, I want to print raw text with the java standard API. I want to send characters on the device printer selected in the PrinterJob object. Any way to do that ? (I don't want to print my text...
2
by: Ravi | last post by:
So I'm designing a wiki-type open source Content Managment System using JSP and Subversion as the back-end, and I would like to use ReST for the pages. The problem is I'm not sure how to access...
4
by: Peter Scott | last post by:
I created a table that has a column in that needs to contain a full Unix file path. Since 2048 was too long for a VARCHAR, I made it TEXT. I since populated the table. Now I want to make the...
3
by: MikeY | last post by:
Can anyhow direct me on how to make text trasnparent. The Text is loctated in my custom buttons. A Sample of my code is below. Font fn = new Font("Tahoma",8, System.Drawing.FontStyle.Bold); ...
2
by: WilHob | last post by:
Hello: I can not make connection to MySQL from Java. I set System Variable CLASSPATH to: C:\MySQL\mysql-connector-java-5.0.5\mysql-connector-java-5.0.5-bin.jar ... Then registered Driver:...
1
by: maharajakecil | last post by:
hello all vb expert. i had develop a GUI using vb 6.0. did anybody know how to make text "your exceed limit. please reenter your value' when user enter the our of range value for X and Y. this is my...
3
by: chris52672 | last post by:
If I have text box 1 (Password Enter) and I have text box 2 (Password Reneter). After text has been entered in text box 1 and the enter key is pressed to make text box 2 active (the curser will...
1
by: nit1127 | last post by:
I want to make a page where i want to disappearing text from the top one letter by one letter.. thanks and regards
1
by: regan2007 | last post by:
how are you going to make programs in java and network it...?
0
by: danielmessick | last post by:
I'm trying to create a JSlider applet to change colors in a text box.. Where do I start???? I'm not trying to create anything very complicated; just something basic to change between 3 colors (RED,...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.