raspberry-piPorcupine - Raspberry Pi Quick Start

  • Wake Word Detection
  • Hotword Detection
  • Voice Commands
  • Always Listening
  • Raspberry Pi
  • Python
  • C



  • Python 3


  • C99-compatible compiler
  • CMake 3.4 or higher


  • Raspberry Pi (all variants)


Cloning the Repository

If using SSH, clone the repository with:

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

If using HTTPS, then type

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


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

arecord -L

The output will be similar to below

    Discard all samples (playback) or generate zero samples (capture)
    USB PnP Sound Device, USB Audio
    Default Audio Device
    USB PnP Sound Device, USB Audio
    Direct hardware device without any conversions
    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 {

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

The core of the wake word engine is shipped as a pre-compiled ANSI C library. Hence, it can be used within a C/C++ application directory or in a high-level language such as Python via its bindings.


Install PyAudio:

sudo apt-get install python3-pyaudio

Then install the PIP package:

sudo pip3 install pvporcupinedemo

Run the following in the terminal

pvporcupine_mic --keywords porcupine

The engine starts processing the audio input from the microphone in realtime and outputs to the terminal when it detects utterances of wake-word "porcupine". You can learn about the capabilities of pvporcupine_mic by running pvporcupine_mic --help from the terminal.


Go to the root of the directory:

cd porcupine

List input audio devices with:

./demo/c/build/porcupine_demo_mic --show_audio_devices

Replace ${CPU} in the command below based on the trim of Raspberry Pi (cortex-a72 for Raspberry Pi 4, cortex-a72-aarch64 for Raspberry Pi 4 8GB RAM, cortex-a53 for Raspberry Pi 3, cortex-a53-aarch64 for Raspberry Pi 3 8GB RAM, cortex-a7 for Raspberry Pi 2, and arm11 for the rest), ${AUDIO_DEVICE_INDEX} with the index of the audio device selected based on the previous command and run the demo:

./demo/c/build/porcupine_demo_mic lib/raspberry-pi/${CPU}/libpv_porcupine.so lib/common/porcupine_params.pv \
resources/keyword_files/raspberry-pi/porcupine_raspberry-pi.ppn 0.5 ${AUDIO_DEVICE_INDEX}

The engine starts processing the audio input from the microphone in realtime and outputs to the terminal when it detects utterances of wake-word "porcupine".

Custom Wake Word

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

Issue with this doc? Please let us know.