iosCobra - iOS API

API Reference for the Cobra iOS SDK (Cocoapods).


Cobra-iOS.Cobra

public class Cobra { }

Class for the Cobra VAD engine.

Cobra can be initialized using the class constructor. Resources should be cleaned when you are done using the delete() method.


Cobra-iOS.Cobra.frameLength

public static let frameLength: UInt32

The number of audio samples per frame that Cobra accepts.


Cobra-iOS.Cobra.sampleRate

public static let sampleRate: UInt32

The audio sample rate the Cobra accepts.


Cobra-iOS.Cobra.version

public static let version: String

The Cobra library version string.


Cobra-iOS.Cobra.init

public init(accessKey: String) throws

init method for Cobra VAD engine.

Parameters

Returns

  • Cobra : An instance of Cobra VAD engine.

Throws


Cobra-iOS.Cobra.delete

public func delete()

Releases resources acquired by Cobra.


Cobra-iOS.Cobra.process

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

Processes a frame of the incoming audio stream and emits the detection result. The required number of samples-per-frame can be obtained by calling .frameLength. The incoming audio needs to have a sample rate equal to .sampleRate and be 16-bit linearly-encoded. Cobra operates on single-channel audio.

Parameters

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

Returns

  • Float32 : Probability of voice activity. It is a floating-point number within [0, 1].

Throws


Cobra-iOS.CobraError

public class CobraError : LocalizedError { }

Error thrown if an error occurs within Cobra VAD engine.

Exceptions

public class CobraMemoryError : CobraError {}
public class CobraIOError : CobraError {}
public class CobraInvalidArgumentError : CobraError {}
public class CobraStopIterationError : CobraError {}
public class CobraKeyError : CobraError {}
public class CobraInvalidStateError : CobraError {}
public class CobraRuntimeError : CobraError {}
public class CobraActivationError : CobraError {}
public class CobraActivationLimitError : CobraError {}
public class CobraActivationThrottledError : CobraError {}
public class CobraActivationRefusedError : CobraError {}

Issue with this doc? Please let us know.