Package com.sun.speech.freetts
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 Summary
Constructors Constructor Description FreeTTSTime()
Class constructor.FreeTTSTime(Voice voice)
Class constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
main(java.lang.String[] args)
The main entry point for FreeTTSTime.void
safeTimeToSpeech(java.lang.String time)
Speaks the given time.void
speakNow()
Tells the current time.void
timeToSpeech(int hour, int min)
Speaks the time given the hour and minute.void
timeToSpeech(java.lang.String time)
Speaks the given time.static java.lang.String
timeToString(int hour, int min)
Returns a string that corresponds to the given time.static java.lang.String
timeToString(java.lang.String time)
Returns a string that corresponds to the given time.static void
usage()
Prints the usage message for FreeTTSTime.-
Methods inherited from class com.sun.speech.freetts.FreeTTS
fileToSpeech, getInputMode, getSilentMode, getVoice, setAudioFile, setInputMode, setMultiAudio, setSilentMode, setStreamingAudio, shutdown, startup, streamToSpeech, textToSpeech, urlToSpeech
-
-
-
-
Constructor Detail
-
FreeTTSTime
public FreeTTSTime()
Class constructor.
-
FreeTTSTime
public FreeTTSTime(Voice voice)
Class constructor.- Parameters:
voice
- Voice to say time with
-
-
Method Detail
-
usage
public static void usage()
Prints the usage message for FreeTTSTime.
-
timeToString
public static java.lang.String timeToString(java.lang.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 java.lang.String timeToString(int hour, int min)
Returns a string that corresponds to the given time.- Parameters:
hour
- the hourmin
- the minutes- Returns:
- the time in string, null if the given time out of range
-
timeToSpeech
public void timeToSpeech(java.lang.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:
java.lang.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(java.lang.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(java.lang.String[] args)
The main entry point for FreeTTSTime.
-
-