fromBuiltInKeywords static method

Future<PorcupineManager> fromBuiltInKeywords(
  1. String accessKey,
  2. List<BuiltInKeyword> keywords,
  3. WakeWordCallback wakeWordCallback, {
  4. String? modelPath,
  5. List<double>? sensitivities,
  6. ErrorCallback? errorCallback,
})

Static creator for initializing PorcupineManager from a selection of built-in keywords

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

keywords is a List of (phrases) for detection. The list of available keywords can be retrieved using BuiltInKeyword

wakeWordCallback A callback that is triggered when one of the given keywords has been detected by Porcupine

modelPath is a path to the file containing model parameters. If not set it will be set to the default location.

sensitivities sensitivities for each keywords model. A higher sensitivity reduces miss rate at the cost of potentially higher false alarm rate. Sensitivity should be a floating-point number within 0 and 1.

errorCallback is an optional callback that triggers if Porcupine experiences a problem while processing audio

Throws a PorcupineException if not successfully initialized.

returns an instance of PorcupineManager

Implementation

static Future<PorcupineManager> fromBuiltInKeywords(String accessKey,
    List<BuiltInKeyword> keywords, WakeWordCallback wakeWordCallback,
    {String? modelPath,
    List<double>? sensitivities,
    ErrorCallback? errorCallback}) async {
  Porcupine porcupine = await Porcupine.fromBuiltInKeywords(
      accessKey, keywords,
      modelPath: modelPath, sensitivities: sensitivities);
  return PorcupineManager._(porcupine, wakeWordCallback, errorCallback);
}