Interface TTSService

All Known Implementing Classes:
AbstractCachedTTSService

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

    • getId

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

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

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

      Set<AudioFormat> getSupportedFormats()
      Obtain the audio formats supported by this TTSService
      Returns:
      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.
      Parameters:
      text - The text to convert to speech
      voice - The voice to use for speech
      requestedFormat - The audio format to return the results in
      Returns:
      AudioStream containing the TTS results
      Throws:
      TTSException - If voice and/or requestedFormat are not supported or another error occurs while creating an AudioStream