Skip to main content
Version: 1.0.8

Surpuissant

com.surpuissant.kws.sdk

Surpuissant Object

The Surpuissant SDK provides a set of functions to interact with the speech recognition service. The following are the user-modifiable properties and methods in the Surpuistant SDK.

Properties

  • configuration: Configuration object that holds all the settings for the speech recognition service, such as language, audio source, etc. This is required to initialize the SDK.
  • core: Core object which handles the actual communication with the speech recognition service and provides methods to start/stop recording, detect keywords, follow-up phrases, and execute commands.
  • listeningMode: A MutableStateFlow that holds the current listening mode of the speech recognition service. This can be set by the user to control whether the service should listen for new inputs or not.
  • onKeyWordDetected, onFollowUpPhraseDetected, and onCommandExecuted: Callback functions that are triggered when a keyword, follow-up phrase, or command is detected/executed respectively. These can be set by the user to handle the detection events.

Methods

  • setup(configuration: Configuration): Initializes the SDK with the given configuration object and logs an error message if it's not initialized or different from the provided one.
  • initDependencies(): Initializes dependencies required for communication with the speech recognition service, including creating a Core object.
  • startRecord(onReady: (Status) -> Unit): Starts recording audio for speech recognition. This method is called when the permission to record audio has been granted and requires the configuration to be initialized.
  • stopRecord(): Stops recording audio for speech recognition. This method is called when the user wants to stop listening for new inputs. It also requires the configuration to be initialized.
  • askRecordPermission(activity: ComponentActivity, callback: (Status) -> Unit): Asks for permission to record audio from the user and calls a provided callback with either true or false depending on whether the permission was granted or not. This method is called when the SDK has not been initialized yet.