Octopus Speech-to-Index
iOS API
API Reference for the Octopus iOS SDK (Cocoapod)
Octopus
Class for the Octopus Speech-to-Index engine.
Octopus.pcmDataSampleRate
Required audio sample rate for PCM data
Octopus.version
Octopus version
Octopus.init()
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
OctopusError
: If an error occurs while creating an instance of Octopus.
Octopus.delete()
Releases resources acquired by Octopus
.
Octopus.indexAudioData()
Parameters
pcm
[Int16] : An array of audio samples. The audio needs to have a sample rate equal topcmDataSampleRate
and be single-channel, 16-bit linearly-encoded.
Returns
OctopusMetadata
: OctopusMetadata object that is used to perform searches.
Throws
OctopusError
: If an error occurs while processing the pcm array.
Octopus.indexAudioFile()
Parameters
path
String : Absolute path to an audio file. Supported formats are:FLAC
,MP3
,Ogg
,Opus
,Vorbis
,WAV
, andWebM
.
Returns
OctopusMetadata
: OctopusMetadata object that is used to perform searches.
Throws
OctopusError
: If an error occurs while processing the audio file.
Octopus.search()
Parameters
metadata
OctopusMetadata : AnOctopusMetadata
object obtained viaindexAudioData
orindexAudioFile
.phrases
Set<String> : A set of phrases to search for in the metadata.- Returns
Dictionary<String, [
OctopusMatch]>
: A dictionary of phrases and match arrays. Matches are represented by immutableOctopusMatch
objects.
Throws
OctopusError
: If an error occurs while processing the searching the metadata.
OctopusError
Error type thrown by the Octopus iOS SDK.
OctopusMatch
The type representing a matched search result.
OctopusMatch.startSec
Start time of match in seconds
OctopusMatch.endSec
End time of match in seconds
OctopusMatch.probability
Probability of the match being correct (floating-point value between [0, 1]).
OctopusMetadata
The class representing audio indexed by Octopus
. Returned by Octopus.indexAudioData
or Octopus.indexAudioFile
.
OctopusMetadata.init()
Constructor.
Parameters
metadataBytes
[UInt8] : A byte array that was previously obtained viagetBytes
.
OctopusMetadata.delete()
Releases resources acquired by OctopusMetadata
.
OctopusMetadata.getBytes()
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.