Independent Study – Fall 2020 Alexa Programming

by | Dec 10, 2020 | ATLAS, Indep. Study - Alexa | 0 comments

Fall 2020 Independent Study

Alexa Skill Programming

the concept

Create three Alexa Skills

Alexa, Amazon’s voice assistant or smart speaker, is a simple way to interact with a varied and powerful AI. From playing music and games, to arranging a shopping list, the device has become a standard part of many homes. This exploration combines my interests of coding with the challenges of designing for voice, instead of eyeballs.

Every day, Voice Technology coupled with Internet of Things (IoT) pull us toward a touchless future. Whether it is interaction with an Alexa or contacting a customer support interface with a chatbot, voice and chat technologies offer a growing design challenge. This independent study will explore the design contexts to use voice, use cases for voice, how voice fits into a consumer journey, specific design challenges, VUI/VUX, differences in voice interaction design and visual interaction design, narrative design and storytelling. Along the way, we’ll explore incorporating relevant datasets and determining what datasets make good candidates for voice particularly in a science communication context. The goal will be to create several varying voice applications (Alexa) exploring each of the above topics.

During the semester, I created three entertainment-related skills. The overall goal of all the skills is delight. Finding a skill that is different can be challenging. Creating any game that is delightful is an ultimate goal. Below, you can find a short description of the skill and my motivation for creating it. Each built on the previous in codebase but more importantly, the storytelling attributes increased in each iteration.

In the right-hand column, I will include a link to the finished skill when approved. A button to view the code is available as well. This is the node.js script included in the lambda that drives the immediate discourse. Behind the scenes are a series of Intents with corresponding Invocations.

Along with a strong storytelling aspect, the skills flirted with these topics

  • What is voice
  • Why voice
  • Challenges of voice
  • How does voice fit into consumer journey
  • Use cases for voice
  • Telling better stories with voice
  • Good datasets for voice applications
  • Conversational design/Conversational Interfaces
  • Emotional design – what is the emotional side of voice. What to consider when designing a voice application!
  • What is voice UX
  • Voice UX design tips
  • Voice and chatbot personalities
  • Designing conversations
  • Differences between Voice and Screen-based UX Design
  • VUI / VUX
  • VUX Research
  • Narrative Design
  • Script Writing
  • Amazon Alexa Skills
  • JavaScript & Node.js

Skill 1:
Medieval Insulter

 Based on a similar theme as the French knight taunts in Monty Python and the Holy Grail. You would ask Alexa to insult you and she would return the favor, you spleeny, boil brained codpiece!

This idea seems an odd choice for an Alexa skill but should pass Amazon’s testers. The skill has not been submitted for review and approval yet. The skill is based somewhat on an activity I remember from grade school where three or four groups of words could be combined from separate lists. I reviewed Chaucer, Shakespeare, and Boccacio’s Decameron as well as other medieval texts for phrasing that sounded right. I chose a column that I thought the phrases would work in. Each column is contained in an array, I created another function that handles parsing out a random phrase from the list. These are then reassembled for some interesting phrasing in the InsultIntent and delivered as speech output for Alexa to deliver. This skill may be better using a male voice and perhaps in the english accented version but for now, I’ve left the original voice. If she only knew what she were really saying.

Gameplay Example

Alexa, open Medieval Insulter
Want to learn some wickedly funny medieval insults? Using this skill, you can get insulted or learn some zingers for your friends. Medieval Insulter contains mature content that some may not find suitable. Shall I continue?
yes
I’m glad to hear that, you dankish boil-brained bear-whelp. Would you like another?
bring it on
OH really, you venomed rude-growing hedge-pig. Would you like another?
yes
I bet you can’t handle this one, you crusty base-court imbossed carbunkle. Would you like another?
ok
OH really, you mumbling earth-vexing purified-cur. Would you like another?
no

Skill 2:
Courtly Talk

Self-help books and pamphlets exist from the Romantic and Victorian periods on how to talk to women (some to seduce and others to be poetic). Generally, Shakespeare was a good guide on how to compliment. You would ask the skill to compliment you and Alexa would talk nicely to you.The challenge of this skill was to try and make it all gender neutral and non-sexist. The pamphlets of women seducing men were extremely helpful in overcoming this challenge but the majority of literature is associated with the seduction of women.

The skill is similar in nature to Medieval Insulter. The impetus for this skill was to balance the Medieval Insulter. I felt better about creating one with the other. The skill is setup somewhat similar to the insulter in that three arrays of words are available for a random compliment to be drawn. One differentiator is more phrasing included to be less repetitive between compliments. For the insulter, that repeating seems perfectly normal but I wanted Courtly Talk to be more conversational. And I think the experiment works.

This skill has not been submitted to Amazon Alexa for approval. We’ll even see if it makes it through their censors. I think it should be approved but some of the comments are a bit bawdy which makes it even more fun to share.

Gameplay Example

open courtly talk

Shakespeare, Chaucer, courtiers and courtesans perfected the art of flattery. And now you can fawn over your lover in courtly style. Courtly Talk contains mature content that some may not find suitable. I may even make your lover blush. Shall I continue?

yes

I had imagined this. But I imagined it all wrong. You are far more beautiful in this real moment than you were in my fantasies, my lusty life-rendering whiffler… May I flatter you again?

ok

I had imagined this. But I imagined it all wrong. You are far more beautiful in this real moment than you were in my fantasies, my tenderful sweet-tongued crystal-button… More compliments?

yes

No talking, no arguing, no serious conversations. Just get down to the details, my sugared honey-tongued kicksy-wicksy… May I flatter you again?

yes

When you know, you know, my leavened crow-flowered bit-o-jam… Would you like another?

yes

I think your dress should come off, my virginal heart-piercing crystal-button… More compliments?

yes

No, I don’t want to talk, you candied weeping-ripe flower-of-all-things… More compliments?

no

You are even more beautiful. Bye.

Skill 3:
Camel Escape

Your camel is burning across the desert sands. The idea for Camel originally came from the Heath Users Group and was published in More BASIC Computer Games in 1979 but has never been ported to Alexa. I think it would be a popular game. The idea is to ride your camel across the desert while being chased. You need to manage your thirst, how tired the camel is, while keeping in mind your lead on the outlaws. It’s really hard to win. Because, the original game might have contained some culturally insensitive references and cannibalism, I worked to scrub this language and present a version that some parents might find suitable for their older kids. Certainly younger children can play the game. The camel can die due to lack of attention on the part of the player but at least it’s not eaten as part of a  human/camel soup.

Adding storytelling elements to this game was most enjoyable. I tried to make the interactions humorous and related throughout the game. I hope that as one plays the game long enough that it becomes clear that certain situations, such as a camel hurting its hump and running across a group of dreaded Gobihari scorpions chasing an adventurer whose camel has hurt its hump, are related. I hope some even find it humorous.

The game is not quite done. As you can see from the sample game play below, that the death function is not quite working. But the game is close. I’m in bug finding with it.

In this game of high adventure, your object is to travel 200 miles across the vast Gobihara Desert. You are being chased by a ruthless band of outlaws. You have one liter of water that will last you 5 drinks.
 
To help set the scene, I’ve included many of the illustrative elements. I tried to make them dramatic since this is a speaking game instead of visual. And I have to admit, some of the phrases made me laugh aloud when I created them. Some of the storytelling elements added.
 
 
General scene settings:
  •         “The scorching sun blazes overhead.”,
  •         “Heat mirages rise from the burning desert.”,
  •         “Harsh sunlight, buzzards and a blue sky are all that meet your eyes.”,
  •         “You start your way across the winding dunes in the heat of the day.”,
  •         “Dust devils swirl in the distance as you wipe gritty sweat from your brow.”,
  •         “A dust devil swirls across the sand like a desert python.”,
  •         “Faraway mountains shimmer as the heat of the day sets in.”,
  •         “A hot wind dries your mouth instantly before you set your foot in your camel’s harness.”,
  •         “A hot wind creates tiny dust devils at the feet of your camel before you set off.”,
  •         “The hard, baked earth and miles of dunes meet your eye as you begin.”,
  •         “Dusty, windy dunes engulf your senses as you look across the scorching landscape.”,
  •         “Relentless sun and a barren landscape fill your sight as you set off across the great Gobihara.”,
  •         “Gobihara scorpions the size of a plate skitter across the blazing sands as you set off.”,
  •         “A pair of carrion eaters with black eyes, no doubt hoping for their next meal, follow your every move as you begin your journey.”,
  •         “A hot, dusty wind raises dust devils in the shimmering distance as you set off on your journey.”,
  •         “Crumbling rock, shifting sand and harsh sunshine are all that meet your eyes as you set off.”,
  •         “Sandstone canyons and drifting dunes dominate the dusty landscape of the great Gobihara as you set off.”,
  •         “A brown dusty pall darkens the sky as you set off across the hot baked earth of the Gobihara.”,
  •         “All you wipe from your brow is hot dust as your camel races across the blazing sands.”
 
 
Scene Medium Speed comments
  •         ” Ahead moderate speed then. “,
  •         ” Your camel likes this pace. “,
  •         ” Your camel takes off at a nice trot. “,
  •         ” Your camel is trotting across the desert sands. “
 
Scene Full Speed comments
  •     ” Full speed ahead. “,
  •     ” Your camel is burning across the desert sands. “,
  •     ” Your camel is blazing across the dunes. “,
  •     ” You are blazing across the sand. “,
  •     ” Your camel is galloping across the landscape. “,
  •     ” You are galloping across the desert sands. “
 
Random Events
  • oasis: 75-80
    • Is it a mirage? You find an oasis! A lush patch of palm trees and a pool of cool, clear water meet your eyes! You fill your canteen as your camel munches on some figs. You could take a nap if not for the knowledge that the outlaws are out there, somewhere, hunting you.
  • sandstorm: 81-85
    • The sky becomes dark as a sandstorm engulfs you. You and your camel huddle under a blanket losing precious time. Just know…the outlaws have learned the art of traveling in wild sandstorms.
  • wildfolk: 86-90
    • Suddenly, out of the dunes, you are surrounded by the mythical wildfolk of the Gobihari. Luckily you speaka their language and tell them that outlaws are chasing you. Because of their intense hatred of the outlaws, they promise to delay them with a clever trap. You promise to return one day and open a school for riding sandworms.
  • quicksand: 91-93
    • Your camel pitches forward and throws you into hot quicksand. Luckily, you are able to grab a rope. It holds solid as you pull yourself out. You have no time to consider what the rope is attached to as your camel gives you a sloppy kiss, happy that you are alive. You lose some time as the outlaws draw ever closer.
  • giant Gobihari scorpions: 93-95
    • You and your camel squeal in terror as you crest a dune and see a pack of dreaded, giant Gobihari scorpions. Luckily for you, they are focused on chasing a poor adventurer whose camel hurt its hump.
  • hurt hump: 96-98
    • Your camel has hurt its hump. You hope that a pack of dreaded, giant Gobihari scorpions are not in the area as you limp your camel across the blazing sands.
  • aliens: 99
    • As you crest a high dune, you surprise a gathering of angelic aliens lounging on blankets in the hot sun. They explain that they have traveled a long time from a planet in a galaxy far away. They wonder if you have some water to spare. They take a drink and offer for you to sail away in their starship. The camel chooses to return to the last oasis, munch on splendid figs and ride with the mythical wildfolk of the Gobihari. Your camel gives you a parting kiss as you climb aboard their starship and head for the skies.
  • All others: all clear
 
Death Scenes:
  • “You died in the desert.”,
  • “You dirty rapscallion, you ran your poor camel to death “,
  • “The local chieftain uses your skull as a coin purse. “,
  • “Your body was eaten by vultures. “,
  • “Turkeys should fly, not ride camels. “,
  • “The Global Camel Union is boycotting your funeral. “
 
Caught Scenes:
  • “Game over adventurer! The outlaws caught you. They take back their camel and turn you out into the blazing sands. Without water. Without a camel.”,
  • “The outlaws catch you near a pit lined with razor-sharp, wiggling roots. Then again, maybe they are tentacles. They walk you to the edge. This won’t end well. Game over!”,
  • “It’s game over, adventurer, as the outlaws catch up to you, they take back their favorite camel, throw sand fleas into your wild hair and set you loose into the wide Gobihari.”,
  • “The outlaws corner you in a box canyon. The leader mentions that your head will make a nice, new adventurer coin purse. Game over!”,
  • “The outlaws catch up with you and have time set an elaborate trap as you enter the narrow canyon. You hear what sounds like thunder, then you see the giant, round rock hurtling toward you. You turn to run but trip. There is no escape this time, adventurer.”
  • “The outlaws catch you. They take back their prized camel and start digging a pit. Once complete, they tell you to climb in. With just your head sticking out, the outlaws fill the hole. As the outlaws leave, kicking away a buzzard and a few dreaded Gobihari scorpions, a canteen falls to the ground just feet away. There may be no escape this time, adventurer.

 

 
Gameplay Example

open camel escape

Welcome to Camel Escape! If you need instructions, say Help. Are you ready to play?

help

In this game of high adventure, your object is to travel 200 miles across the vast Gobihara Desert. You have stolen a camel and are being chased by a ruthless band of rebels. They not only want you but also their prized camel. You have one liter of water that will last you six drinks. It may be refilled if you find an oasis. During your journey, expect to encounter sandstorms, wildfolk, and injury. This desert is dangerous. Good luck! Are you ready to play?

yes

Let’s play! Your choices are: Drink from your canteen, ahead moderate speed, ahead full speed, rest or stop for the night, status check or exit. What will you do?

fast

Gobihara scorpions the size of a plate skitter across the blazing sands as you set off. Your camel is galloping across the landscape. Your thirst is 0 – . Your canteen has 5 drinks left. Your camel tiredness 3 Your random encounter: 66 oasis You traveled 20 miles. The natives traveled 9 miles. You are 20 miles ahead of the natives. Natives total: 0 You have traveled 20 miles total.

fast

The scorching sun blazes overhead. Your camel is burning across the desert sands. Your thirst is 1 – . Your canteen has 5 drinks left. Your camel tiredness 6 Your random encounter: 22 clear You traveled 13 miles. The natives traveled 8 miles. You are 33 miles ahead of the natives. Natives total: 0 You have traveled 33 miles total.

medium

You start your way across the winding dunes in the heat of the day. You are galloping across the desert sands. Your thirst is 2 – . Your canteen has 5 drinks left. Your camel tiredness 7 Your random encounter: 51 clear You traveled 19 miles. The natives traveled 8 miles. You are 44 miles ahead of the natives. Natives total: 8 You have traveled 52 miles total.

rest

Gobihara scorpions the size of a plate skitter across the blazing sands as you set off. Your camel is galloping across the landscape. Your thirst is 2 – . Your canteen has 5 drinks left. Your camel tiredness 7 You traveled 0 miles. The natives traveled 8 miles. You are 36 miles ahead of the natives. Natives total: 16 You have traveled 52 miles total.

fast

A hot wind dries your mouth instantly before you set your foot in your camel’s harness. Your camel is blazing across the dunes. Your thirst is 4 – You are thirsty! . Your canteen has 5 drinks left. Your camel tiredness 2 Your random encounter: 97 hump You traveled 10 miles. The natives traveled 12 miles. You are 34 miles ahead of the natives. Natives total: 28 You have traveled 62 miles total.

fast

Faraway mountains shimmer as the heat of the day sets in. Your camel is blazing across the dunes. Your thirst is 5 – You are thirsty! . Your canteen has 5 drinks left. Your camel tiredness 4 Your random encounter: 20 clear You traveled 15 miles. The natives traveled 14 miles. You are 35 miles ahead of the natives. Natives total: 42 You have traveled 77 miles total.

fast

Sandstone canyons and drifting dunes dominate the dusty landscape of the great Gobihara as you set off. You are galloping across the desert sands. Your thirst is 6 – Turkeys should fly, not ride camels. . Your canteen has 5 drinks left. Your camel tiredness 6 Your random encounter: 17 clear You traveled 12 miles. The natives traveled 8 miles. You are 39 miles ahead of the natives. Natives total: 50 You have traveled 89 miles total.

References:

Timeline
9/1/2020 – Created Skill – Dinner Genie
9/1/2020 – Added Intent
9/1/2020 – Added Welcome conversation responses – giving it some welcome variety
      • “Welcome to Dinner Genie. Not sure what restaurant to eat at? I can help with that.”
      • “Welcome to dinner genie. How far do you want to travel to get something to eat.”
      • “Welcome to dinner genie. I can find you a place to eat even if you’re not sure what you want. How far do you want to travel?”
9/1/2020 – Added Help Conversation response.
      • “content”: “This is dinner genie. Not sure what you want to eat? I can help with that.”,
 
 
9/15/2020 – built phrases and generator (javascript) for Medieval Insulter
      • generated phrases by cobbling together insults from medieval texts, old animal names and Monty Python sketches.
      • phrases are three arrays of text that another function called randomPhrase(phrase) will randomly choose a word. This is then assembled phrase1 + ” ” + phrase2 + ” ” + phrase3.
9/16/2020 – built php wrapper to test functionality of javascript (works!!)
9/22/2020 – built local version of Medieval Insulter
9/23/2020 – tutorial on
10/1/2020 – started on Medieval Insulter
10/3/2020 – Discovered that interface with Alexa Skills has changed slightly in the console and the raw node.js code that I had built for my test is not really working in the new setup. Relearn console, Intents etc.
10/6/2020 – Working through tutorials to learn how to create a skill in this new environment
10/7/2020 – Working through more tutorials on state management within Alexa
10/13/2020 – Added Yes/No IntentsHandlers to start off the skill. Encountering issue building test demo skill from scratch. Alexa tells me “she doesn’t know about that”
10/14/2020 – Troubleshooting issue from last night but still no resolution
10/20/2020 – Discovered that the Invocation name was not set. Alexa had no knowledge of my skill to test. Demo skill is now working
10/20/2020 – Read My Chatbot is dead. why yours should probably be too. – https://azumbrunnen.me/blog/my-chatbot-is-dead-%c2%b7-why-yours-should-probably-be-too/?ref=sidebar
 

 
10/21/2020 – Added functions to generate random phrases and it’s now working basically “you jarring crook-pated devil-incarnate”
      • Need to refine the responses, ask user if they want more
 

 
Knightly Talk
10/21/2020 – assembled groups. I tried to trim out all overtly feminine charged adjectives and nouns though overall, it’s still pretty flowery and more skewed toward women it seems than men. Though romantic talk can be flowery especially it seems in the renaissance and victorian periods.
These words are gleaned from several sources including Shakespeare and a handful of pamphlets on the art of seduction.
phrase1 group:
airy,amorous,balmy,bespiced,beteeming,blazoning,bonny,brisky,candied,celestial,chafeless,choicely,courtly,dainty,daisied,damasked,enchanting,engilded,fettled,honeysuckle,jovial,leavened,lusty,mannerly,marbled,meek,nonpareil,orbed,palmy,posied,replenished,sightly,silken,sovereign,sphery,sterling,sturdy,taffeta,tenderful,virginal,virtuous,worthy,lovely,beautiful,dreamy,soulful,blissful,bellibone,adventurous,rare,sweet,fruitful,brave,sugared,flowering,precious,gallant,delicate,celestial,melting,rare,sugared,precious,flowering,gallant,celestial,sweet,artful,heavenly,tuneful,courteous,delicate,silken,brave,complete,pleasing,cheek-rosy,deserving,wholesome
 
phrase2 group
all-hollown,alms-deed,burly-boned,cheek-roses,crow-flowered,choice-drawn,deed-achieving,eagle-sighted,ear-kissing,ear-bussing,even-preached,eye-beaming,face-royal,fairy-gold,fertile-fresh,full-acorned,gallant-springing,heaven-hued,honey-bagged,leaping-time,love-springing,life-rendering,marble-constant,may-morn,nimble-pinioned,nose-herb,parti-coloured,proud-pied,right-drawn,silver-shredding,smoothy-pated,softly-sprighted,sweet-seasoned,tender-smelling,trice-crowned,tiger-footed,top-gallant,truest-mannered,weeping-ripe,well-breathed,well-favoured,young-eyed,bright-and-fair,fair-and-bright,love-vanquisher,perfectly-blossomed,epitome-of-nature,sweet-nectared,sense-captivator,heart-piercing,divinely-virtuous,breath-silencer,rarest-perfect,honey-tongued,well-wishing,fair-faced,best-tempered,tender-hearted,tiger-botted,smooth-faced,thunder-darting,sweet-suggesting,young-eyed,fair-faced,well-wishing,well-graced,best-tempered,sweet-mouthing,young-eyed,well-favoured,sweet-tongued,time-pleasing,tiger-booted,thunder-darting,tender-feeling,tender-hearted,smooth-faced,softly-sprighted,heart-inflaming,five-finger-tied,sympathizing,weeping-ripe,swinge-buckling
 
phrase3 group
aglet-baby,argosy,bawcock,bona-roba,bully,chuck,coach-fellow,crystal-button,cuckoo-bud,dewberry,eglantine,esquire,flax-wench,fondling,gamester,handy-dandy,heartling,homager,juvenal,kicksy-wicksy,kid-fox,lambskin,lodestar,madonna,minstrel,nicety,nymph,pew-fellowed,pittikins,prizer,primrose,rarity,ringlet,shoulder-clapper,sweet-meat,thunder-maker,time-pleaser,turtle-dove,wafer-cake,whiffler,wit-snapper,velvet-guard,bellibone,poplolly,peerless-paramour,beloved,wag,truepenny,fairhead,dear-heart,love-bright,star-shine,flower-of-all-things,sweet-leof,sweet-dear,mine-own-dear-darling,fair-flower,my-bell,fair-one,fairest,fair-creature,jewel,charmer,heart-charm,smilet,toast,cukoo-bud,nose-herb,wafer-cake,pigeon-egg,welsh-cheese,song,true-penny,thing-divine,ornament,toast,curiosity,apple-john,cuckoo-bud,nose-herb,gamester,night-cap,delight,watercake,umpire,sprite,song,wit-cracker,valentine,smilet,true-penny,primrose-path,chucked-all-of-a-heap,bit-o-jam
 
10/27/2020
      • Add reprompts and prompts for another
      • Added raspberry sound instead of goodbye
 

10/28/2020
      • worked on finishing Medieval Insults. I wanted to add a raspberry sound when you quit but I’m having a problem playing the sound from my S3 bucket. Instead, I settled on good bye for now.
      • Game finished
      • Switched to Courtly Talke. This was renamed from Knightly Talk. One it sounds more gender neutral
      • Based on prior research into Shakespeare, Chaucer and other romantic texts (there are actually texts, booklets really, released during the Victorian age and Enlightenment on how to seduce a man or woman. Some things never change) This gave me some good language to assemble. Those are listed above and I worked them into the same framework as Medieval Insults. Though I found myself grumbling at some of the more sexist terms. I removed these, added an intro text randomizer and an exit text randomizer to give Alexa’s responses more variety. This has a bit more customization in that area than the Medival Insulter skill.
 
10/29/2020
      • Finished Courtly Talke. Added the intro
        • ‘Shakespeare, Chaucer, courtiers and courtesans perfected the art of flattery. And now you can fawn over your lover in courtly style. Courtly Talk contains mature content that some may not find suitable. I may even make your lover blush. Shall I continue?’
      • Even my wife smiled at the responses she was hearing.
 
NEED TO DO: Neither skill has been submitted for approval from Amazon.
 
11/4/2020 –
      •  Created Skill in Alexa called Camel Escape (since we cannot have one worked invocations, apparently)
      •  Setup Intents for Yes, No, Help
 

11/5/2020 – coded basic invocations. Basic game working with fast, medium, rest, drink, status and quit

11/12/2020 – coded all storytelling elements for fast and medium speeds

11/13/2020 – coded basic random number generation for camel movement and outlaw movement

11/19/2020 – for camel and outlaw movement…had to create a scheme to store a additive score…challenge

11/20/2020 – continue creating scheme for additive scores

11/24/2020 – additive scores broken

11/25/2020 – additive scores still broken

11/27/2020 – additive score code breakthrough. Apparently you cannot have in node.js two variables with the same name even though they are not in the same scope with each other. Perhaps I’m doing something wrong but creating unique variable names fixed the problem. Pain in the butt.

12/2/2020 – coding thirst, camel health and death scenarios

12/3/2020 – coded encounter elements

12/4/2020 – Coded storytelling elements for random encounter elements

12/5/2020 – bug finding, refactoring, basic polish

12/6/2020 – more polish

Written by

Related Posts