Package ai.picovoice.octopus
Class Octopus
- java.lang.Object
-
- ai.picovoice.octopus.Octopus
-
public class Octopus extends java.lang.ObjectAndroid binding for Octopus Speech-to-Index engine. It transforms audio into searchable metadata.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOctopus.BuilderBuilder for creating an instance of Octopus with a mixture of default arguments.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete()Releases resources acquired by Octopus.intgetPcmDataSampleRate()Getter for required audio sample rate for PCM data.java.lang.StringgetVersion()Getter for Octopus version.OctopusMetadataindexAudioData(short[] pcm)Indexes raw PCM data.OctopusMetadataindexAudioFile(java.lang.String path)Reads and indexes a given audio file.java.util.HashMap<java.lang.String,OctopusMatch[]>search(OctopusMetadata metadata, java.util.HashSet<java.lang.String> phrases)Searches metadata for a given set of phrases.static voidsetSdk(java.lang.String sdk)
-
-
-
Method Detail
-
setSdk
public static void setSdk(java.lang.String sdk)
-
delete
public void delete()
Releases resources acquired by Octopus.
-
indexAudioData
public OctopusMetadata indexAudioData(short[] pcm) throws OctopusException
Indexes raw PCM data.- Parameters:
pcm- An array of audio samples. The audio needs to have a sample rate equal togetPcmDataSampleRate()and be single-channel, 16-bit linearly-encoded.- Returns:
- OctopusMetadata object that is used to perform searches.
- Throws:
OctopusException- if there is an error while processing the audio data.
-
indexAudioFile
public OctopusMetadata indexAudioFile(java.lang.String path) throws OctopusException
Reads and indexes a given audio file.- Parameters:
path- Absolute path to an audio file.- Returns:
- OctopusMetadata object that is used to perform searches.
- Throws:
OctopusException- if there is an error while processing the audio data.
-
search
public java.util.HashMap<java.lang.String,OctopusMatch[]> search(OctopusMetadata metadata, java.util.HashSet<java.lang.String> phrases) throws OctopusException
Searches metadata for a given set of phrases.- Parameters:
metadata- An OctopusMetadata object obtained viaindexAudioData(short[])orindexAudioFile(String).phrases- A set of phrases to search for in the metadata.- Returns:
- a map of phrases and match arrays. Matches are represented by immutable OctopusMatch objects.
- Throws:
OctopusException- if there is an error while performing the search query.
-
getPcmDataSampleRate
public int getPcmDataSampleRate()
Getter for required audio sample rate for PCM data.- Returns:
- Required audio sample rate for PCM data.
-
getVersion
public java.lang.String getVersion()
Getter for Octopus version.- Returns:
- Octopus version.
-
-