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
AndroidCiOSPythonWeb
AndroidCiOSPythonWeb
SummaryPicovoice KoalaMozilla RNNoise
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

Picovoice Platform
Arduino Quick Start


Platforms

  • Arduino Nano 33 BLE Sense
  • Arduino Portenta H7 (M7 core)

Requirements

  • Arduino IDE

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 and select desired board from Tools -> Board.
    • Install Arduino Mbed OS Nano Boards for Arduino Nano 33 BLE Sense.
    • Install Arduino Mbed OS Portenta Boards for Arduino Portenta H7 (M7 core).
  2. Select the desired device Serial Port to upload package via Tools -> Port.
  3. Open the Library Manager in the Arduino IDE.
  4. Search for the Picovoice_EN package, and click on the Install button.

Usage

Initialize audio and construct the picovoice object in the setup function:

#include <Picovoice_EN.h>
static const char* ACCESS_KEY = "${ACCESS_KEY}";
static uint8_t memory_buffer[MEMORY_BUFFER_SIZE] __attribute__((aligned(16)));
static const uint8_t *keyword_array = ${KEYWORD_ARRAY};
const float porcupine_sensitivity = 0.5f;
static void wake_word_callback(void) {
// logic to execute upon detection of wake word
}
static const uint8_t *context_array = ${CONTEXT_ARRAY};
const float rhino_sensitivity = 0.75f;
static void inference_callback(pv_inference_t *inference) {
// `inference` exposes three immutable properties:
// (1) `IsUnderstood`
// (2) `Intent`
// (3) `Slots`
// ..
pv_inference_delete(inference);
}
pv_picovoice_t *picovoice = NULL;
void setup() {
pv_status_t status = pv_audio_init_rec();
if (status != PV_STATUS_SUCCESS) {
// error starting audio
while(1);
}
status = pv_picovoice_init(
ACCESS_KEY,
MEMORY_BUFFER_SIZE,
memory_buffer,
sizeof(keyword_array),
keyword_array,
porcupine_sensitivity,
wake_word_callback,
sizeof(context_array),
context_array,
rhino_sensitivity,
1.0,
true,
inference_callback,
&picovoice);
if (status != PV_STATUS_SUCCESS) {
// error handling logic
while(1);
}
}

Get the audio frames and pass them in to pv_picovoice_process in the loop function:

void loop() {
const int16_t *buffer = pv_audio_rec_get_new_buffer();
if (buffer) {
const pv_status_t status = pv_picovoice_process(picovoice, buffer);
if (status != PV_STATUS_SUCCESS) {
// handle error logic
while(1);
}
}
}

Release resources explicitly when done with Picovoice:

pv_picovoice_delete(picovoice);

Create Custom Keywords

  1. Obtain the UUID of the chipset:
    1. Open File -> Examples -> Picovoice_EN -> GetUUID.
    2. Click Upload and check the Serial Monitor for the UUID of the board:
UUID: xx xx xx xx xx xx xx xx
  1. Go to Picovoice Console to create models for Porcupine wake word engine and Rhino Speech-to-Intent engine.
  2. Select Arm Cortex-M as the platform when training the model.
  3. Select appropriate board type and paste in your board UUID.
  4. Train your models.
  5. Download your custom voice model(s).
  6. Decompress the zip file. The model file is either .ppn for Porcupine wake word or .rhn for Rhino Speech-to-Intent. Both zip archives also contain a .h header file containing the C array version of the binary model.
  7. Copy the contents of the arrays inside the .h header files and update the keyword_array and context_array values.
const uint8_t *keyword_array = ${CUSTOM_KEYWORD_ARRAY};
const uint8_t *context_array = ${CUSTOM_CONTEXT_ARRAY};

Non-English Languages

Open the Library Manager in the Arduino IDE and search for Picovoice. Click Install on the language desired and add the header file to the project:

#include <Picovoice_{$LANGUAGE_CODE}>

Demo

For the Picovoice Arduino SDK, we offer demo projects for several evaluation boards to demonstrate how to use the Picovoice SDK on Arduino.

Setup

  1. Open the Library Manager in the Arduino IDE.
  2. Search for the Picovoice_EN package, and click on the Install button.

Usage

  1. Open File -> Examples -> Picovoice_EN -> PicovoiceExcample.
  2. Replace ACCESS_KEY with the AccessKey obtained from picovoice console.
  3. Press Upload and check Serial Monitor for outputs.

Resources

API

  • Microcontroller API doc

GitHub

  • Picovoice SDK for Arduino boards - English language
  • Picovoice SDK for Arduino boards - German language
  • Picovoice SDK for Arduino boards - Spanish language
  • Picovoice SDK for Arduino boards - French language

Further Reading

  • Offline Voice AI on Arduino

Video

  • Offline voice commands on Arduino Nano 33 BLE

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Picovoice Platform Arduino Quick Start
  • Platforms
  • Requirements
  • Picovoice Account & AccessKey
  • Quick Start
  • Setup
  • Usage
  • Create 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.