fromBuiltInKeywords static method
- String accessKey,
- List<
BuiltInKeyword> keywords, - WakeWordCallback wakeWordCallback, {
- String? modelPath,
- List<
double> ? sensitivities, - 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);
}