All Projects → miguelmota → Alexa Voice Service.js

miguelmota / Alexa Voice Service.js

Licence: mit
Library for interacting with Alexa Voice Service (AVS) in the browser.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Alexa Voice Service.js

alexa-ruby
Ruby toolkit for Amazon Alexa service
Stars: ✭ 17 (-86.18%)
Mutual labels:  alexa, amazon, alexa-skills-kit, amazon-alexa
Alexa Skills Kit Sdk For Java
The Alexa Skills Kit SDK for Java helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.
Stars: ✭ 758 (+516.26%)
Mutual labels:  alexa, alexa-skills-kit, amazon-alexa, amazon
cookiecutter-flask-ask
Cookiecutter template for Alexa skills based on the fantastic Flask-Ask framework 🍾🗣❓
Stars: ✭ 51 (-58.54%)
Mutual labels:  alexa, alexa-skills-kit, amazon-alexa
Voicewp
Create Alexa Skills through WordPress
Stars: ✭ 132 (+7.32%)
Mutual labels:  alexa, amazon-alexa, amazon
Chatskills
Run and debug Alexa skills on the command-line. Create bots. Run them in Slack. Run them anywhere!
Stars: ✭ 171 (+39.02%)
Mutual labels:  alexa, amazon-alexa, amazon
ask-console-chrome-extension
⚡️ Chrome Extension for faster testing in the Alexa Skill Simulator
Stars: ✭ 37 (-69.92%)
Mutual labels:  alexa, alexa-skills-kit, amazon-alexa
Alexa Skill Kit
Library for effortless Alexa Skill development with AWS Lambda
Stars: ✭ 278 (+126.02%)
Mutual labels:  alexa, alexa-skills-kit, amazon
Awesome Amazon Alexa
🗣Curated list of awesome resources for the Amazon Alexa platform.
Stars: ✭ 458 (+272.36%)
Mutual labels:  alexa, alexa-skills-kit, amazon-alexa
Cash
HTTP response caching for Koa. Supports Redis, in-memory store, and more!
Stars: ✭ 122 (-0.81%)
Mutual labels:  aws, amazon
Figaro
Real-time voice-changer for voice-chat, etc. Will support many different voice-filters and features in the future. 🎵
Stars: ✭ 80 (-34.96%)
Mutual labels:  microphone, audio
Amazon Alexa Php
Php library for amazon echo (alexa) skill development.
Stars: ✭ 93 (-24.39%)
Mutual labels:  alexa, amazon
Sagemaker Debugger
Amazon SageMaker Debugger provides functionality to save tensors during training of machine learning jobs and analyze those tensors
Stars: ✭ 70 (-43.09%)
Mutual labels:  aws, amazon
Alexa Myqgarage
Use your Echo to control your Chamberlain MyQ Garage door
Stars: ✭ 63 (-48.78%)
Mutual labels:  alexa, alexa-skills-kit
Depressionai
Alexa skill for people suffering with depression.
Stars: ✭ 92 (-25.2%)
Mutual labels:  alexa, alexa-skills-kit
Aws Config To Elasticsearch
Generates an AWS Config Snapshot and ingests it into ElasticSearch for further analysis using Kibana
Stars: ✭ 62 (-49.59%)
Mutual labels:  aws, amazon
S3scanner
Scan for open AWS S3 buckets and dump the contents
Stars: ✭ 1,319 (+972.36%)
Mutual labels:  aws, amazon
Aws Workflows On Github
Workflows for automation of AWS services setup from Github CI/CD
Stars: ✭ 95 (-22.76%)
Mutual labels:  aws, amazon
Complete Placement Preparation
This repository consists of all the material required for cracking the coding rounds and technical interviews during placements.
Stars: ✭ 1,114 (+805.69%)
Mutual labels:  aws, amazon
Jovo Framework
🔈 The Open Source Voice Layer: Build Voice Experiences for Alexa, Google Assistant, Samsung Bixby, Web Apps, and much more
Stars: ✭ 1,320 (+973.17%)
Mutual labels:  alexa, amazon-alexa
Ddns Route53
Dynamic DNS for Amazon Route 53 on a time-based schedule
Stars: ✭ 98 (-20.33%)
Mutual labels:  aws, amazon

alexa-voice-service.js

Library for interacting with Alexa Voice Service (AVS) in the browser.


Things you can do

Things you can do with this library:

  • Login with Amazon and get access token
  • Get access token and refresh token from 'code' response type
  • Get access token from refresh token
  • Request user microphone
  • Record user audio using microphone
  • Send user audio to AVS
  • Parse response from AVS
  • Queue and play MP3 responses from AVS.

The audio recorded in this library is mono channel, sampled at 16k Hz, and signed 16 bit PCM encoding which is required by AVS.

Demo

https://lab.miguelmota.com/alexa-voice-service

Install

npm install alexa-voice-service

Example

Follow these steps to run demo locally:

  1. Git clone this repo
git clone [email protected]:miguelmota/alexa-voice-service.js.git

cd alexa-voice-service.js/example/
  1. Install NPM Modules
npm install
  1. Run HTTPS server
npm start
  1. Go to browser url.
open https://localhost:9745

More info in the example README.

Usage

const AVS = require('alexa-voice-service');

const avs = new AVS(options);

Please check out example as noted above.

Documentation

Most methods return a promise.

AVS(options) - constructor

options:
  debug - {boolean} logs to console
  clientId - {string} AVS client id found in portal
  clientSecret - {string} AVS client secret found in portal. Only needed if using `code` response type.
  deviceId - {string} AVS device Id found in portal
  deviceSerialNumber - {number} serial number for this device (can be made up)
  redirectUri - {string} redirect uri set in portal

avs.login({responseType: 'code, token (default)', newWindow: false}) -> promise(response);
avs.promptUserLogin() -> alias to login();
avs.logout() -> promise();
avs.getTokenFromUrl() -> promise(token);
avs.getCodeFromUrl() -> promise(code);
avs.getTokenFromCode(code) -> promise(response);
avs.getTokenFromRefreshToken(refreshToken) -> promise(token)
avs.refreshToken() -> promise({token, refreshToken})
avs.getToken() -> promise(token)
avs.getRefreshToken() -> promise(refreshToken)
avs.requestMic() -> promise(stream);
avs.connectMediaStream(stream) -> promise;
avs.stopRecording() -> promise;
avs.startRecording() -> promise;
avs.sendAudio(dataView) -> promise(response); - send audio to AVS and get back an object containing response.
The response object is the parsed http message.
avs.audioToBlob(AudioBuffer | DataView) -> promise(blob) - mp3 blob

avs.on(identifier, callback)

identifiers (found under AVS.EventTypes object)
  LOG - when a log occurs.
  ERROR - when an error occurs.
  LOGIN - when user is logged in.
  LOGOUT - when user is logged out.
  RECORD_START - when recording is started.
  RECORD_STOP - when recording is stopped.
  TOKEN_SET - when token is set.
  REFRESH_TOKEN_SET - when refresh token is set.
  TOKEN_INVALID - when token is invalid, usually because it is expired.

example: avs.on(AVS.EventTypes.LOG, callback)

// Player

avs.player.enqueue(dataView|typedArray|arrayBuffer|url) -> promise(arraybuffer) - add an audio source to play queue. Converts input to AudioBuffer.
avs.player.deque() -> promise() - dequeu an audio source to play
avs.player.play() -> promise() - play next source in queue
avs.player.stop() -> promise() - stop playing
avs.player.replay() -> promise() - replay last audio source played
avs.player.pause() -> promise() - pause playing
avs.player.emptyQueue() -> promise() - empty the queue
avs.player.playBlob(blob) -> promise(blob) - play a blob source
avs.player.playAudioBuffer(audioBuffer) -> promise() - play an AudioBuffer source
avs.player.playUrl(url) -> promise(url) - play mp3 url

avs.player.on(identifier, callback)

identifiers (found under AVS.Player.EventTypes object)
  LOG - when a debug log occurs
  ERROR - when an error occurs
  PLAY - when audio source is played
  REPLAY - when audio source is replayed
  PAUSE - when audio source is paused
  STOP - when audio source is stopped playing
  ENQUEUE - when an audio source is added to queue
  DEQUE - when an audio source is removed from queue

Resources

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].