npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

MMM-alexa

v0.0.4

Published

Alexa module for MagicMirror

Downloads

2

Readme

Module: Alexa

Alexa module allows MagicMirror to connect Amazon Alexa Voice Synthesis(AVS) service without requiring anything else.

TODO: add demo video link

Usage

To use this module, add it to the modules array in the config/config.js file:

modules: [
	{
		module: 'MMM-alexa',
		position: 'top_right', // The status indicator position
		config: {
		    // See 'Configuration options' for more information.
		    avsDeviceId: 'my_device',
		    avsClientId: 'amzn1.application-oa2-client.abcdefgh',
		    avsClientSecret: 'abcdefgh',
		    avsInitialCode: 'ANVabcdefgh',
		    enableRaspberryButton: true
		}
	}
]

Configuration options

The following properties can be configured:

| Argument | Default | Description | |---|---|---| | avcDeviceId | "" | The device id that you've created at Amazon. | | avsClientId | "" | The client id which is generated at Amazon. | | avsClientSecret | "" | The client secret which is generated at Amazon. | | avsInitialCode | "" | The initial code for authentication. | | hideStatusIndicator | false | Hide status indicator on the mirror. | | debug | false | Add alexaStart() and alexaStop() commands to the Javascript console. | | disableVoiceActivityDetection | false | Disable voice activity detection(VAD), it's used to understand when the user stops speaking. | | enableRaspberryButton | false | Enable starting to record with pressing button which is connected to GPIO. |

1. Adding MagicMirror to Amazon AVS Service

You have to be registered to Amazon AVS service, and add MagicMirror as device with using your account in order to use Amazon Alexa service.

After following the steps you should be able to gather all the parameters required to run Alexa on the MagicMirror.

Remember that each initial code can be used only once, then it's being converted to token by the module. So if you run your mirror at your computer for testing, you should gather another code.

TODO: add instructions

https://sakirtemel.github.io/MMM-alexa/

2. Raspberry Pi Button to start recording

Button should be connected to GPIO pin 4. The button is used only to start recording.

Do not forget to enable Raspberry Pi button in config.

3. Installing microphone dependencies

Connect your usb microphone and find the devises with using

aplay -l and arecord -l commands.

Change hw:0,0 and hw:1,0 with the output and input source corresponding.

pcm.!default {
  type asym
   playback.pcm {
     type plug
     slave.pcm "hw:0,0"
   }
   capture.pcm {
     type plug
     slave.pcm "hw:1,0"
   }
}

Then run this command

amixer cset numid=3 1

Events

This module has been designed in a way that it can interact with other modules. You can easily develop your own module and control this module or get notified about events happening.

You can send the commands from your module like:

this.sendNotification('ALEXA_START_RECORDING', {});

The possible commands that you can send to the module:

ALEXA_START_RECORDING : It will start recording, and if VAD is enabled will stop when the speech is end.

ALEXA_STOP_RECORDING : It will stop recording, and send the recorded voice to AVS for getting directives.

The possible events that you can receive at your module:

ALEXA_TOKEN_SET : It means that the module is successfully initialized with configuration and ready to start for recording.

ALEXA_RECORD_START : Right now the record is started.

ALEXA_RECORD_STOP : The record is stopped and the voice is being sent to AVS.

ALEXA_VAD_VOICE_DETECTION_START : There's a voice activity right now.

ALEXA_VAD_VOICE_DETECTION_STOP : Voice activity ended.

Tested on

Development

Feel free to create Pull Requests, or issues as new ideas. Current plan for development is listed below.

  • Improve voice activity detection
  • Add wake up keyword support
  • Add blinking leds on Raspberry Pi
  • Add voice spectrum while talking on the mirror(instead of status indicator)
  • Add tutorials about AVS and provide links for ASK
  • Add error sound on empty response
  • Fix threading issues, it hangs when there are multiple commands sent
  • Add blog post link

Special thanks

https://github.com/miguelmota/alexa-voice-service/ for creating such nice library for Javascript.

https://github.com/MichMich/MagicMirror/ for inspirations and building well designed framework.

Licence

MIT