Picovoice WordmarkPicovoice Console
Introduction
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNvidia JetsonLinuxmacOSNodejsPythonRaspberry PiReact NativeRustWebWindows
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
FAQ
Introduction
AndroidCiOSLinuxmacOSPythonWebWindows
AndroidCiOSPythonWeb
SummaryOctopus Speech-to-IndexGoogle Speech-to-TextMozilla DeepSpeech
FAQ
Introduction
AndroidAngularArduinoBeagleBoneCChrome.NETEdgeFirefoxFlutterlink to GoiOSJavaNvidia JetsonLinuxmacOSMicrocontrollerNodejsPythonRaspberry PiReactReact NativeRustSafariUnityVueWebWindows
AndroidAngularC.NETFlutterlink to GoiOSJavaMicrocontrollerNodejsPythonReactReact NativeRustUnityVueWeb
SummaryPorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidAngularBeagleBoneCChrome.NETEdgeFirefoxFlutterlink to GoiOSJavaNvidia JetsonlinuxmacOSNodejsPythonRaspberry PiReactReact NativeRustSafariUnityVueWebWindows
AndroidAngularC.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustUnityVueWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidBeagleboneCiOSNvidia JetsonLinuxmacOSPythonRaspberry PiRustWebWindows
AndroidCiOSPythonRustWeb
SummaryPicovoice CobraWebRTC VAD
FAQ
Introduction
AndroidAngularArduinoBeagleBoneC.NETFlutterlink to GoiOSJavaNvidia JetsonMicrocontrollerNodejsPythonRaspberry PiReactReact NativeRustUnityVueWeb
AndroidAngularCMicrocontroller.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustUnityVueWeb
Picovoice SDK - FAQ
IntroductionSTM32F407G-DISC1 (Arm Cortex-M4)STM32F411E-DISCO (Arm Cortex-M4)STM32F769I-DISCO (Arm Cortex-M7)IMXRT1050-EVKB (Arm Cortex-M7)
FAQGlossary

Leopard Speech-to-Text
Android Quick Start


Platforms

  • Android (5.0+)

Requirements

  • Picovoice Account and AccessKey
  • Android Studio
  • Android device with USB debugging enabled or Android simulator

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:leopard-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" />

Adding a Leopard Model File

Add the Leopard model file to your Android application:

  1. Create a custom model using the Picovoice Console or use the default model.
  2. Add the model as a bundled resource by placing it under the ${ANDROID_APP}/src/main/assets directory of your Android project.

Usage

Create an instance of the engine with the Leopard Builder by passing in your AccessKey, model file and the Android app context:

import ai.picovoice.leopard.*;
final String accessKey = "${ACCESS_KEY}"; // AccessKey provided by Picovoice Console (https://console.picovoice.ai/)
final String modelPath = "${MODEL_PATH}"; // path relative to the assets folder or absolute path to file on device
try {
Leopard leopard = new Leopard.Builder()
.setAccessKey(accessKey)
.setModelPath(modelPath)
.build(appContext);
} catch (LeopardException ex) { }

Transcribe an audio file by providing the absolute path to the file on device:

File audioFile = new File("${AUDIO_FILE_PATH}");
LeopardTranscript transcript = handle.processFile(audioFile.getAbsolutePath());

Transcribe raw audio data (sample rate of 16 kHz, 16-bit linearly encoded and 1 channel):

short[] getAudioData() {
// ...
}
LeopardTranscript transcript = handle.process(getAudioData());

When done, release resources explicitly:

leopard.delete();

Demo

For the Leopard Android SDK, we offer demo applications that demonstrate how to use the Speech-to-Text engine on audio recordings.

Setup

Clone the Leopard repository from GitHub using HTTPS:

git clone --recurse-submodules https://github.com/Picovoice/leopard.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

Package

  • leopard-android on Maven Central

API

  • leopard-android API Docs

GitHub

  • Leopard Android SDK on GitHub
  • Leopard Android demo on GitHub

Benchmark

  • Speech-to-Text Benchmark

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Leopard Speech-to-Text Android Quick Start
  • Platforms
  • Requirements
  • Picovoice Account & AccessKey
  • Quick Start
  • Setup
  • Adding a Leopard Model File
  • Usage
  • Demo
  • Setup
  • Usage
  • Resources
Platform
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Octopus Speech-to-Index
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
Resources
  • Docs
  • Console
  • Blog
  • Demos
Sales
  • Pricing
  • Starter Tier
  • Enterprise
Company
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • Twitter
  • Medium
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2022 Picovoice Inc.