Picovoice Platform
.NET API
API Reference for the .NET Picovoice SDK (NuGet)
namespace: Pv
Picovoice
Class for Picovoice.
Picovoice.Create()
Picovoice
constructor.
Parameters
accessKey
string : AccessKey obtained from Picovoice Console.keywordPath
string : Absolute path to a Porcupine keyword model file (.ppn
).wakeWordCallback
Action : User-defined callback invoked upon detection of the keyword phrase.contextPath
string : Absolute path to a Rhino context file (.rhn
).inferenceCallback
Action<Inference> : User-defined callback invoked upon completion of intent inference. Has a single argument of type Inference.porcupineModelPath
string : Absolute path to the file containing Porcupine model parameters (.pv
).porcupineSensitivity
float : Keyword sensitivity. It should be a number within [0, 1].rhinoModelPath
string : Absolute path to the file containing Rhino model parameters (.pv
).rhinoSensitivity
float : Inference sensitivity. It should be a number within [0, 1].endpointDurationSec
float : Endpoint duration in seconds. An endpoint is a chunk of silence at the end of an utterance that marks the end of spoken command. It should be a positive number within [0.5, 5]. A lower endpoint duration reduces delay and improves responsiveness. A higher endpoint duration assures Rhino doesn't return inference pre-emptively in case the user pauses before finishing the request.requireEndpoint
bool : If set totrue
, Rhino requires an endpoint (a chunk of silence) after the spoken command. If set tofalse
, Rhino tries to detect silence, but if it cannot, it still will provide inference regardless. Set tofalse
only if operating in an environment with overlapping speech (e.g. people talking in the background).
Returns
Picovoice
: An instance of Picovoice.
Throws
PicovoiceException
: If an error occurs while creating an instance of the Picovoice platform.
Picovoice.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. Picovoice operates on single-channel audio.
Parameters
pcm
short[] : A frame of audio samples.
Throws
PicovoiceException
: If there is an error while processing the audio frame.
Picovoice.Reset()
Resets the internal state of Picovoice. It should be called before processing a new stream of audio or when Picovoice was stopped while processing a stream of audio.
Throws
PicovoiceException
: If there is an error while resetting.
Picovoice.ContextInfo
Getter for Rhino context information.
Returns
string
: Returns the Rhino context information.
Picovoice.FrameLength
Getter for number of audio samples per frame.
Returns
int
: Number of audio samples per frame.
Picovoice.SampleRate
Getter for audio sample rate accepted by Picovoice.
Returns
int
: Audio sample rate accepted by Picovoice.
Picovoice.Version
Getter for version.
Returns
string
: CurrentPicovoice
version.
PicovoiceException
Exception thrown if an error occurs within the Picovoice
platform.
Exceptions: