fromKeywords static method
- List<
String> keywords, - WakeWordCallback wakeWordCallback, {
- String? modelPath,
- List<
double> ? sensitivities, - ErrorCallback? errorCallback,
Static creator for initializing PorcupineManager from a selection of built-in keywords
keywords
is a List of (phrases) for detection. The list of available
keywords can be retrieved using Porcupine.BUILT_IN_KEYWORDS
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
returns an instance of PorcupineManager
Implementation
static Future<PorcupineManager> fromKeywords(
List<String> keywords, WakeWordCallback wakeWordCallback,
{String? modelPath,
List<double>? sensitivities,
ErrorCallback? errorCallback}) async {
Porcupine porcupine = await Porcupine.fromKeywords(keywords,
modelPath: modelPath, sensitivities: sensitivities);
return new PorcupineManager._(porcupine, wakeWordCallback, errorCallback);
}