fromKeywordPaths static method

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

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

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

Thows a PvError if not initialized correctly

returns an instance of PorcupineManager

Implementation

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