Class Voice


  • public class Voice
    extends Object
    The static methods of this class are made available as functions in the scripts. This allows a script to use voice features.
    Author:
    Kai Kreuzer - Initial contribution, Christoph Weitkamp - Added parameter to adjust the volume
    • Constructor Detail

      • Voice

        public Voice()
    • Method Detail

      • say

        public static void say​(Object text)
        Says the given text. This method uses the default voice and the default audio sink to play the audio.
        Parameters:
        text - The text to speak
      • say

        public static void say​(Object text,
                               PercentType volume)
        Says the given text with the given volume. This method uses the default voice and the default audio sink to play the audio.
        Parameters:
        text - The text to speak
        volume - The volume to be used
      • say

        public static void say​(Object text,
                               String voice)
        Says the given text with a given voice. This method uses the default audio sink to play the audio.
        Parameters:
        text - The text to speak
        voice - The name of the voice to use or null, if the default voice should be used. If the voiceId is fully qualified (i.e. with a tts prefix), the according TTS service will be used, otherwise the voiceId is assumed to be available on the default TTS service.
      • say

        public static void say​(Object text,
                               String voice,
                               PercentType volume)
        Says the given text with a given voice and the given volume. This method uses the default audio sink to play the audio.
        Parameters:
        text - The text to speak
        voice - The name of the voice to use or null, if the default voice should be used. If the voiceId is fully qualified (i.e. with a tts prefix), the according TTS service will be used, otherwise the voiceId is assumed to be available on the default TTS service.
        volume - The volume to be used
      • say

        public static void say​(Object text,
                               String voice,
                               String sink)
        Says the given text with a given voice through the given sink.
        Parameters:
        text - The text to speak
        voice - The name of the voice to use or null, if the default voice should be used. If the voiceId is fully qualified (i.e. with a tts prefix), the according TTS service will be used, otherwise the voiceId is assumed to be available on the default TTS service.
        sink - The name of audio sink to be used to play the audio or null, if the default sink should be used
      • say

        public static void say​(Object text,
                               String voice,
                               String sink,
                               PercentType volume)
        Says the given text with a given voice and the given volume through the given sink.
        Parameters:
        text - The text to speak
        voice - The name of the voice to use or null, if the default voice should be used. If the voiceId is fully qualified (i.e. with a tts prefix), the according TTS service will be used, otherwise the voiceId is assumed to be available on the default TTS service.
        sink - The name of audio sink to be used to play the audio or null, if the default sink should be used
        volume - The volume to be used
      • interpret

        public static String interpret​(Object text)
        Interprets the given text. This method uses the default Human Language Interpreter and passes the text to it. In case of interpretation error, the error message is played using the default audio sink.
        Parameters:
        text - The text to interpret
      • interpret

        public static String interpret​(Object text,
                                       String interpreter)
        Interprets the given text with a given Human Language Interpreter. In case of interpretation error, the error message is played using the default audio sink.
        Parameters:
        text - The text to interpret
        interpreter - The Human Language Interpreter to be used
      • interpret

        public static String interpret​(Object text,
                                       String interpreter,
                                       String sink)
        Interprets the given text with a given Human Language Interpreter. In case of interpretation error, the error message is played using the given audio sink. If sink parameter is null, the error message is simply not played.
        Parameters:
        text - The text to interpret
        interpreter - The Human Language Interpreter to be used
        sink - The name of audio sink to be used to play the error message