fromKeywordPaths static method

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

Static creator for initializing PorcupineManager from a list of paths to custom keyword files

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

keywordPaths A List of absolute paths to keyword model files.

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> fromKeywordPaths(String accessKey,
    List<String> keywordPaths, WakeWordCallback wakeWordCallback,
    {String? modelPath,
    List<double>? sensitivities,
    ErrorCallback? errorCallback}) async {
  Porcupine porcupine = await Porcupine.fromKeywordPaths(
      accessKey, keywordPaths,
      modelPath: modelPath, sensitivities: sensitivities);
  return PorcupineManager._(porcupine, wakeWordCallback, errorCallback);
}