Java speech api download
Where I can download JAVA SPEECH API implementation?.
I have been searching in web, there are many options.
I'm spanish, please, sorry for my poor english.
Edited by: Valhalla on Feb 25, 2009 9:03 AM
follow the below links...
http://freetts.sourceforge.net/docs/index.php
http://freetts.sourceforge.net/docs/jsapi_setup.html
Similar Messages
-
Where can i download java speech api?
Hi All,
Where can i download java speech api?
ThanksThanks for the java speech download recommendations. I am going to give it a try on my site.
[Tony From Sports Betting Picks|http://tonyspicks.com/contact-tony/about/]
Edited by: tonyt42 on Apr 9, 2009 10:01 PM -
I want to download Java Speech API jar file where can I get that ?
hi All
i started development on the Java Speech API. so were i can download the jar file and also if any one having the Maven artifact Id / group Id. please post it.it may helpful for me.
Thanks
JegaSun has no such API like Java Speech API in their J2SE but there r other third parties api like FreeTTS which can be used
to code speech apps.
http://nchc.dl.sourceforge.net/project/freetts/FreeTTS/FreeTTS%201.2.2/freetts-1.2.2-bin.zip -
Hey,
Can i know where do i find java speech API kit for download...can any one help me...it's urgent?Google [java speech api kit]
-
Hi
When i compile the following program it give me error some of the Java speech API.
import javax.speech.AudioException;
import javax.speech.Central;
import javax.speech.EngineException;
import javax.speech.synthesis.Synthesizer;
import javax.speech.synthesis.SynthesizerModeDesc;
Can any one help.
Thanks
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Collections;
import java.util.Comparator;
import java.util.Locale;
import java.util.Hashtable;
import java.util.prefs.Preferences;
import javax.speech.AudioException;
import javax.speech.Central;
import javax.speech.EngineException;
import javax.speech.synthesis.Synthesizer;
import javax.speech.synthesis.SynthesizerModeDesc;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.JTextArea;
import javax.swing.JToolBar;
public class JavaVoice extends JFrame implements Comparator {
private Synthesizer synth;
private File readFile = null;
Preferences preferences = Preferences.userRoot().node("dlb/JavaVoice");
JComboBox voices;
Hashtable list;
public JavaVoice() {
super("Java Voice Synthesizer");
addWindowListener(new AppCloser());
DefaultComboBoxModel model = new DefaultComboBoxModel();
try {
javax.speech.EngineList elist = Central.availableSynthesizers(null);
list = new Hashtable(elist.size());
Collections.sort(elist,this);
for (int i=0;i<elist.size();i++) {
SynthesizerModeDesc desc = (SynthesizerModeDesc)elist.elementAt(i);
model.addElement(desc.getModeName());
list.put(desc.getModeName(),desc);
synth = Central.createSynthesizer((SynthesizerModeDesc) list.get(preferences.get("voice.selected","")));
synth.allocate();
synth.resume();
catch(EngineException ex) {
ex.printStackTrace();
catch(AudioException ex) {
ex.printStackTrace();
final JTextArea textArea = new JTextArea();
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
JScrollPane scrollPane = new JScrollPane(textArea);
getContentPane().add(scrollPane,BorderLayout.CENTER);
JToolBar toolBar = new JToolBar();
JButton button = new JButton("Open");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
JFileChooser fileChooser = new JFileChooser(preferences.get("voice.openDirectory",System.getProperty("user.dir")));
if(fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
readFile = fileChooser.getSelectedFile();
preferences.put("voice.openDirectory",readFile.getParent());
try {
FileReader reader = new FileReader(readFile);
textArea.read(reader,readFile.getName());
reader.close();
catch(IOException ex) {
ex.printStackTrace();
toolBar.add(button);
button = new JButton("Clear");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
textArea.setText("");
toolBar.add(button);
toolBar.add(button);
button = new JButton("Start");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
String str = textArea.getSelectedText();
if(str != null && str.length() > 0) {
synth.speakPlainText(str.toLowerCase(),null);
textArea.setSelectionStart(0);
textArea.setSelectionEnd(0);
else {
str = textArea.getText();
synth.speakPlainText(str.toLowerCase(),null);
toolBar.add(button);
button = new JButton("Stop");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
try {
synth.cancel();
catch(ArrayIndexOutOfBoundsException ex) {}
toolBar.add(button);
toolBar.addSeparator();
toolBar.add(new JLabel("Voice:"));
voices = new JComboBox(model);
voices.setSelectedItem(preferences.get("voice.selected",""));
voices.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
try {
synth.deallocate();
String str = (String) voices.getSelectedItem();
preferences.put("voice.selected",str);
synth = Central.createSynthesizer((SynthesizerModeDesc) list.get(str));
synth.allocate();
synth.resume();
catch(EngineException ex) {
ex.printStackTrace();
catch(AudioException ex) {
ex.printStackTrace();
toolBar.add(voices);
toolBar.addSeparator();
button = new JButton("Exit");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
try {
synth.deallocate();
catch(EngineException ex) {
ex.printStackTrace();
preferences.putInt("voice.mainWindow.x",getLocation().x);
preferences.putInt("voice.mainWindow.y",getLocation().y);
preferences.putInt("voice.mainWindow.width",getSize().width);
preferences.putInt("voice.mainWindow.height",getSize().height);
System.exit(1);
toolBar.add(button);
getContentPane().add(toolBar,BorderLayout.NORTH);
final JTextField textField = new JTextField();
textField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
String txt = textField.getText();
if(txt.length() > 0) {
textArea.append(txt+'\n');
synth.speakPlainText(txt, null);
textField.setText("");
getContentPane().add(textField,BorderLayout.SOUTH);
int x = preferences.getInt("voice.mainWindow.x",1);
int y = preferences.getInt("voice.mainWindow.y",1);
int width = preferences.getInt("voice.mainWindow.width",640);
int height = preferences.getInt("voice.mainWindow.height",480);
setLocation(x,y);
setSize(width,height);
setVisible(true);
public int compare(Object obj1, Object obj2) {
SynthesizerModeDesc desc1 = (SynthesizerModeDesc) obj1;
SynthesizerModeDesc desc2 = (SynthesizerModeDesc) obj2;
return desc1.getModeName().compareToIgnoreCase(desc2.getModeName());
public static void main(String args[]) {
new JavaVoice();
class AppCloser extends WindowAdapter {
public void windowClosing(WindowEvent ev) {
try {
synth.deallocate();
catch(EngineException ex) {
ex.printStackTrace();
System.exit(1);
---------------------------------------------------------------------------------------------------------use code tags, post the error message.
http://forum.java.sun.com/help.jspa?sec=formatting -
Can anyone help me to find the Java Speech API?
I really need to use the Java Speech API but I don't have any idea where to find it.
In the Sun page are many implementations of the API but I want to use it and is very important for me.
Please, can anyone send me the little API...........Look at the thread two posts down, that might be what youre looking for. Theres also a thread seven posts down that will help you.
-
Can someone tell me, where I can find the java 2d API jar downloads.
Gentlepersons,
I am attempting to use vecmath.jar for a new app, and have apparently been bereft of the search gene. Can anyone tell me where to go (no, not figuratively) to get vecmath.jar (download site?)
Kindest regards
Dave -
Is java and pl/sql api for portal available in a zip format that can be downloaded for personal reference.
The API is available on portalstudio.oracle.com but there is no zipped format by which I can download the complete API reference.
Anyone pls. helpNobody seems to have an answer to such a simple question. Pls. tell me if such a thing exists.
-
Java Speech API / Mobile Media API ?
Does anyone know whether its possible to use JSAPI or MMAPI in mobile phones currently in the market?
If it aint then I am really surprised because the sound manipulation possible is very useful.Hey guys, surely some of you folks must have used it...
-
Dear All,
Can any one give brief description on java speech APIs. I want to build an application which recognizes users voice and perform the set of operations. Do i need any special hardware to be installed on my system???? What are the minimum system requirements for this.
Advance TX for the reply.......Dear All,
Can any one give brief description on java
n java speech APIs. I want to build an application
which recognizes users voice and perform the set of
operations. Do i need any special hardware to be
installed on my system???? What are the minimum system
requirements for this.
Advance TX for the reply.......From: http://java.sun.com/products/java-media/speech/forDevelopers/jsapi-guide/Introduction.html#8184
1.6 Requirements
To use the Java Speech API, a user must have certain minimum software and hardware available. The following is a broad sample of requirements. The individual requirements of speech synthesizers and speech recognizers can vary greatly and users should check product requirements closely.
Speech software: A JSAPI-compliant speech recognizer or synthesizer is required.
System requirements: most desktop speech recognizers and some speech synthesizers require relatively powerful computers to run effectively. Check the minimum and recommended requirements for CPU, memory and disk space when purchasing a speech product.
Audio Hardware: Speech synthesizers require audio output. Speech recognizers require audio input. Most desktop and laptop computers now sold have satisfactory audio support. Most dictation systems perform better with good quality sound cards.
Microphone: Desktop speech recognition systems get audio input through a microphone. Some recognizers, especially dictation systems, are sensitive to the microphone and most recognition products recommend particular microphones. Headset microphones usually provide best performance, especially in noisy environments. Table-top microphones can be used in some environments for some applications. -
Complete working code for Gmail POP3 & SMTP with SSL - Java mail API
Finally, your code-hunt has come to an end!!!!
I am presenting you the complete solution (with code) to send and retrieve you mails to & from GMAIL using SMTP and POP3 with SSL & Authenticaion enabled. [Even starters & newbies like me, can easy try, test & understand - But first download & add JAR's of Java Mail API & Java Activation Framework to Netbeans Library Manager]
Download Java Mail API here
http://java.sun.com/products/javamail/
Read Java Mail FAQ's here
http://java.sun.com/products/javamail/FAQ.html
Download Java Activation Framework [JAF]
http://java.sun.com/products/javabeans/jaf/downloads/index.html
Also, The POP program retrieves the mail sent with SMTP program :) [MOST IMPORTANT & LARGELY IN DEMAND]okey.. first things first... all of your thanks goes to the following and not a s@!te to me :)
hail Java !!
hail Java mail API !!
hail Java forums !!
hail Java-tips.org !!
hail Netbeans !!
Thanks to all coders who helped me by getting the code to work in one piece.
special thanks to "bshannon" - The dude who runs this forum from 97!!I am just as happy as you will be when you execute the below code!! [my 13 hours of tweaking & code hunting has paid off!!]
Now here it is...I only present you the complete solution!!
START OF PROGRAM 1
SENDING A MAIL FROM GMAIL ACCOUNT USING SMTP [STARTTLS (SSL)] PROTOCOL OF JAVA MAIL APINote on Program 1:
1. In the code below replace USERNAME & PASSWORD with your respective GMAIL account username and its corresponding password!
2. Use the code to make your Gmail client [jsp/servlets whatever]
//Mail.java - smtp sending starttls (ssl) authentication enabled
//1.Open a new Java class in netbeans (default package of the project) and name it as "Mail.java"
//2.Copy paste the entire code below and save it.
//3.Right click on the file name in the left side panel and click "compile" then click "Run"
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
public class Main
String d_email = "[email protected]",
d_password = "PASSWORD",
d_host = "smtp.gmail.com",
d_port = "465",
m_to = "[email protected]",
m_subject = "Testing",
m_text = "Hey, this is the testing email.";
public Main()
Properties props = new Properties();
props.put("mail.smtp.user", d_email);
props.put("mail.smtp.host", d_host);
props.put("mail.smtp.port", d_port);
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.auth", "true");
//props.put("mail.smtp.debug", "true");
props.put("mail.smtp.socketFactory.port", d_port);
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
SecurityManager security = System.getSecurityManager();
try
Authenticator auth = new SMTPAuthenticator();
Session session = Session.getInstance(props, auth);
//session.setDebug(true);
MimeMessage msg = new MimeMessage(session);
msg.setText(m_text);
msg.setSubject(m_subject);
msg.setFrom(new InternetAddress(d_email));
msg.addRecipient(Message.RecipientType.TO, new InternetAddress(m_to));
Transport.send(msg);
catch (Exception mex)
mex.printStackTrace();
public static void main(String[] args)
Main blah = new Main();
private class SMTPAuthenticator extends javax.mail.Authenticator
public PasswordAuthentication getPasswordAuthentication()
return new PasswordAuthentication(d_email, d_password);
END OF PROGRAM 1-----
START OF PROGRAM 2
RETRIVE ALL THE MAILS FROM GMAIL INBOX USING Post Office Protocol POP3 [SSL] PROTOCOL OF JAVA MAIL APINote:
1.Log into your gmail account via webmail [http://mail.google.com/]
2.Click on "settings" and select "Mail Forwarding & POP3/IMAP"
3.Select "enable POP for all mail" and "save changes"
4.In the code below replace USERNAME & PASSWORD with your respective GMAIL account username and its corresponding password!
PROGRAM 2 - PART 1 - Main.java
//1.Open a new Java class file in the default package
//2.Copy paste the below code and rename it to Mail.java
//3.Compile and execute this code.
public class Main {
/** Creates a new instance of Main */
public Main() {
* @param args the command line arguments
public static void main(String[] args) {
try {
GmailUtilities gmail = new GmailUtilities();
gmail.setUserPass("[email protected]", "PASSWORD");
gmail.connect();
gmail.openFolder("INBOX");
int totalMessages = gmail.getMessageCount();
int newMessages = gmail.getNewMessageCount();
System.out.println("Total messages = " + totalMessages);
System.out.println("New messages = " + newMessages);
System.out.println("-------------------------------");
//Uncomment the below line to print the body of the message. Remember it will eat-up your bandwidth if you have 100's of messages. //gmail.printAllMessageEnvelopes();
gmail.printAllMessages();
} catch(Exception e) {
e.printStackTrace();
System.exit(-1);
END OF PART 1
PROGRAM 2 - PART 2 - GmailUtilities.java
//1.Open a new Java class in the project (default package)
//2.Copy paste the below code
//3.Compile - Don't execute this[Run]
import com.sun.mail.pop3.POP3SSLStore;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.Properties;
import javax.mail.Address;
import javax.mail.FetchProfile;
import javax.mail.Flags;
import javax.mail.Folder;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.Part;
import javax.mail.Session;
import javax.mail.Store;
import javax.mail.URLName;
import javax.mail.internet.ContentType;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.ParseException;
public class GmailUtilities {
private Session session = null;
private Store store = null;
private String username, password;
private Folder folder;
public GmailUtilities() {
public void setUserPass(String username, String password) {
this.username = username;
this.password = password;
public void connect() throws Exception {
String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
Properties pop3Props = new Properties();
pop3Props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY);
pop3Props.setProperty("mail.pop3.socketFactory.fallback", "false");
pop3Props.setProperty("mail.pop3.port", "995");
pop3Props.setProperty("mail.pop3.socketFactory.port", "995");
URLName url = new URLName("pop3", "pop.gmail.com", 995, "",
username, password);
session = Session.getInstance(pop3Props, null);
store = new POP3SSLStore(session, url);
store.connect();
public void openFolder(String folderName) throws Exception {
// Open the Folder
folder = store.getDefaultFolder();
folder = folder.getFolder(folderName);
if (folder == null) {
throw new Exception("Invalid folder");
// try to open read/write and if that fails try read-only
try {
folder.open(Folder.READ_WRITE);
} catch (MessagingException ex) {
folder.open(Folder.READ_ONLY);
public void closeFolder() throws Exception {
folder.close(false);
public int getMessageCount() throws Exception {
return folder.getMessageCount();
public int getNewMessageCount() throws Exception {
return folder.getNewMessageCount();
public void disconnect() throws Exception {
store.close();
public void printMessage(int messageNo) throws Exception {
System.out.println("Getting message number: " + messageNo);
Message m = null;
try {
m = folder.getMessage(messageNo);
dumpPart(m);
} catch (IndexOutOfBoundsException iex) {
System.out.println("Message number out of range");
public void printAllMessageEnvelopes() throws Exception {
// Attributes & Flags for all messages ..
Message[] msgs = folder.getMessages();
// Use a suitable FetchProfile
FetchProfile fp = new FetchProfile();
fp.add(FetchProfile.Item.ENVELOPE);
folder.fetch(msgs, fp);
for (int i = 0; i < msgs.length; i++) {
System.out.println("--------------------------");
System.out.println("MESSAGE #" + (i + 1) + ":");
dumpEnvelope(msgs);
public void printAllMessages() throws Exception {
// Attributes & Flags for all messages ..
Message[] msgs = folder.getMessages();
// Use a suitable FetchProfile
FetchProfile fp = new FetchProfile();
fp.add(FetchProfile.Item.ENVELOPE);
folder.fetch(msgs, fp);
for (int i = 0; i < msgs.length; i++) {
System.out.println("--------------------------");
System.out.println("MESSAGE #" + (i + 1) + ":");
dumpPart(msgs[i]);
public static void dumpPart(Part p) throws Exception {
if (p instanceof Message)
dumpEnvelope((Message)p);
String ct = p.getContentType();
try {
pr("CONTENT-TYPE: " + (new ContentType(ct)).toString());
} catch (ParseException pex) {
pr("BAD CONTENT-TYPE: " + ct);
* Using isMimeType to determine the content type avoids
* fetching the actual content data until we need it.
if (p.isMimeType("text/plain")) {
pr("This is plain text");
pr("---------------------------");
System.out.println((String)p.getContent());
} else {
// just a separator
pr("---------------------------");
public static void dumpEnvelope(Message m) throws Exception {
pr(" ");
Address[] a;
// FROM
if ((a = m.getFrom()) != null) {
for (int j = 0; j < a.length; j++)
pr("FROM: " + a[j].toString());
// TO
if ((a = m.getRecipients(Message.RecipientType.TO)) != null) {
for (int j = 0; j < a.length; j++) {
pr("TO: " + a[j].toString());
// SUBJECT
pr("SUBJECT: " + m.getSubject());
// DATE
Date d = m.getSentDate();
pr("SendDate: " +
(d != null ? d.toString() : "UNKNOWN"));
static String indentStr = " ";
static int level = 0;
* Print a, possibly indented, string.
public static void pr(String s) {
System.out.print(indentStr.substring(0, level * 2));
System.out.println(s);
}END OF PART 2
END OF PROGRAM 2
P.S: CHECKING !!
STEP 1.
First compile and execute the PROGRAM 1 with your USERNAME & PASSWORD. This will send a mail to your own account.
STEP 2.
Now compile both PART 1 & PART 2 of PROGRAM 2. Then, execute PART 1 - Main.java. This will retrive the mail sent in step 1. njoy! :)
In future, I hope this is added to the demo programs of the Java Mail API download package.
This is for 3 main reasons...
1. To prevent a lot of silly questions being posted on this forum [like the ones I did :(].
2. To give the first time Java Mail user with a real time working example without code modification [code has to use command line args like the demo programs - for instant results].
3. Also, this is what google has to say..
"The Gmail Team is committed to making sure you always can access your mail. That's why we're offering POP access and auto-forwarding. Both features are free for all Gmail users and we have no plans to charge for them in the future."
http://mail.google.com/support/bin/answer.py?answer=13295
I guess bshannon & Java Mail team is hearing this....
Again, Hurray and thanks for helping me make it!! cheers & no more frowned faces!!
(: (: (: (: (: GO JCODERS GO!! :) :) :) :) :)
codeace
-----Thanks for the reply,
I did checked by enabling session debuging and also checked pop settings it's enabled for all
mails, I tried deleting some very old messages and now the message count is changed to 310.
This may be the problem with gmail.
Bellow is the output i got,
DEBUG: setDebug: JavaMail version 1.4ea
DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]
DEBUG POP3: connecting to host "pop.gmail.com", port 995, isSSL false
S: +OK Gpop ready for requests from 121.243.255.240 n22pf5432603pof.2
C: USER [email protected]
S: +OK send PASS
C: PASS my_password
S: +OK Welcome.
C: STAT
S: +OK 310 26900234
Custom output: messageCount : 310
C: QUIT
S: +OK Farewell. -
Hi i found the code below on Java.Sun and i have read about different
speech engines like Freetts that develop the Java Speech API.
But i still can not compile the following code as the 3 packages
declared can not be found?
Could anyone be so kind as to tell me what i need to install in oder to
use these packages??!!
Are there jar packages i need to reference in my classpath? wheer are these packages?
cheers and thanks for any replys!
import javax.speech.*;
import javax.speech.synthesis.*;
import java.util.Locale;
public class HelloWorld {
public static void main(String args[]) {
try {
// Create a synthesizer for English
Synthesizer synth = Central.createSynthesizer(
new SynthesizerModeDesc(Locale.ENGLISH));
// Get it ready to speak
synth.allocate();
synth.resume();
// Speak the "Hello world" string
synth.speakPlainText("Hello, world!", null);
// Wait till speaking is done
synth.waitEngineState(Synthesizer.QUEUE_EMPTY);
// Clean up
synth.deallocate();
} catch (Exception e) {
e.printStackTrace();
}* Copyright 2003 Sun Microsystems, Inc.
* See the file "license.terms" for information on usage and
* redistribution of this file, and for a DISCLAIMER OF ALL
* WARRANTIES.
import com.sun.speech.freetts.Voice;
import com.sun.speech.freetts.VoiceManager;
import com.sun.speech.freetts.audio.JavaClipAudioPlayer;
//import javax.speech.*;
//import javax.speech.synthesis.*;
//import java.util.*;
* Simple program to demonstrate the use of the FreeTTS speech
* synthesizer. This simple program shows how to use FreeTTS
* without requiring the Java Speech API (JSAPI).
public class FreeTTSHelloWorld {
* Example of how to list all the known voices.
public static void listAllVoices() {
System.out.println();
System.out.println("All voices available:");
VoiceManager voiceManager = VoiceManager.getInstance();
Voice[] voices = voiceManager.getVoices();
for (int i = 0; i < voices.length; i++) {
System.out.println(" " + voices.getName()
+ " (" + voices[i].getDomain() + " domain)");
public static void main(String[] args) {
listAllVoices();
String voiceName = (args.length > 0)
? args[0]
: "kevin16";
System.out.println();
System.out.println("Using voice: " + voiceName);
/* The VoiceManager manages all the voices for FreeTTS.
VoiceManager voiceManager = VoiceManager.getInstance();
Voice helloVoice = voiceManager.getVoice(voiceName);
if (helloVoice == null) {
System.err.println(
"Cannot find a voice named "
+ voiceName + ". Please specify a different voice.");
System.exit(1);
/* Allocates the resources for the voice.
helloVoice.allocate();
/* Synthesize speech.
helloVoice.speak("Thank you for giving me a voice. "
+ "I'm so glad to say hello to this world.");
/* Clean up and leave.
helloVoice.deallocate();
System.exit(0); -
Hi
I'm new to the Java Speech API and JSP. Does anybody know if it is possible to use java speech in jsp pages? Somebody told me if you want to use java speech on the web you need to use applets. It that true?
Oh yeah, I'm using the FreeTTS implementation from SourceForge.
Thanks
jjamesisSorry if this takes up too much space.
Heres the error when I try to run my applet.
java.lang.NoClassDefFoundError: javax/speech/EngineModeDesc
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Heres the code for the applet
import java.io.File;
import java.util.Locale;
import java.util.Vector;
import javax.speech.Central;
import javax.speech.Engine;
import javax.speech.EngineList;
import javax.speech.synthesis.Synthesizer;
import javax.speech.synthesis.SynthesizerModeDesc;
import javax.speech.synthesis.SynthesizerProperties;
import javax.speech.synthesis.Voice;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class SpeechApplet extends JApplet implements ActionListener {
private JPanel mainPanel;
private JLabel label;
private JButton button;
private JTextField textField;
Synthesizer synthesizer;
public void init() {
label = new JLabel();
textField = new JTextField(20);
button = new JButton("Click Me");
button.addActionListener(this);
mainPanel = new JPanel(new BorderLayout());
mainPanel.add(label, BorderLayout.NORTH);
mainPanel.add(textField, BorderLayout.CENTER);
mainPanel.add(button, BorderLayout.SOUTH);
Container c = getContentPane();
c.add(mainPanel);
setSize(100, 100);
try {
setup();
} catch (Exception e) {}
public void setup() throws Exception {
String voiceName = "keven16";
SynthesizerModeDesc desc = new SynthesizerModeDesc(
null, // engine name
"general", // mode name
Locale.US, // locale
null, // running
null); // voice
synthesizer = Central.createSynthesizer(desc);
synthesizer.allocate();
synthesizer.resume();
desc = (SynthesizerModeDesc) synthesizer.getEngineModeDesc();
Voice[] voices = desc.getVoices();
Voice voice = null;
for (int i = 0; i < voices.length; i++) {
if (voices.getName().equals(voiceName)) {
voice = voices[i];
break;
synthesizer.getSynthesizerProperties().setVoice(voice);
public void speak(String input) throws Exception {
synthesizer.speakPlainText(input,null);
synthesizer.waitEngineState(Synthesizer.QUEUE_EMPTY);
public void actionPerformed(ActionEvent ae) {
try {
String input = textField.getText();
label.setText(input);
} catch (Exception e) {} -
Is there a way to download the entire Java 6 API to my computer so that I don't need internet access for it?
Thanksok, im having problems downloading THIS jre-6u1 i started it the first time but it was so slow i canceled the install, then i tried a second time i get this HTTP STATUS CODE=302 unable to install- Anyone have a solution? I've tried restore, nothing works
-
Hi,
From where can i get Java 3D API
It must provided by oracle onlySeeing as you abandoned your earlier thread
How to extends any Exsinting VO
and didn't bother replying to AJ's helpful response theree, I wish you luck getting more help here.
db
Maybe you are looking for
-
I have an iPhone 3, and it was synced to iTunes on my old laptop. My laptop recently crashed, and now I have a new laptop. I just dowloaded iTunes and imported a few CDs that I want to add to my iPhone. Unfortunately, I can't add them to my iPhone
-
Toshiba laptop boots up in F2 mode
Hi Please help me. Ive been given a Toshiba laptop and when it boots up its always in F2 mode, and wont close down or boot up properly????? How do I stop this ?? Any help, thanks
-
Extracting file from a TAR file with java.util.zip.* classes
Is there a way to extract files from a .TAR file using the java.util.zip.* classes? I tried in some ways but I get the following error: java.util.zip.ZipException: error in opening zip file at java.util.zip.ZipFile.<init>(ZipFile.java127) at java.uti
-
Where clause "where 1=1" help with SQL tuning
Hello Tuning experts, Is it helpful to use "where 1=1" and then put all the joins and conditions in the "AND" statements of the SQL when writing SQL queries. I would like to know if it helps with query performance to write SQL queirs that way. Thanks
-
Is there any option to degrade Nokia belle from C6...
can anyone help me to downgrade nokia belle from C6-01 as many software is not supporting with it. am not able to use FRING after i upgrade to Nokia belle plsss help somebody to rectify the issue