DEV Community

Cover image for Day 7: Making Cool Raspberry Pi Projects even Cooler with Voice AI (2/4)
Dilek Karasoy for Picovoice

Posted on

Day 7: Making Cool Raspberry Pi Projects even Cooler with Voice AI (2/4)

Continue to show how to make your cool Raspberry Pi projects even cooler with voice AI.

Building an end-to-end voice recognition:
Interested in building something similar to Alexa which understand commands such as "Alexa, turn on all the lights"? with a Raspberry Pi? You've come to the right place. Picovoice Platform SDK is what you're looking for. It consists [Porcupine Wake Word]https://picovoice.ai/platform/porcupine/) and Rhino Speech-to-Intent Engines.

In this demo we'll use Raspberry Pi Zero - ReSpeaker.

Let's get started!

Requirements

sudo apt-get install libasound2-dev
Enter fullscreen mode Exit fullscreen mode

Access Key
If you don't have one, you can get your AccessKey from the Picovoice Console for free.

Run

gcc -std=c99 -O3 -o demo/respeaker-rpi0/picovoice_demo_mic \
-I sdk/c/include/ demo/respeaker-rpi0/picovoice_demo_mic.c \
-ldl -lasound
Enter fullscreen mode Exit fullscreen mode

Say Picovoice
The demo outputs: [wake word]
Say turn on the lights

You should see the lights turned on and the following message in the terminal:

{
is_understood : 'true',
intent : 'turnLights',
slots : {
'state' : 'on',
}
}

Try changing the color by saying Picovoice, set the lights to orange

The list of commands you can try:
context:
expressions:
turnLights:
- "[switch, turn] $state:state (all) (the) [light, lights]"
- "[switch, turn] (all) (the) [light, lights] $state:state"
changeColor:
- "[change, set, switch] (all) (the) (light, lights) (color) (to) $color:color"
slots:
state:
- "off"
- "on"
color:
- "blue"
- "green"
- "orange"
- "pink"
- "purple"
- "red"
- "white"
- "yellow"

You can check out the GitHub repo to see more open-source demos

Top comments (0)