Wie kann ich Ausgabestimme in einer Audiodatei in freetts speichern?

Ich versuche, Freetts für eine einfache Java-Anwendung zu verwenden, aber ich stehe vor einem Problem. Kann mir jemand sagen, wie ich die ausgegebene Stimme, die von Text zu Sprache konvertiert wird, in meinem Programm in eine Wave-Datei speichern kann? Ich möchte es per Code machen.

Dies ist die Beispielanwendung von helloworld, die mit dem Beispiel @ geliefert wir

/**
 * 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.FreeTTS;
import com.sun.speech.freetts.Voice;
import com.sun.speech.freetts.VoiceManager;
import com.sun.speech.freetts.audio.JavaClipAudioPlayer;

/**
 * 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 main(String[] args) {

       // listAllVoices();

        FreeTTS freetts;

        String voiceName = "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);
    }
}

Dieser Code funktioniert einwandfrei. Ich möchte die Ausgabe als Audiodatei auf meiner Festplatte speichern.

Danke Pranay

Antworten auf die Frage(4)

Ihre Antwort auf die Frage