Things used in this project

Hardware components:
Echo
Amazon Alexa Amazon Echo
Or any other Alexa enabled device.
×1
Software apps and online services:
Screen%20shot%202015 07 20%20at%206.10.26%20pm
Amazon Web Services AWS Lambda
Dp image kit 02
Amazon Alexa Alexa Skills Kit

Code

Sample Code for Using SpeechconJavaScript
    'AMAZON.YesIntent': function() {
        console.log('Preparing to pitch');

        // gather current state of the game
        var inning      = this.attributes["inning"];
        var atBat       = this.attributes["visitorBatter"];
        var batterName  = visitorLineup[atBat-1].lastName
        var pitcherName = homeLineup[8].lastName;

        var audioOutput = pitcherName + " takes the mound in the top of the " + inning + "th inning. ";
            audioOutput = audioOutput + "<break time=\"1s\"/>";
            audioOutput = audioOutput + "Now batting is " + batterName + ". ";
            audioOutput = audioOutput + "<break time=\"1s\"/>";
            audioOutput = audioOutput + "<say-as interpret-as=\"interjection\">batter up</say-as>";
            audioOutput = audioOutput + "<break time=\"1s\"/>";
            audioOutput = audioOutput + "Select a pitch to throw to the batter. ";

        var repromptOutput = "Try saying Fastball, Curve, Slider, or Change-up.";

        // reset the bases
        this.attributes["balls"]   = 0;
        this.attributes["strikes"] = 0;
        this.attributes["runnerOnFirst"]  = false;
        this.attributes["runnerOnSecond"] = false;
        this.attributes["runnerOnThird"]  = false;

        VoiceInsights.track('firstPitch', null, 'middleFastball', (error, response) => {
            this.emit(':ask', audioOutput, repromptOutput);
        });
    },

Credits

Ae3c1c83656a52dbb51f05ebd67a95c4
Terren Peterson
8 projects • 30 followers
Life-long learner who started off with an Electrical Engineering degree, but have been in software and systems engineering my whole career.
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Add projectSign up / Login