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

Porcupine Wake Word
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:porcupine-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 PorcupineManager Builder to create an instance of PorcupineManager that detects the included built-in wake words porcupine and bumblebee:

import ai.picovoice.porcupine.*;
PorcupineMananger porcupineManager = new PorcupineManager.Builder()
.setAccessKey("${ACCESS_KEY}")
.setKeywords([Porcupine.BuiltInKeyword.PORCUPINE, Porcupine.BuiltInKeyword.BUMBLEBEE])
.build(context, wakeWordCallback);
PorcupineManagerCallback wakeWordcallback = new PorcupineManagerCallback() {
@Override
public void invoke(int keywordIndex) {
if (keywordIndex == 0) {
// porcupine detected
} else if (keywordIndex == 1) {
// bumblebee detected
}
}
}

Start audio capture and wake word detection with:

porcupineManager.start();

Stop with:

porcupineManager.stop();

Free resources used by PorcupineManager:

porcupineManager.delete();
To use your own audio processing engine, check out the Low-Level API on the Picovoice GitHub repository.

Custom Keywords

Create custom keyword using the Picovoice Console. Download the custom wake word file (.ppn) and add it to the ${ANDROID_APP}/src/main/assets directory of your Android project. Create an instance of PorcupineManager using the .setKeywordPaths builder method and the keyword path (relative to the assets directory or absolute path to the file on device):

PorcupineManager porcupineManager = new PorcupineManager.Builder()
.setAccessKey("${ACCESS_KEY}")
.setKeywordPaths(["${KEYWORD_FILE_PATH}"])
.build(context, wakeWordCallback);

Non-English Languages

Use the corresponding model file (.pv), to detect non-English wake words. The model files for all supported languages are available on the Porcupine GitHub repository.

Pass in the model path (relative to the assets directory or absolute path to the file on device) using the setModelPath builder method to change the detection language:

PorcupineManager porcupineManager = new PorcupineManager.Builder()
.setAccessKey("${ACCESS_KEY}")
.setKeywordPaths(["${KEYWORD_FILE_PATH}"])
.setModelPath("${MODEL_FILE_PATH}")
.build(context, wakeWordCallback);

Demo

For the Porcupine Android SDK, we offer demo applications that demonstrate how to use the Wake Word engine on real-time audio streams (i.e. microphone input).

Setup

Clone the Porcupine repository from GitHub using HTTPS:

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

Usage

  1. Open the Android Activity 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.

The demo detects the chosen keyword only when the application is in focus. To run the demo in the background or use in conjunction with Android's Speech-To-Text API, head over to our Github repository.

Resources

Package

  • porcupine-android on Maven Central

API

  • porcupine-android API Docs

GitHub

  • Porcupine Android SDK on GitHub
  • Porcupine Android demos on GitHub

Benchmark

  • Wake Word Benchmark

Further Reading

  • No Way, Google: Build Your Own Wake Word Service on Android

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Porcupine Wake Word Android Quick Start
  • Platforms
  • Requirements
  • Picovoice Account & AccessKey
  • Quick Start
  • Setup
  • Usage
  • Custom Keywords
  • Non-English Languages
  • 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.