Talk with Alexa
Congratulations on creating your first prototype with Alexa built-in! If your sample app is still running, you should see ASCII art indicating that Alexa's status is
IDLE, meaning the client is waiting for you to initiate a conversation.
To test your prototype, put your earbuds in, and say "Alexa" into the microphone to trigger the Wake Word Engine. Because you're using an inexpensive USB microphone, you might need to speak closer to your microphone to ensure your voice is heard. When you build a commercial Alexa-enabled product, you can use a high-performance Audio Front End (AFE) to pick up your customer's voice. Check out the dev kits for AVS page to learn more.
When you say Alexa, you should see a bunch of messages scroll in your terminal window. One of those will show the status changing to
Listening, indicating the wake word has been recognized. Then say "Tell me a joke." If Alexa responds with
Speaking, you have a working prototype… and probably, a very bad joke.
If you don't hear anything over your earbuds, check that your audio output is set to "Analog" by right-clicking on the speaker icon in the top-right corner of your Pi's screen. Your audio output might be set to HDMI by default. Also ensure your speaker/earbuds are turned on and plugged into your Raspberry Pi's 3.5mm audio jack.
If Alexa isn't responding or your Sample App appears stuck (or displaying error messages when you try to speak), just type "s" and hit return to stop that interaction. You can also type "q" and hit return to exit from the Sample App, or just close the terminal window to force quit the Sample App.
At any time, to relaunch the sample app you can just type the following into a terminal window:
cd /home/pi/ sudo bash startsample.sh
Talk with Alexa!
- Say "Alexa", then ask "What time is it?"
- Say "Alexa", then ask "What's the volume of a sphere?"
- Say "Alexa", then say "Who is Rich King?"
- Say "Alexa", then say "How did the stock market do today?"
- Say "Alexa", then ask "Where were you born?"
- Say "Alexa", then say "How do you say friend in Russian?"
Try a multi-turn interaction
Say "Alexa", then ask "Set an alarm". When she asks what time, just say a number, like "8". She'll want to know if that's AM or PM.
You probably noticed that despite having a bit of back and forth with Alexa, you only said the wake word once at the start of the conversation. This is called a multi-turn interaction and it's a more natural method of communication because you can continue speaking without starting every phrase with "Alexa."
In your terminal window, you can scroll up until you see the UI state Listening…. Right above that you'll see that the state of the Audio Input Processor (AIP) has changed from
EXPECTING_SPEECH and then
RECOGNIZING - without you speaking the wake word!
Alexa only listens when customers indicate that they want to speak to the cloud. Typically, this means the AIP was triggered by the Wake Word Engine running on the client. In this case, it's been activated via a Directive delivered down to your client from the cloud. When Alexa asks you a question, the AIP activates because it knows the customer wants to provide a response.
You can learn more about multi-turn interactions here.
Other multi-turn interactions to try
- Say "Alexa, Wikipedia." You'll have the option to request information on a number of topics without speaking the wake word before the subject.
- Say "Alexa, let's chat." Initiate a conversation with a chatbot.
- Say "Alexa, play Yes Sire." Play a medieval-themed game using your voice, entirely in multi-turn interactions.
Today, Alexa can speak Japanese, German, and many global dialects of English. To try some of these settings, type c and hit return. Then type 1 to see language options. When you ship your product with Alexa Built-in and your customer wishes to change languages, your device will need to send a
SettingsUpdated event to the cloud. Learn more by clicking here.
There's lots more to learn - let's start by setting our device location!