csharpRhino - .NET API

API Reference for the .NET Rhino SDK (NuGet)


namespace: Pv


Rhino

public class Rhino : IDisposable { }

Class for the Rhino Speech-To-Intent engine.


Rhino.Create()

public static Rhino Create(
string accessKey,
string contextPath,
string modelPath = null,
float sensitivity = 0.5f,
bool requireEndpoint = true)

Rhino constructor.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console.
  • contextPath string : Absolute path to file containing context parameters (.rhn).
  • modelPath string : Absolute path to the file containing model parameters (.pv).
  • sensitivity 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

  • Rhino: An instance of Rhino Speech-To-Intent engine.

Throws

  • RhinoException: If an error occurs while creating an instance of the Rhino Speech-To-Intent engine.

Rhino.Process()

public bool 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. Rhino operates on single-channel audio.

Parameters

  • pcm short[] : A frame of audio samples.

Returns

  • bool: Flag indicating whether the engine has finalized intent extraction.

Throws

  • RhinoException: If there is an error while processing the audio frame.

Rhino.GetInference()

public Inference GetInference()

Gets inference result. If the spoken command was understood, it includes the specific intent name that was inferred, and (if applicable) slot keys and specific slot values. Should only be called after the process() function returns true, otherwise Rhino has not yet reached an inference conclusion.

Returns

Throws


Rhino.ContextInfo

public string ContextInfo { get; private set; }

Getter for context information.

Returns

  • string: Returns the context information.

Rhino.FrameLength

public int FrameLength { get; private set; }

Getter for number of audio samples per frame.

Returns

  • int: Number of audio samples per frame.

Rhino.SampleRate

public int SampleRate { get; private set; }

Getter for audio sample rate accepted by Picovoice.

Returns

  • int: Audio sample rate accepted by Picovoice.

Rhino.Version

public string Version { get; private set; }

Getter for version.

Returns

  • string: Current Rhino version.

Inference

public class Inference { }

Class for holding Rhino inference result.


Inference.IsUnderstood

public bool IsUnderstood { get; }

Getter for IsUnderstood.

Returns

  • bool: Whether Rhino understood what it heard based on the context.

Inference.Intent

public string Intent { get; }

Getter for Intent.

Returns

  • string: Name of intent that was inferred.

Inference.Slots

public Dictionary<string, string> Slots { get; }

Getter for Slots.

Returns

  • Dictionary<string, string>: Map of inference slots and values.

RhinoException

public class RhinoException extends Exception { }

Exception thrown if an error occurs within the Rhino engine.

Exceptions:

public class RhinoActivationException extends RhinoException { }
public class RhinoActivationLimitException extends RhinoException { }
public class RhinoActivationRefusedException extends RhinoException { }
public class RhinoActivationThrottledException extends RhinoException { }
public class RhinoIOException extends RhinoException { }
public class RhinoInvalidArgumentException extends RhinoException { }
public class RhinoInvalidStateException extends RhinoException { }
public class RhinoKeyException extends RhinoException { }
public class RhinoMemoryException extends RhinoException { }
public class RhinoRuntimeException extends RhinoException { }
public class RhinoStopIterationException extends RhinoException { }

Issue with this doc? Please let us know.