Class FreeTTS

java.lang.Object
com.sun.speech.freetts.FreeTTS
Direct Known Subclasses:
FreeTTSTime

public class FreeTTS extends Object
Standalone utility that directly interacts with a CMUDiphoneVoice.
  • Field Details

  • Constructor Details

    • FreeTTS

      public FreeTTS()
      Constructs a default FreeTTS with the kevin16 voice.
    • FreeTTS

      public FreeTTS(Voice voice)
      Creates a FreeTTS object with the given Voice.
      Parameters:
      voice - the voice to use
  • Method Details

    • startup

      public void startup()
      Starts this FreeTTS Synthesizer by loading the void and creating a new AudioPlayer.
    • shutdown

      public void shutdown()
      Shuts down this FreeTTS synthesizer by closing the AudioPlayer and voice.
    • textToSpeech

      public boolean textToSpeech(String text)
      Converts the given text to speech based using processing options currently set in FreeTTS.
      Parameters:
      text - the text to speak
      Returns:
      true if the utterance was played properly
    • getVoice

      protected Voice getVoice()
      Returns the voice used by FreeTTS.
      Returns:
      the voice used by freetts
    • streamToSpeech

      public boolean streamToSpeech(InputStream is)
      Converts the text contained in the given stream to speech.
      Parameters:
      is - the stream containing the text to speak
    • urlToSpeech

      public boolean urlToSpeech(String urlPath)
      Converts the text contained in the given path to speech.
      Parameters:
      urlPath - the file containing the text to speak
      Returns:
      true if the utterance was played properly
    • fileToSpeech

      public boolean fileToSpeech(String filePath)
      Converts the text contained in the given path to speech.
      Parameters:
      filePath - the file containing the text to speak
      Returns:
      true if the utterance was played properly
    • setSilentMode

      public void setSilentMode(boolean silent)
      Turns audio playing on and off.
      Parameters:
      silent - if true, don't play audio
    • getSilentMode

      public boolean getSilentMode()
      Gets silent mode.
      Returns:
      true if in silent mode
      See Also:
    • setInputMode

      public void setInputMode(InputMode inputMode)
      Sets the input mode.
      Parameters:
      inputMode - the input mode
    • getInputMode

      public InputMode getInputMode()
      Returns the InputMode.
      Returns:
      the input mode
      See Also:
    • setAudioFile

      public void setAudioFile(String audioFile)
      Sets the audio file .
      Parameters:
      audioFile - the audioFile
    • setMultiAudio

      public void setMultiAudio(boolean multiAudio)
      Sets multi audio. If true, and an audio file has been set output will be sent to multiple files
      Parameters:
      multiAudio - if true send output to multiple files.
    • setStreamingAudio

      public void setStreamingAudio(boolean streamingAudio)
      Sets streaming audio. If true, output will be sent to
      Parameters:
      streamingAudio - if true stream audio
    • main

      public static void main(String[] args)
      The main entry point for FreeTTS.