The next four days we'll show how to make your cool Raspberry Pi projects even cooler with voice AI.
Adding a Wake Word
Even if you do not know what wake word is, you probably know Alexa, Hey Siri or OK Google. They're wake words. Wake words activate dormant software. Wake words engines detect those special words to trigger an action such as listening to voice commands.
Picovoice Porcupine Wake Word Engine allows you to train custom wake words (e.g. Jarvis, Porcupine, insert your RPI project name) for Raspberry Pi. Even better? It can run on Raspberry Pi Zero in real time.
You might be asking why you need a wake word engine when you can do everything with an ASR (automatic speech recognition) engine. It's a bad idea because ASRs
- are highly computational, requiring a large number of resources,
- have known accuracy challenges when it comes to proper nouns and homophones,
- may wait for decoding until the end of the recording.
[If you want to learn more details, here's an article]
In this demo we'll use Raspberry Pi Zero - ReSpeaker
Requirements
sudo apt-get install libasound2-dev
AccessKey
If you don't have one, you can get your AccessKey from the Picovoice Console for free.
Build
gcc -std=c99 -O3 -o demo/respeaker-rpi0/porcupine_demo_mic \
-I include/ demo/respeaker-rpi0/porcupine_demo_mic.c \
-ldl -lasound
Run
Below are the colors associated with supported wake words for this demo:
#ffff33 Alexa
#ff8000 Bumblebee
#ffffff Computer
#ff0000 Hey Google
#800080 Hey Siri
#ff3399 Jarvis
#00ff00 Picovoice
#0000ff Porcupine
#000000 Terminator
From the root of the repository run:
./demo/respeaker-rpi0/porcupine_demo_mic \
${ACCESS_KEY} \
lib/raspberry-pi/arm11/libpv_porcupine.so \
lib/common/porcupine_params.pv \
0.65 \
plughw:CARD=seeed2micvoicec,DEV=0 \
resources/keyword_files/raspberry-pi/alexa_raspberry-pi.ppn \
resources/keyword_files/raspberry-pi/computer_raspberry-pi.ppn \
resources/keyword_files/raspberry-pi/hey\ google_raspberry-pi.ppn \
resources/keyword_files/raspberry-pi/hey\ siri_raspberry-pi.ppn \
resources/keyword_files/raspberry-pi/jarvis_raspberry-pi.ppn \
resources/keyword_files/raspberry-pi/picovoice_raspberry-pi.ppn \
resources/keyword_files/raspberry-pi/porcupine_raspberry-pi.ppn \
resources/keyword_files/raspberry-pi/bumblebee_raspberry-pi.ppn \
resources/keyword_files/raspberry-pi/terminator_raspberry-pi.ppn
Wait for the demo to initialize and print [Listening]
in the terminal.
Say:
Picovoice
The demo outputs: detected 'Picovoice'
The lights are now set to green.
Say:
Alexa
The lights are set to yellow now.
Say:
Terminator
to turn off the lights.
Top comments (0)