beaglebonePicovoice Platform — BeagleBone Quick Start

  • End-to-End Voice Platform
  • Offline Voice Recognition
  • Local Speech Recognition
  • Speech-to-Intent
  • Domain-Specific NLU
  • Wake Word Detection
  • Beaglebone
  • Linux
  • Python

Requirements

  • Python 3

Compatibility

  • PocketBeagle
  • BeagleBone
  • BeagleBone Black
  • BeagleBoard-xM
  • BeagleBoard

Setup

Cloning the Picovoice Repository

If using SSH, clone the repository with:

git clone --recurse-submodules [email protected]:Picovoice/picovoice.git

If using HTTPS, then type:

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

Microphone

Connect the microphone and get the list of available input audio devices:

arecord -L

The output will be similar to below

null
    Discard all samples (playback) or generate zero samples (capture)
default
mic
sysdefault:CARD=Device
    USB PnP Sound Device, USB Audio
    Default Audio Device
hw:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    Direct hardware device without any conversions
plughw:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    Hardware device with all software conversions

In this case, we pick plughw:CARD=Device,DEV=0. Note that this device comes with software conversions which are handy for resampling. In what follows we note this value as ${INPUT_AUDIO_DEVICE}.

create ~/.asoundrc

pcm.!default {
type asym
capture.pcm "mic"
}
pcm.mic {
type plug
slave {
pcm "${INPUT_AUDIO_DEVICE}"
}
}

If you have a speaker add a section for that to ~/.asoundrc as well.

Check if the microphone works properly by recording audio into a file:

arecord --format=S16_LE --duration=5 --rate=16000 --file-type=wav ~/test.wav

If the command above executes without any errors, then the microphone is functioning as expected. We recommend inspecting the recorded file for recording side effects such as clipping.

Demo Applications

You can use Picovoice using multiple SDKs on BeagleBone. This article covers Python.

Python Demos

Install PyAudio:

sudo apt-get install python3-pyaudio libsndfile1

Then install the package:

sudo pip3 install picovoicedemo

Run the demo from a terminal:

picovoice_demo_mic \
--keyword_path ${PATH_TO_PORCUPINE_KEYWORD_FILE} \
--context_path ${PATH_TO_RHINO_CONTEXT_FILE)}

The demo reads audio from the microphone, processes it in real-time, and outputs to the terminal when a wake word is detected or the user's intent is inferred from a follow-on voice command.

If you do not have custom Porcupine and Rhino models, you can use the pre-trained ones available in the repository. From the root of the cloned repository, run the demo:

picovoice_demo_mic \
--keyword_path resources/porcupine/resources/keyword_files/beaglebone/porcupine_beaglebone.ppn \
--context_path resources/rhino/resources/contexts/beaglebone/smart_lighting_beaglebone.rhn

With a working microphone connected, say:

Porcupine, set the lights in the living room to purple.

Create Custom Wake Words & Contexts

You can create custom Porcupine wake word and Rhino context models using Picovoice Console.


Issue with this doc? Please let us know.