csharpLeopard Platform — .NET API

API Reference for the .NET Leopard SDK (NuGet)


namespace: Pv


Leopard

public class Leopard : IDisposable { }

Class for the Leopard Speech-to-Text engine.


Leopard.Create()

public static Leopard Create(
string accessKey,
string modelPath)

Leopard constructor.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console.
  • modelPath string : Absolute path to the file containing model parameters (.pv).

Returns

  • Leopard: An instance of Leopard Speech-To-Text engine.

Throws

  • LeopardException: If an error occurs while creating an instance of the Leopard Speech-to-Text engine.

Leopard.Process()

public string Process(short[] pcm)

Processes given audio data and returns its transcription. The incoming audio needs to have a sample rate equal to .SampleRate() and be 16-bit linearly-encoded. Furthermore, Leopard operates on single channel audio. If you wish to process data in a different sample rate or format consider using .ProcessFile().

Parameters

  • pcm short[] : Audio data.

Returns

  • string: Inferred transcription.

Throws


Leopard.ProcessFile()

public string ProcessFile(string audioPath)

Processes a given audio file and returns its transcription.

Parameters

  • audioPath string : Absolute path to the audio file. The file needs to have a sample rate equal to or greater than .SampleRate. The supported formats are: FLAC, MP3, Ogg, Opus,Vorbis, WAV, and WebM.

Returns

  • string: Inferred transcription.

Throws


Leopard.SampleRate

public int SampleRate { get; private set; }

Getter for audio sample rate accepted by Picovoice.

Returns

  • int: Audio sample rate accepted by Picovoice.

Leopard.Version

public string Version { get; private set; }

Getter for version.

Returns

LeopardException

public class LeopardException : Exception

Exception thrown if an error occurs within Leopard Speech-to-Text engine.

Exceptions:

public class LeopardActivationException : LeopardException { }
public class LeopardActivationLimitException : LeopardException { }
public class LeopardActivationRefusedException : LeopardException { }
public class LeopardActivationThrottledException : LeopardException { }
public class LeopardIOException : LeopardException { }
public class LeopardInvalidArgumentException : LeopardException { }
public class LeopardInvalidStateException : LeopardException { }
public class LeopardKeyException : LeopardException { }
public class LeopardMemoryException : LeopardException { }
public class LeopardRuntimeException : LeopardException { }
public class LeopardStopIterationException : LeopardException { }

Issue with this doc? Please let us know.