Results 1 to 4 of 4
  1. #1
    kienkun1990 is offline Member
    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0

    Default Text to Speech,help me

    This a my code
    PHP Code:
     Synthesizer suynth = Central.createSynthesizer(new SynthesizerModeDesc(Locale.ENGLISH));
                suynth.allocate();
                suynth.resume();
                suynth.speakPlainText("Hello", null);
                suynth.waitEngineState(Synthesizer.QUEUE_EMPTY);
                suynth.deallocate();
    When run , I want to return for me a file mp3 but haven't done.Can you help me
    Thank you very muck

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,419
    Rep Power
    20

    Default Re: Text to Speech,help me

    Is Central the name of a class, or is it a badly named variable? There's no such class in the standard JDK.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    sabre150 is offline Member
    Join Date
    Jul 2012
    Location
    Earth
    Posts
    75
    Rep Power
    0

    Default Re: Text to Speech,help me

    Quote Originally Posted by DarrylBurke View Post
    Is Central the name of a class, or is it a badly named variable? There's no such class in the standard JDK.

    db
    Mind reading once more a pre-requisite. I thought it might be one of the classes in the "Open Mary" project but I can't find either Synthesizer or Central in the Javadoc.

  4. #4
    kienkun1990 is offline Member
    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0

    Default Re: Text to Speech,help me

    Thank you,I have had a good solution.Below is my fuction

    public void toWavFile(String text, String fileName) {
    try {
    CGAudioManager audioMan = (CGAudioManager) synth.getAudioManager();
    AudioFormat audioFomat = audioMan.getAudioFormat();
    AudioFileFormat afm = new AudioFileFormat(AudioFileFormat.Type.WAVE, audioFomat, AudioSystem.NOT_SPECIFIED);
    AudioFileSink sink = new AudioFileSink(new File(fileName + ".wav"), afm);

    new AudioFormatConverter(audioMan, sink, true);

    audioMan.startSending();

    synth.speakPlainText(text, null);
    synth.waitEngineState(Synthesizer.QUEUE_EMPTY);
    audioMan.closeOutput();

    sink.drain();
    } catch (InterruptedException ex) {
    Logger.getLogger(TextToSpeech.class.getName()).log (Level.SEVERE, null, ex);
    } catch (IOException ex) {
    Logger.getLogger(TextToSpeech.class.getName()).log (Level.SEVERE, null, ex);
    } catch (EngineStateError ex) {
    Logger.getLogger(TextToSpeech.class.getName()).log (Level.SEVERE, null, ex);
    } catch (IllegalArgumentException ex) {
    Logger.getLogger(TextToSpeech.class.getName()).log (Level.SEVERE, null, ex);
    }
    }
    Last edited by kienkun1990; 09-16-2012 at 03:56 PM.

Similar Threads

  1. Speech To Text
    By jyothi.priyanka in forum Advanced Java
    Replies: 1
    Last Post: 12-04-2011, 11:44 AM
  2. text to speech conversioin using freeTTs
    By yonas in forum New To Java
    Replies: 3
    Last Post: 05-24-2011, 04:58 PM
  3. Text To Speech
    By jyothi.priyanka in forum Advanced Java
    Replies: 0
    Last Post: 02-24-2011, 05:00 PM
  4. speech to text concersion
    By ak88 in forum Advanced Java
    Replies: 1
    Last Post: 03-09-2010, 08:57 AM
  5. Capture speech and convert it to text in a textbox
    By Cyber Dragon in forum Advanced Java
    Replies: 1
    Last Post: 04-25-2009, 04:55 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
  •