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 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
    • getSupportedLocales

      Set<Locale> 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 passed AudioStream is passed to the keyword spotting engine. The keyword spotting attempts to spot keyword as being spoken in the passed Locale. Spotted keyword is indicated by fired KSEvent events targeting the passed KSListener. The passed AudioStream must be of a supported AudioFormat. In other words an AudioFormat compatible with one returned from the getSupportedFormats() method. The passed Locale must be supported. That is to say it must be a Locale returned from the getSupportedLocales() method. The passed keyword is 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-null KSListener that KSEvent events target
      audioStream - The AudioStream from which keywords are spotted
      locale - The Locale in which the target keywords are spoken
      keyword - The keyword which to spot
      Returns:
      A KSServiceHandle used to abort keyword spotting
      Throws:
      KSException - if any parameter is invalid or a problem occurs