Can any body find a bug and solve it in the following text to speech
converter?

Thanks & Regards
SAUMIL MEHTA

---------- Forwarded message ----------
From: amit sharma <[EMAIL PROTECTED]>
Date: Thu, Sep 4, 2008 at 9:17 PM
Subject: text to speech from amit sharma
To: [EMAIL PROTECTED]


hi saumil  i thaink there is a problem in speechSynthesizer.allocate();
because it return NULL i also attach my code here....

------------------------------
Get an email ID as [EMAIL PROTECTED] or [EMAIL PROTECTED] Click
here.<http://in.rd.yahoo.com/tagline_dbid_4/*http://in.promos.yahoo.com/address>
import java.util.Locale;
import javax.speech.Central;
import javax.speech.synthesis.Synthesizer;
import javax.speech.synthesis.SynthesizerModeDesc;
import javax.speech.synthesis.SynthesizerProperties;


public class tts {
private Synthesizer speechSynthesizer;
public tts(){

try{
// create SynthesizerModeDesc for FreeTTS synthesizer
SynthesizerModeDesc descriptor = new SynthesizerModeDesc(
"Unlimited domain FreeTTS Speech Synthesizer " +
"from Sun Labs", null, Locale.US, Boolean.FALSE, null);

// create a Synthesizer
speechSynthesizer = Central.createSynthesizer( descriptor );

System.out.println( "Synthesizer:."+ speechSynthesizer);
// Synthesizer created successfully
// Synthesizer created successfully
if ( speechSynthesizer != null )
{
// prepare synthesizer to speak
speechSynthesizer.allocate();
speechSynthesizer.resume();

// get synthesizer properties
SynthesizerProperties properties =
speechSynthesizer.getSynthesizerProperties();

// set up speaking rate
properties.setSpeakingRate( 100.0f );

} // end if

else
{
System.err.println( "Synthesizer creation failed." );
System.exit( 1 );
}
String sr="hello how are you";
speechSynthesizer.speakPlainText(sr, null);
speechSynthesizer.deallocate();
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static void main (String srr[]){
tts t=new tts();
}
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Java 
EE (J2EE) Programming with Passion!" group.
To post to this group, send email to 
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en
-~----------~----~----~----~------~----~------~--~---

import java.util.Locale;
import javax.speech.Central;
import javax.speech.synthesis.Synthesizer;
import javax.speech.synthesis.SynthesizerModeDesc;
import javax.speech.synthesis.SynthesizerProperties;


public class tts {
private Synthesizer speechSynthesizer;
public tts(){

try{
// create SynthesizerModeDesc for FreeTTS synthesizer
SynthesizerModeDesc descriptor = new SynthesizerModeDesc(
"Unlimited domain FreeTTS Speech Synthesizer " +
"from Sun Labs", null, Locale.US, Boolean.FALSE, null);

// create a Synthesizer
speechSynthesizer = Central.createSynthesizer( descriptor );

System.out.println( "Synthesizer:."+ speechSynthesizer);
// Synthesizer created successfully
// Synthesizer created successfully
if ( speechSynthesizer != null )
{
// prepare synthesizer to speak
speechSynthesizer.allocate();
speechSynthesizer.resume();

// get synthesizer properties
SynthesizerProperties properties =
speechSynthesizer.getSynthesizerProperties();

// set up speaking rate
properties.setSpeakingRate( 100.0f );

} // end if

else
{
System.err.println( "Synthesizer creation failed." );
System.exit( 1 );
}
String sr="hello how are you";
speechSynthesizer.speakPlainText(sr, null);
speechSynthesizer.deallocate();
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static void main (String srr[]){
tts t=new tts();
}
}




Reply via email to