Package org.openhab.core.voice
Interface KSService
- All Known Subinterfaces:
KSEdgeService
@NonNullByDefault
public interface KSService
This is the interface that a keyword spotting service has to implement.
- Author:
- Kelly Davis - Initial contribution, Kai Kreuzer - Refactored to use AudioStream
-
Method Summary
Modifier and TypeMethodDescriptiongetId()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 KSServiceObtain the Locales available from this KSServicespot(KSListener ksListener, AudioStream audioStream, Locale locale, String keyword) This method starts the process of keyword spotting The audio data of the passedAudioStreamis passed to the keyword spotting engine.
-
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
Obtain the Locales available from this KSService- Returns:
- The Locales available from this service
-
getSupportedFormats
Set<AudioFormat> getSupportedFormats()Obtain the audio formats supported by this KSService- Returns:
- The audio formats supported by this service
-
spot
KSServiceHandle spot(KSListener ksListener, AudioStream audioStream, Locale locale, String keyword) throws KSException This method starts the process of keyword spotting The audio data of the passedAudioStreamis passed to the keyword spotting engine. The keyword spotting attempts to spotkeywordas being spoken in the passedLocale. Spotted keyword is indicated by firedKSEventevents targeting the passedKSListener. The passedAudioStreammust be of a supportedAudioFormat. In other words anAudioFormatcompatible with one returned from thegetSupportedFormats()method. The passedLocalemust be supported. That is to say it must be aLocalereturned from thegetSupportedLocales()method. The passedkeywordis the keyword which should be spotted. The method is supposed to return fast, i.e. it should only start the spotting as a background process.- Parameters:
ksListener- Non-nullKSListenerthatKSEventevents targetaudioStream- TheAudioStreamfrom which keywords are spottedlocale- TheLocalein which the target keywords are spokenkeyword- The keyword which to spot- Returns:
- A
KSServiceHandleused to abort keyword spotting - Throws:
KSException- if any parameter is invalid or a problem occurs
-