csharpPicovoice Platform — .NET API

API Reference for the .NET Picovoice SDK (NuGet)


namespace: Pv


Picovoice

public class Picovoice : IDisposable { }

Class for Picovoice.


Picovoice.Create()

public static Rhino Create(
string accessKey,
string keywordPath,
Action wakeWordCallback,
string contextPath,
Action<Inference> inferenceCallback,
string porcupineModelPath = null,
float porcupineSensitivity = 0.5f,
string rhinoModelPath = null,
float rhinoSensitivity = 0.5f,
bool requireEndpoint = true)

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].
  • requireEndpoint bool : If set to true, Rhino requires an endpoint (chunk of silence) before finishing inference.

Returns

Throws

  • PicovoiceException: If an error occurs while creating an instance of the Picovoice platform.

Picovoice.Process()

public void Process(short[] pcm)

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


Picovoice.ContextInfo

public string ContextInfo { get; private set; }

Getter for Rhino context information.

Returns

  • string: Returns the Rhino context information.

Picovoice.FrameLength

public int FrameLength { get; private set; }

Getter for number of audio samples per frame.

Returns

  • int: Number of audio samples per frame.

Picovoice.SampleRate

public int SampleRate { get; private set; }

Getter for audio sample rate accepted by Picovoice.

Returns

  • int: Audio sample rate accepted by Picovoice.

Picovoice.Version

public string Version { get; private set; }

Getter for version.

Returns


PicovoiceException

public class PicovoiceException extends Exception { }

Exception thrown if an error occurs within the Picovoice platform.

Exceptions:

public class PicovoiceActivationException extends PicovoiceException { }
public class PicovoiceActivationLimitException extends PicovoiceException { }
public class PicovoiceActivationRefusedException extends PicovoiceException { }
public class PicovoiceActivationThrottledException extends PicovoiceException { }
public class PicovoiceIOException extends PicovoiceException { }
public class PicovoiceInvalidArgumentException extends PicovoiceException { }
public class PicovoiceInvalidStateException extends PicovoiceException { }
public class PicovoiceKeyException extends PicovoiceException { }
public class PicovoiceMemoryException extends PicovoiceException { }
public class PicovoiceRuntimeException extends PicovoiceException { }
public class PicovoiceStopIterationException extends PicovoiceException { }

Issue with this doc? Please let us know.