Interface KSService

  • @NonNullByDefault
    public interface KSService
    This is the interface that a keyword spotting service has to implement.
    Kelly Davis - Initial contribution, Kai Kreuzer - Refactored to use AudioStream
    • Method Detail

      • getId

        String getId()
        Returns a simple string that uniquely identifies this service
        an id that identifies this service
      • getLabel

        String getLabel​(@Nullable Locale locale)
        Returns a localized human readable label that can be used within UIs.
        locale - the locale to provide the label for
        a localized string to be used in UIs
      • getSupportedLocales

        Set<Locale> getSupportedLocales()
        Obtain the Locales available from this KSService
        The Locales available from this service
      • getSupportedFormats

        Set<AudioFormat> getSupportedFormats()
        Obtain the audio formats supported by this KSService
        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 a 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.
        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
        A KSServiceHandle used to abort keyword spotting
        A - KSException if any parameter is invalid or a problem occurs