androidOctopus - Android Quick Start

Platforms

  • Android (4.4+)

Requirements

Picovoice Account & AccessKey

Signup or Login to Picovoice Console to get your AccessKey. Make sure to keep your AccessKey secret.

Quick Start

Setup

  1. Install Android Studio.

  2. Include mavenCentral() repository in the top-level build.gradle. Then add the following to the app's build.gradle:

dependencies {
// ...
implementation 'ai.picovoice:octopus-android:${LATEST_VERSION}' // replace with latest version
}
  1. Add the following to the app's AndroidManifest.xml file to enable recording with an Android device's microphone:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

Usage

Use the Octopus Builder to create an instance of Octopus:

import ai.picovoice.octopus.*;
final String accessKey = "..."; // AccessKey provided by Picovoice Console (https://console.picovoice.ai/)
try {
Octopus octopus = new Octopus.Builder().setAccessKey(accessKey).build(appContext);
} catch (OctopusException ex) { }

Index an audio file by passing in the absolute path to the file:

File audioFile = new File("${AUDIO_FILE_PATH}");
OctopusMetadata metadata = octopus.indexAudioFile(audioFile.getAbsolutePath());

Search audio using the generated metadata object:

HashSet<String> searchPhrases = new HashSet<>(Arrays.asList("gorilla", "terminator"));
HashMap <String, OctopusMatch[]> matches = octopus.search(metadata, searchPhrases);

Free resources used by Octopus:

octopus.delete();

Demo

For the Octopus Android SDK, we offer a demo application that demonstrates how to use the Speech-to-Index engine on audio recordings.

Setup

Clone the Octopus repository from GitHub using HTTPS:

git clone --recurse-submodules https://github.com/Picovoice/octopus.git

Usage

  1. Open the Android demo using Android Studio.
  2. Copy your AccessKey from Picovoice Console into the ACCESS_KEY variable in MainActivity.java.
  3. Run the application using a connected Android device or using an Android simulator.

Resources

Packages

API

GitHub

Benchmark


Issue with this doc? Please let us know.