Class FreeTTSTime

java.lang.Object
com.sun.speech.freetts.FreeTTS
com.sun.speech.freetts.FreeTTSTime

public class FreeTTSTime extends FreeTTS
Standalone utility that tells the time. Defaults to "alan" voice.
  • Constructor Details

    • FreeTTSTime

      public FreeTTSTime()
      Class constructor.
    • FreeTTSTime

      public FreeTTSTime(Voice voice)
      Class constructor.
      Parameters:
      voice - Voice to say time with
  • Method Details

    • usage

      public static void usage()
      Prints the usage message for FreeTTSTime.
    • timeToString

      public static String timeToString(String time)
      Returns a string that corresponds to the given time.
      Parameters:
      time - the time in the form HH:MM
      Returns:
      the time in string, null if the given time is not in the form HH:MM
    • timeToString

      public static String timeToString(int hour, int min)
      Returns a string that corresponds to the given time.
      Parameters:
      hour - the hour
      min - the minutes
      Returns:
      the time in string, null if the given time out of range
    • timeToSpeech

      public void timeToSpeech(String time)
      Speaks the given time. Time should be in the exact form HH:MM where HH is the hour 00 to 23, and MM is the minute 00 to 59.
      Parameters:
      time - the time in the form HH:MM
      Throws:
      IllegalArgumentException - if time is not in the form HH:MM
    • timeToSpeech

      public void timeToSpeech(int hour, int min)
      Speaks the time given the hour and minute.
      Parameters:
      hour - the hour of the day (0 to 23)
      min - the minute of the hour (0 to 59)
    • safeTimeToSpeech

      public void safeTimeToSpeech(String time)
      Speaks the given time. Prints an error message if the time is ill-formed.
      Parameters:
      time - the time in the form HH:MM
    • speakNow

      public void speakNow()
      Tells the current time.
    • main

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