Package org.openhab.core.voice.stt
Interface STTService
@NonNullByDefault
public interface STTService
This is the interface that a speech-to-text service has to implement.
- Author:
- Kelly Davis - Initial contribution
-
Method Summary
Modifier and TypeMethodDescriptiongetId()Returns a simple string that uniquely identifies this service.Returns a localized human-readable label that can be used within UIs.Get the audio formats supported by this STTService.Get the Locales available from this STTService.recognize(STTListener sttListener, AudioStream audioStream, Locale locale) This method starts the process of speech recognition.
-
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
-
getSupportedLocales
Get the Locales available from this STTService.- Returns:
- The Locales available from this service
-
getSupportedFormats
Set<AudioFormat> getSupportedFormats()Get the audio formats supported by this STTService.- Returns:
- The audio formats supported by this service
-
recognize
STTServiceHandle recognize(STTListener sttListener, AudioStream audioStream, Locale locale) throws STTException This method starts the process of speech recognition.The audio data of the passed
AudioStreamis passed to the speech recognition engine. The recognition engine attempts to recognize speech as being spoken in the passedLocaleand containing statements specified in the passedgrammars. Recognition is indicated by firedSTTEventevents targeting the passedSTTListener.The passed
AudioStreammust be of a supportedAudioFormat. In other words anAudioFormatcompatible with one returned from thegetSupportedFormats()method.The passed
Localemust be supported. That is to say it must be aLocalereturned from thegetSupportedLocales()method.- Parameters:
sttListener- TheSTTListenerthatSTTEventevents targetaudioStream- TheAudioStreamfrom which speech is recognizedlocale- TheLocalein which the target speech is spoken- Returns:
- A
STTServiceHandleused to abort recognition - Throws:
STTException- if any parameter is invalid or an STT problem occurs- See Also:
-