Interface TTSService

  • @NonNullByDefault
    public interface TTSService
    This is the interface that a text-to-speech service has to implement.
    Kelly Davis - Initial contribution, Kai Kreuzer - Refactored to use AudioStreams
    • Method Detail

      • getId

        String getId()
        Returns a simple string that uniquely identifies this service
        an id that identifies this service
      • getLabel

        String getLabel​(@Nullable Locale locale)
        Returns a localized human readable label that can be used within UIs.
        locale - the locale to provide the label for
        a localized string to be used in UIs
      • getAvailableVoices

        Set<Voice> getAvailableVoices()
        Obtain the voices available from this TTSService
        The voices available from this service
      • getSupportedFormats

        Set<AudioFormat> getSupportedFormats()
        Obtain the audio formats supported by this TTSService
        The audio formats supported by this service
      • synthesize

        AudioStream synthesize​(String text,
                               Voice voice,
                               AudioFormat requestedFormat)
                        throws TTSException
        Returns an AudioStream containing the TTS results. Note, one can only request a supported Voice and AudioStream or an exception is thrown.
        text - The text to convert to speech
        voice - The voice to use for speech
        requestedFormat - The audio format to return the results in
        AudioStream containing the TTS results
        TTSException - If voice and/or requestedFormat are not supported or another error occurs while creating an AudioStream