Porcupine Wake Word
Android Quick Start
Platforms
- Android (5.0+, API 21+)
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
Install Android Studio.
Include
mavenCentral()
repository in the top-levelbuild.gradle
. Then add the following to the app'sbuild.gradle
:
- Add the following to the app's
AndroidManifest.xml
file to enable recording with an Android device's microphone:
Usage
Use the PorcupineManager Builder
to create an instance of PorcupineManager
that detects the included built-in wake words porcupine
and bumblebee
:
Start audio capture and wake word detection with:
Stop with:
Free resources used by PorcupineManager
:
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):
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 Wake Word 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:
Demo
For the Porcupine Wake Word 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 Wake Word repository from GitHub using HTTPS:
Usage
- Open the project in Android Studio
- Copy your
AccessKey
into theACCESS_KEY
variable in MainActivity.java. - Go to
Build > Select Build Variant...
and select the language you would like to run the demo in (e.g. enDebug -> English, itRelease -> Italian) - Build and run on an installed simulator or a connected Android device
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, check out the other Android demos on our GitHub repository.