Giter Club home page Giter Club logo

alexanotificationcurl's Introduction

AlexaNotificationCurl

Some curl scripts to allow interfacing with Alexa using text as input.

Demo

https://youtu.be/WLPApYslQVM

I'm using this along with OpenCV to do face recognition and then let me know who is at the front door: "Simon says, Joe is at the front door."

Initially, I just used my Alexa bluetooth and espeak (very bad sound), but I wanted it to sound like Alexa. So, I wrote this...

Credits

Motivated by Miguel Mota https://miguelmota.com/blog/alexa-voice-service-with-curl

The way this works:

- The text given to alexa.sh is converted into an wav file and sent to the alexa voice service. - The response is then piped to a 'play' command (espeak) to give the response.

Requirements:

You will need - curl - sox (Ubuntu packages: sox libsox-fmt-mp3) - pico2wav (Ubuntu package: libttspico-utils) - espeak (Not used in current version) NOTE: You could change the alexa.sh to use a different speech module, but I've found pico2wav to be pretty good.

How to use:

  1. Follow the instructions from Miguel here: https://miguelmota.com/blog/alexa-voice-service-authentication/ This sets up the service authentication.
  2. Replace the CLIENT_ID in the auth_code.sh file
  3. Run auth_code.sh (./auth_code.sh)
  4. Copy/paste the given URL into a browser and login to your amazon account
  5. Look for the code= in the authresponse in the url of the 'failed' webpage
  6. Replace CLIENT_ID, CLIENT_SECRET, and CODE in the auth_token.sh file
  7. Run the auth_token.sh (./auth_token.sh)

If all goes well, you will then have two files: token.dat and refresh.dat

For the next hour, you will be able to run the alexa.sh command. If an hour passes, you'll need to run the refresh_token.sh, then run alexa.sh NOTE: Be sure to update refresh_token.sh with your CLIENT_ID and CLIENT_SECRET

I setup the refresh_token.sh to run every hour in cron, then I don't worry about it again.

Note: The steps 1-7 above should only be needed once. The refresh_token should be able to keep an active token from that point on.

Sample:

./alexa.sh "Tell me a joke"

Troubleshooting:

Look at the various log files for errors. Also, I 'tee' out the audio sent and audio response.

alexanotificationcurl's People

Contributors

gravesjohnr avatar mfarley281 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.