iosOctopus - iOS API

API Reference for the Octopus iOS SDK (Cocoapod)


Octopus

public class Octopus { }

Class for the Octopus Speech-to-Index engine.


Octopus.pcmDataSampleRate

Octopus.pcmDataSampleRate: Int

Required audio sample rate for PCM data


Octopus.version

Octopus.version: String

Octopus version


Octopus.init()

public init(accessKey: String, modelPath:String? = nil) throws

Constructor for the Octopus class

Parameters

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

Throws


Octopus.delete()

public func delete()

Releases resources acquired by Octopus.


Octopus.indexAudioData()

public func indexAudioData(pcm:[Int16]) throws -> OctopusMetadata

Parameters

  • pcm [Int16] : An array of audio samples. The audio needs to have a sample rate equal to pcmDataSampleRate and be single-channel, 16-bit linearly-encoded.

Returns

Throws

  • OctopusError : If an error occurs while processing the pcm array.

Octopus.indexAudioFile()

public func indexAudioFile(path:String) throws -> OctopusMetadata

Parameters

  • path String : Absolute path to an audio file. Supported formats are: FLAC, MP3, Ogg, Opus, Vorbis, WAV, and WebM.

Returns

Throws

  • OctopusError : If an error occurs while processing the audio file.

Octopus.search()

public func search(metadata: OctopusMetadata, phrases:Set<String>) throws -> Dictionary<String, [OctopusMatch]>

Parameters

Throws

  • OctopusError : If an error occurs while processing the searching the metadata.

OctopusError

public enum OctopusError: Error { }

Error type thrown by the Octopus iOS SDK.

case OctopusOutOfMemoryError(_ message:String)
case OctopusIOError(_ message:String)
case OctopusInvalidArgumentError(_ message:String)
case OctopusStopIterationError(_ message:String)
case OctopusKeyError(_ message:String)
case OctopusInvalidStateError(_ message:String)
case OctopusRuntimeError(_ message:String)
case OctopusActivationError(_ message:String)
case OctopusActivationLimitError(_ message:String)
case OctopusActivationThrottledError(_ message:String)
case OctopusActivationRefusedError(_ message:String)
case OctopusInternalError(_ message:String)

OctopusMatch

public struct OctopusMatch { }

The type representing a matched search result.


OctopusMatch.start

OctopusMatch.start: Float

Start time of match in seconds


OctopusMatch.end

OctopusMatch.end: Float

End time of match in seconds


OctopusMatch.probability

OctopusMatch.probability: Float

Probability of the match being correct (floating-point value between [0, 1]).


OctopusMetadata

public class OctopusMetadata { }

The class representing audio indexed by Octopus. Returned by Octopus.indexAudioData or Octopus.indexAudioFile.


OctopusMetadata.init()

public init(metadataBytes:[UInt8])

Constructor.

Parameters

  • metadataBytes [UInt8] : A byte array that was previously obtained via getBytes.

OctopusMetadata.delete()

public func delete()

Releases resources acquired by OctopusMetadata.


OctopusMetadata.getBytes()

public func getBytes() throws -> [UInt8]

Gets a binary representation of the metadata.

Returns

  • [UInt8] : A byte array of the metadata.

Throws

  • OctopusError : If an error occurs while retrieving the metadata bytes.

Issue with this doc? Please let us know.