Porcupine Wake Word
.NET API
API Reference for the .NET Porcupine SDK (NuGet)
namespace: Pv
Porcupine
Class for the Porcupine Wake Word engine.
Porcupine.FromBuiltInKeywords()
Porcupine
constructor when using built-in keywords.
Parameters
accessKey
string : AccessKey obtained from Picovoice Console.keywords
IEnumerable<BuiltInKeyword> : List of built-in keywords for detection.modelPath
string : Absolute path to the file containing model parameters (.pv
).sensitivities
IEnumerable<float> : Sensitivities for detecting keywords. Each value should be a number within [0, 1].
Returns
Porcupine
: An instance of Porcupine Wake Word engine.
Throws
PorcupineException
: If an error occurs while creating an instance of Porcupine Wake Word engine.
Porcupine.FromKeywordPaths()
Porcupine
constructor when using keyword paths.
Parameters
accessKey
string : AccessKey obtained from Picovoice Console.keywordPaths
IEnumerable<string> : List of absolute paths to keyword model files.modelPath
string : Absolute path to the file containing model parameters (.pv
).sensitivities
IEnumerable<float> : Sensitivities for detecting keywords. Each value should be a number within [0, 1].
Returns
Porcupine
: An instance of Porcupine Wake Word engine.
Throws
PorcupineException
: If an error occurs while creating an instance of Porcupine Wake Word engine.
Porcupine.Process()
Processes a frame of the incoming audio stream and emits the detection result. The number of samples per frame can be attained by calling .FrameLength
. The incoming audio needs to have a sample rate equal to .SampleRate
and be 16-bit linearly-encoded. Porcupine operates on single-channel audio.
Parameters
pcm
short[] : A frame of audio samples.
Returns
int
: Index of observed keyword at the end of the current frame. Indexing is 0-based and matches the ordering of keyword models provided to the constructor. If no keyword is detected then it returns -1.
Throws
PorcupineException
: If there is an error while processing the audio frame.
Porcupine.FrameLength
Getter for number of audio samples per frame.
Returns
int
: Number of audio samples per frame.
Porcupine.SampleRate
Getter for audio sample rate accepted by Picovoice.
Returns
int
: Audio sample rate accepted by Picovoice.
Porcupine.Version
Getter for version.
Returns
String
: CurrentPorcupine
version.
BuiltInKeyword
List of available built-in wake words.
PorcupineException
Exception thrown if an error occurs within Porcupine
Wake Word engine.
Exceptions: