create static method

dynamic create(
  1. String accessKey,
  2. String keywordPath,
  3. WakeWordCallback wakeWordCallback,
  4. String contextPath,
  5. InferenceCallback inferenceCallback, {
  6. double porcupineSensitivity = 0.5,
  7. double rhinoSensitivity = 0.5,
  8. String? porcupineModelPath,
  9. String? rhinoModelPath,
  10. double endpointDurationSec = 1.0,
  11. bool requireEndpoint = true,
  12. ProcessErrorCallback? processErrorCallback,
})

Picovoice constructor

accessKey AccessKey obtained from Picovoice Console (https://console.picovoice.ai/).

keywordPath Absolute path to Porcupine's keyword model file.

wakeWordCallback User-defined callback invoked upon detection of the wake phrase. The callback accepts no input arguments.

contextPath Absolute path to file containing context parameters. A context represents the set of expressions(spoken commands), intents, and intent arguments(slots) within a domain of interest.

inferenceCallback User-defined callback invoked upon completion of intent inference. The callback accepts a single input argument of type Map<String, dynamic> that is populated with the following items: (2) isUnderstood: if isFinalized, whether Rhino understood what it heard based on the context (3) intent: if isUnderstood, name of intent that were inferred (4) slots: if isUnderstood, dictionary of slot keys and values that were inferred

porcupineModelPath Absolute path to the file containing Porcupine's model parameters.

porcupineSensitivity Wake word detection sensitivity. It should be a number within 0, 1. A higher sensitivity results in fewer misses at the cost of increasing the false alarm rate.

rhinoModelPath Absolute path to the file containing Rhino's model parameters.

rhinoSensitivity Inference sensitivity. It should be a number within 0, 1. A higher sensitivity value results in fewer misses at the cost of(potentially) increasing the erroneous inference rate.

endpointDurationSec (Optional) Endpoint duration in seconds. An endpoint is a chunk of silence at the end of an utterance that marks the end of spoken command. It should be a positive number within 0.5, 5. A lower endpoint duration reduces delay and improves responsiveness. A higher endpoint duration assures Rhino doesn't return inference pre-emptively in case the user pauses before finishing the request.

requireEndpoint (Optional) If set to true, Rhino requires an endpoint (a chunk of silence) after the spoken command. If set to false, Rhino tries to detect silence, but if it cannot, it still will provide inference regardless. Set to false only if operating in an environment with overlapping speech (e.g. people talking in the background).

processErrorCallback Reports errors that are encountered while the engine is processing audio.

returns an instance of the Picovoice end-to-end platform.

Implementation

static create(
    String accessKey,
    String keywordPath,
    WakeWordCallback wakeWordCallback,
    String contextPath,
    InferenceCallback inferenceCallback,
    {double porcupineSensitivity = 0.5,
    double rhinoSensitivity = 0.5,
    String? porcupineModelPath,
    String? rhinoModelPath,
    double endpointDurationSec = 1.0,
    bool requireEndpoint = true,
    ProcessErrorCallback? processErrorCallback}) {
  return PicovoiceManager._(
      accessKey,
      keywordPath,
      wakeWordCallback,
      contextPath,
      inferenceCallback,
      porcupineSensitivity,
      rhinoSensitivity,
      porcupineModelPath,
      rhinoModelPath,
      endpointDurationSec,
      requireEndpoint,
      processErrorCallback);
}