Package org.openhab.core.voice.tts
Interface CachedTTSService
- All Superinterfaces:
TTSService
- All Known Implementing Classes:
AbstractCachedTTSService
TTSService extended with additional methods to support caching TTS results in a TTSCache.- Author:
- Gwendal Roulleau - Initial contribution
-
Method Summary
Modifier and TypeMethodDescriptiongetCacheKey(String text, Voice voice, AudioFormat requestedFormat) Construct a uniquely identifying string for the request.synthesizeForCache(String text, Voice voice, AudioFormat requestedFormat) Returns anAudioStreamcontaining the TTS results.Methods inherited from interface org.openhab.core.voice.tts.TTSService
getAvailableVoices, getId, getLabel, getSupportedFormats, synthesize
-
Method Details
-
getCacheKey
Construct a uniquely identifying string for the request. Could be overridden by the TTS service if it uses some unique external parameter and wants to identify variability in the cache.- Parameters:
text- The text to convert to speechvoice- The voice to use for speechrequestedFormat- The audio format to return the results in- Returns:
- A likely unique key identifying the combination of parameters and/or internal state, as a string suitable to be part of a filename. This will be used in the cache system to store the result.
-
synthesizeForCache
AudioStream synthesizeForCache(String text, Voice voice, AudioFormat requestedFormat) throws TTSException Returns anAudioStreamcontaining the TTS results. Note, one can only request a supportedVoiceandAudioStreamor an exception is thrown. The result will be cached if the TTSCacheService is activated.- 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
-