Package org.openhab.core.voice
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 Summary
Modifier and TypeMethodDescriptionObtain the voices available from this TTSServicegetId()Returns a simple string that uniquely identifies this serviceReturns a localized human readable label that can be used within UIs.Obtain the audio formats supported by this TTSServicesynthesize(String text, Voice voice, AudioFormat requestedFormat) Returns anAudioStreamcontaining the TTS results.
-
Method Details
-
getId
String getId()Returns a simple string that uniquely identifies this service- Returns:
- an id that identifies this service
-
getLabel
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
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
Returns anAudioStreamcontaining the TTS results. Note, one can only request a supportedVoiceandAudioStreamor an exception is thrown.- Parameters:
text- The text to convert to speechvoice- The voice to use for speechrequestedFormat- The audio format to return the results in- Returns:
- AudioStream containing the TTS results
- Throws:
TTSException- Ifvoiceand/orrequestedFormatare not supported or another error occurs while creating anAudioStream
-