iosLeopard - iOS API

API Reference for the iOS Leopard SDK (Cocoapod)


Leopard

public class Leopard { }

Class for the Leopard Speech-to-Text engine. Resources should be cleaned when you are done using the delete() function.


Leopard.init()

init method for Leopard Speech-to-Text engine with a mixture of arguments.

public init(accessKey: String, modelPath: String) throws -> Leopard

Parameters

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

Throws

  • LeopardError: If an error occurs while creating an instance of Leopard Speech-to-Text engine.
public init(accessKey: String, modelURL: URL) throws -> Leopard

Parameters

  • accessKey String : The AccessKey obtained from Picovoice Console.
  • modelURL URL : URL to file containing model parameters (.pv).

Throws

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

Leopard.delete()

Releases resources acquired by the Leopard engine.

public func delete()

Leopard.process()

Processes given audio data with the Leopard Speech-to-Text engine.

public func process(pcm: [Int16]) throws -> String

Parameters

  • pcm [Int16] : The incoming audio needs to have a sample rate equal to Leopard.sampleRate and be 16-bit linearly-encoded. Furthermore, Leopard operates on single-channel audio.

Returns

  • String : Inferred transcription.

Throws

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

Leopard.processFile()

Processes a given audio file with the Leopard Speech-to-Text engine.

public func processFile(audioPath: String) throws -> String

Parameters

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

Returns

  • String : Inferred transcription.

Throws

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

Leopard.sampleRate

Leopard.sampleRate: UInt32

Audio sample rate accepted by Leopard.


Leopard.version

Leopard.version: String

Current Leopard version.


LeopardError

public class LeopardError : LocalizedError { }

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

public class LeopardMemoryError : LeopardError {}
public class LeopardIOError : LeopardError {}
public class LeopardInvalidArgumentError : LeopardError {}
public class LeopardStopIterationError : LeopardError {}
public class LeopardKeyError : LeopardError {}
public class LeopardInvalidStateError : LeopardError {}
public class LeopardRuntimeError : LeopardError {}
public class LeopardActivationError : LeopardError {}
public class LeopardActivationLimitError : LeopardError {}
public class LeopardActivationThrottledError : LeopardError {}
public class LeopardActivationRefusedError : LeopardError {}


Issue with this doc? Please let us know.