Page 2 of 2 FirstFirst 12
Results 21 to 30 of 30
  1. #21
    chaminga is offline Member
    Join Date
    Jul 2010
    Posts
    16
    Rep Power
    0

    Default

    Thank u sir,
    I'ii try that.
    I'm really sry for the bother u.

    regards ,
    Chaminga

  2. #22
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,570
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by chaminga View Post
    Thank u sir,
    I'ii try that.
    I'm really sry for the bother u.

    regards ,
    Chaminga
    You're not bothering me at all; the only thing that bothers me (not really ;-) is that the FreeTTS API works fine but the JSAPI interface on top of it doesn't work at all; the cheap way out is easy: don't use the JSAPI. I think that project is stone dead which isn't an incentive to explore any further ...

    kind regards,

    Jos

  3. #23
    chaminga is offline Member
    Join Date
    Jul 2010
    Posts
    16
    Rep Power
    0

    Default

    import javax.speech.*;
    import javax.speech.synthesis.*;
    import java.util.*;

    public class TellTime {

    public static void main(String[] args) {

    try {
    Calendar calendar = new GregorianCalendar();
    String sayTime = "Its " +
    calendar.get(Calendar.HOUR) + " " +
    calendar.get(Calendar.MINUTE) + " " +
    (calendar.get(Calendar.AM_PM)== 0 ? "AM" : "PM");

    Synthesizer synth = Central.createSynthesizer(null);
    synth.allocate();
    synth.resume();

    synth.speakPlainText(sayTime,null);

    synth.waitEngineState(Synthesizer.QUEUE_EMPTY);
    synth.deallocate();

    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    }




    I used this simple code. I put all freetts-1.2 jar files to my classpath and put speech.properties file to java home. But i got this exception.


    System property "mbrola.base" is undefined. Will not use MBROLA voices.
    Jul 9, 2010 3:42:29 PM com.sun.speech.freetts.Voice allocate
    SEVERE: Can't load voice java.util.zip.ZipException: ZipFile closed
    Exception in thread "main" java.lang.Error: java.util.zip.ZipException: ZipFile closed
    at com.sun.speech.freetts.Voice.allocate(Voice.java:3 51)
    at com.sun.speech.freetts.jsapi.FreeTTSSynthesizer.se tCurrentVoice(FreeTTSSynthesizer.java:122)
    at com.sun.speech.freetts.jsapi.FreeTTSSynthesizer.ha ndleAllocate(FreeTTSSynthesizer.java:85)
    at com.sun.speech.engine.BaseEngine.allocate(BaseEngi ne.java:219)
    at TellTime.main(TellTime.java:18)
    Caused by: java.util.zip.ZipException: ZipFile closed
    at java.util.zip.ZipFile.ensureOpenOrZipException(Zip File.java:413)
    at java.util.zip.ZipFile.access$1100(ZipFile.java:29)
    at java.util.zip.ZipFile$ZipFileInputStream.read(ZipF ile.java:445)
    at java.util.zip.ZipFile$1.fill(ZipFile.java:230)
    at java.util.zip.InflaterInputStream.read(InflaterInp utStream.java:141)
    at java.io.FilterInputStream.read(FilterInputStream.j ava:116)
    at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.j ava:264)
    at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.ja va:306)
    at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:1 58)
    at java.io.InputStreamReader.read(InputStreamReader.j ava:167)
    at java.io.BufferedReader.fill(BufferedReader.java:13 6)
    at java.io.BufferedReader.readLine(BufferedReader.jav a:299)
    at java.io.BufferedReader.readLine(BufferedReader.jav a:362)
    at com.sun.speech.freetts.en.us.PronounceableFSM.load Text(PronounceableFSM.java:91)
    at com.sun.speech.freetts.en.us.PronounceableFSM.<ini t>(PronounceableFSM.java:60)
    at com.sun.speech.freetts.en.us.PrefixFSM.<init>(Pref ixFSM.java:26)
    at com.sun.speech.freetts.en.us.CMUVoice.setupUtteran ceProcessors(CMUVoice.java:116)
    at com.sun.speech.freetts.en.us.CMUVoice.loader(CMUVo ice.java:77)
    at com.sun.speech.freetts.Voice.allocate(Voice.java:3 48)
    ... 4 more





    May i know the reason for this.

    Regards,
    Chaminga.

  4. #24
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,570
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by chaminga View Post
    May i know the reason for this.
    Did you try my example (see reply #18); I know it runs and you can work from that point on ...

    kind regards,

    Jos

  5. #25
    chaminga is offline Member
    Join Date
    Jul 2010
    Posts
    16
    Rep Power
    0

    Default

    yes sir.

    I tried that one. But it also give same error.

    System property "mbrola.base" is undefined. Will not use MBROLA voices.
    Jul 9, 2010 4:19:22 PM com.sun.speech.freetts.Voice allocate
    SEVERE: Can't load voice java.util.zip.ZipException: ZipFile closed
    Exception in thread "main" java.lang.Error: java.util.zip.ZipException: ZipFile closed
    at com.sun.speech.freetts.Voice.allocate(Voice.java:3 51)
    at T.main(T.java:21)
    Caused by: java.util.zip.ZipException: ZipFile closed
    at java.util.zip.ZipFile.ensureOpenOrZipException(Zip File.java:413)
    at java.util.zip.ZipFile.access$1100(ZipFile.java:29)
    at java.util.zip.ZipFile$ZipFileInputStream.read(ZipF ile.java:445)
    at java.util.zip.ZipFile$1.fill(ZipFile.java:230)
    at java.util.zip.InflaterInputStream.read(InflaterInp utStream.java:141)
    at java.io.FilterInputStream.read(FilterInputStream.j ava:116)
    at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.j ava:264)
    at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.ja va:306)
    at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:1 58)
    at java.io.InputStreamReader.read(InputStreamReader.j ava:167)
    at java.io.BufferedReader.fill(BufferedReader.java:13 6)
    at java.io.BufferedReader.readLine(BufferedReader.jav a:299)
    at java.io.BufferedReader.readLine(BufferedReader.jav a:362)
    at com.sun.speech.freetts.en.us.PronounceableFSM.load Text(PronounceableFSM.java:91)
    at com.sun.speech.freetts.en.us.PronounceableFSM.<ini t>(PronounceableFSM.java:60)
    at com.sun.speech.freetts.en.us.PrefixFSM.<init>(Pref ixFSM.java:26)
    at com.sun.speech.freetts.en.us.CMUVoice.setupUtteran ceProcessors(CMUVoice.java:116)
    at com.sun.speech.freetts.en.us.CMUVoice.loader(CMUVo ice.java:77)
    at com.sun.speech.freetts.Voice.allocate(Voice.java:3 48)
    ... 1 more

    :( :(



    regards,
    chaminga

  6. #26
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,570
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by chaminga View Post
    I tried that one. But it also give same error.
    There must be something wrong in your .jar file visibility then because the example works for me: I use Java 1.6 and I have the following nine files in my JRE\lib\ext directory (they are always visible there):

    Java Code:
    03/09/2009  01:39 PM           894,905 cmudict04.jar
    03/09/2009  01:40 PM           599,429 cmulex.jar
    03/09/2009  01:39 PM             1,231 cmutimelex.jar
    03/09/2009  01:39 PM         1,723,774 cmu_time_awb.jar
    03/09/2009  01:39 PM         4,899,359 cmu_us_kal.jar
    03/09/2009  01:40 PM           866,598 en_us.jar
    03/09/2009  01:39 PM           208,668 freetts.jar
    10/01/2003  11:51 AM            51,811 jsapi.jar
    03/09/2009  01:39 PM            11,926 mbrola.jar
    My example code runs with that configuration. Try again.

    kind regards,

    Jos
    Last edited by JosAH; 07-10-2010 at 09:04 PM.

  7. #27
    karthi is offline Member
    Join Date
    Jul 2010
    Posts
    1
    Rep Power
    0

    Default

    Thanks Jos ur posts really helped me out thanks alot:)

  8. #28
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,570
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by karthi View Post
    Thanks Jos ur posts really helped me out thanks alot:)
    You're welcome and if you manage to figure out how those 'mbrola' voices work feel free to post here because all my attempts sofar have failed; I think it has to do with over the edge classpath fiddling in the jar files (I haven't looked into them yet); they brag about it in their documentation but I suspect the fiddling has turned against them/us.

    kind regards,

    Jos

  9. #29
    Laxman Rana is offline Member
    Join Date
    Mar 2011
    Posts
    1
    Rep Power
    0

    Default Java Speech

    M getting the same Error @ synth.allocate();

    error:-
    java.lang.NullPointerException


    can any one help me out

  10. #30
    Join Date
    Jan 2012
    Posts
    1
    Rep Power
    0

    Smile Re: java speech Synthesizer

    import javax.speech.*;
    import javax.speech.synthesis.*;
    import java.util.Locale;
    import java.util.Scanner;

    public class speechtotextdemo {
    public static void main(String args[]) {
    try {
    Scanner s = new Scanner(System.in);
    // Create a synthesizer for English
    SynthesizerModeDesc desc = new SynthesizerModeDesc(null,"general", Locale.US,null,null);
    Synthesizer synthesizer = Central.createSynthesizer(desc);

    // Get it ready to speak
    synthesizer.allocate();
    synthesizer.resume();

    // Speak the "any" string
    System.out.println("enter the string to be pronounced");
    String str = s.nextLine();
    synthesizer.speakPlainText(str, null);

    // Wait till speaking is done
    synthesizer.waitEngineState(Synthesizer.QUEUE_EMPT Y);

    // Clean up
    synthesizer.deallocate();
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    }


    perfectly working code. Now plz anyone who could plz tell me how code i generate different kinda voices.???

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Speech in Web Application
    By vinoopraj in forum Advanced Java
    Replies: 0
    Last Post: 06-23-2010, 11:27 AM
  2. Speech Recognition In Java
    By hackernewbie in forum Advanced Java
    Replies: 6
    Last Post: 01-18-2010, 11:06 PM
  3. Java Speech Processing
    By redvirus in forum CLDC and MIDP
    Replies: 2
    Last Post: 10-03-2009, 12:16 AM
  4. Help with Java Speech API (Synthesizer)
    By mohitkhanna3v_infinate in forum Advanced Java
    Replies: 1
    Last Post: 07-23-2009, 06:21 PM
  5. Java Speech Recognizer
    By Lynx09 in forum Advanced Java
    Replies: 0
    Last Post: 03-30-2009, 08:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •