Giter Club home page Giter Club logo

mmm-sounds's Introduction

MMM-Sounds

This a module for the MagicMirror. It can play WAV sounds through your Pi when triggered by other modules.

This can only play WAV files.

Although this has been developed for the Raspbian operating system, any system that uses alsa would likely work too.

Prerequisites

  1. Read this to configure sound output for your Raspberry Pi
  2. Make sure alsa is installed on your Pi: sudo apt-get install alsa-base alsa-utils
  3. Adjust your volume output, try 100% first with: alsamixer
  4. Optional, test your speaker output: speaker-test -t sine -f 440 -c 2 -s 1

Module Installation

  1. Navigate into your MagicMirror's modules folder and execute git clone https://github.com/jc21/MMM-Sounds.git
  2. Execute cd MMM-Sounds && npm install to install the node dependencies.
  3. Optional, test the alsa player with a wav file: aplay sounds/woop-woop.wav
  4. Add config to your magic mirror config file

Using the module

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

modules: [
	{
		module: 'MMM-Sounds',
		config: {
			startupSound:   'wobble.wav',
			quietTimeStart: '23:00',      // 11pm
			quietTimeEnd:   '07:00'       // 7am
		}
	}
]

Configuration options

The following properties can be configured:

Option Description
startupSound The sound to play after module startup

Possible values: string
Default value: null
defaultDelay The default delay before playing the file in milliseconds

Possible values: integer
Default value: 10
quietTimeStart The 24 hour and minute start of Quiet time

Possible values: string
Default value: null
quietTimeEnd The 24 hour and minute end of Quiet time

Possible values: string
Default value: null
debug Enable to display more debug messages in console

Possible values: bool
Default value: false

Quiet Times

This module supports not playing sounds during a quiet time, if BOTH the quietTimeStart and quietTimeEnd config options are specified.

The values for these times are HH:mm and must be in 24 hour format. Examples:

  • 00:30 - 12:30am
  • 06:30 - 6:30am
  • 14:11 - 2:11pm
  • 23:30 - 11:30pm

Telling the module to play sounds from another module

From another module you can tell this module to play a sound in 2 ways:

In your module:

this.sendNotification('PLAY_SOUND', 'wobble.wav');

or also specifying a delay:

this.sendNotification('PLAY_SOUND', {sound: 'wobble.wav', delay: 1000}); // 1 second delay

Included sounds

  • buzz.wav
  • sonar.wav
  • ta-ting.wav
  • twip.wav
  • wobble.wav
  • woop-woop.wav

Adding sounds

Just put your WAV files in modules/MMM-Sounds/sounds/ and reference those files in your other modules.

Known modules that play sounds

mmm-sounds's People

Contributors

chrisb85 avatar jc21 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mmm-sounds's Issues

Clash with Alexapi

I have installed MMM-Sounds in my Magic Mirror project which is working fine. Recently i also installed AlexaPi. As per the documentation of AlexaPi i have followed all the right steps and did not get any errors. However, ALexaPi does not say hello nor does she accept any voice commands. Is there a possibility that MMM-Sounds is in some way hogging the sound resources? To test this i commented out the Sounds module, and for a brief moment i could notice the AlexaPi microphone icon stir and change into Alexa logo and then back to mic icon. I may be mistaken because i could not replicate the same subsequently.
Any help or pointers?

Screen goes black when MMM-Sounds is in config.js

Hi

My raspberry is able to play sound through the sound jack. I installed MMM-Sounds like all others modules by following instructions. When I put the config lines for MMM-Sounds inside config.js, when I restart Magic Mirror, the screen goes black. No module are showing up. I go back to config.js, comment lines about MMM-Sounds and restart Magic Mirror, the Magic Mirror and modules are fine.
Are you aware of conflict with other module?
Thanks

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.