Music Trivia was born out of the idea that I needed to learn how to code for Alexa. I was planning on forming an Alexa club with a friend who already knew how to code so we could compete with other colleges. The app is music theory based trivia which chose from my love of clarinet which I've been playing for 8 years.Background
The project is based off a trivia template provided by Amazon that allows the use of up to four Echo Buttons.
There are two ways to enable Music Trivia on your Alexa Device:
- Voice Enable
- App Enable
To enable Music Trivia via voice say "Alexa, enable Music Trivia" and Alexa will download Music Trivia onto your Alexa device
To enable Music Trivia via the app follow these 6 steps:
- 1: Click the icon on the upper left
- 2: Click the Skills & Games button
- 3: Go to the search bar at the top of the page
- 4: Scroll down till you find the Music Trivia app which has a purple and black icon then click on it
- 5: Click the enable button
- 6: Once the button says disable you know you've successfully downloaded Music Trivia
Music trivia was coded using Visual Studio Code as seen below. The app utilizes several.js and.json files to perform it's necessary tasks.
It can be broken down into several sub sections in the diagram below
The pink circle denotes config folder which contains the messages, questions, and settings programs. Messages and questions are similar in their utilization of the Alexa voice. Messages prompts the user to start a game and uses reprompts.
Questions also uses Alexa's voice, but is the question method which uses arrays to denote answer choices Alexa will read and then denotes the correct answer below the array. To keep a count of question index is used with an increasing number that relates to the question number.
Setting on the other hand controls the light animation, screen animation, and sounds Alexa makes during the game. Based on the user input such as an incorrect or correct answer will determine the noise and color produced. It also control the max player number, questions per game, questions per round, and answer similarity. Answer similarity cannot be set a 100% due voice processing error possibilities. Answer choice similarity comes up again in the Alexa Developer Console.
Links to noises and images are activated when the methods are used. Each one is specified based on a correct or incorrect answer. Sounds also include the sounds used by the roll cal method which allows the linking of Echo Buttons to the game by specific players.
Handlers are tools that link methods such as using the microphone, asking Alexa for help, and even continuing roll call. Below is an example of someone saying no to continuing roll call.
Rollcall uses.NoHandler because the user has decided to not continue roll call. If the user had said to continue, the.YesHandler method would have been used instead. It returns a value of false to the the roll call state which then ends roll call. Then it gives Alexa a response message of 'goodbye' which Alexa then says and sets microphone to false and end session to true meaning the microphone turns off and the game session ends.
The start handlers functions the same way as the roll call handler, but is based on whether a user decided to continue a game or not.
The green bubble denotes the util folder which contains
The green bubble denotes the util folder which contains the.js files that control the lights, input, screen display, question and answer method, debug, and the roll call method.
ThePurpleBubble The purple bubble contains version information and links.
The blue bubble contains 3 methods, one for English, one for UK English, and one for German. They contain the acceptable responses a user could say. Since people can answer questions multiple ways, it allows those alternate ways to be correct.
By using the Alexa Developer Console you can build and test you function using Alexa commands and fake echo buttons.
Including a slot type with answers is important, as it gives Alexa the answers it will read and hear, no matter if they're correct or wrong.AWS
Lambda should use itself and the Alexa skills kit. It will ask for a skill ID which can be found in the endpoint tab on the Alexa Developer Console. Once the app is complete, you will need to submit it for certification and it will be reviewed for use by Amazon.