pimatic / pimatic

A home automation server and framework for the raspberry pi running on node.js
http://pimatic.org
GNU General Public License v2.0
597 stars 145 forks source link

Plugin for playing audio with pimatic #204

Open thexperiments opened 10 years ago

thexperiments commented 10 years ago

https://github.com/thexperiments/pimatic-play

sweetpi commented 10 years ago

Nice.

thexperiments commented 10 years ago

Working on macbook right now but not ob pi, will figure it out tomorrow

Am 19.07.2014 um 17:14 schrieb sweetpi notifications@github.com:

Nice.

— Reply to this email directly or view it on GitHub.

sweetpi commented 10 years ago

Some ideas:

  1. It would be cool to have a standard folder with some sound files. So that you can use them directly in actions (If there is a sound file "alarm.wav" then you could simply write play alarm sound
  2. It would be cool to have text to speech. We could integrate node-espeak, so it would be possible to have actions like speak "welcome home".
thexperiments commented 10 years ago

also thought about exactly the same stuff but tts is a standalone plugin but I definitely want to have that too.

The plugin should now work on the pi, can anybody verify?

sweetpi commented 10 years ago

I will test later.

I think a separate plugin for tts would be fine. However the question is how to handle overlapping sound output. It would be nice to have some mechanism to resolve this. For example if you have a song playing and some tts is triggered it should fade out or decrease the volume level of the song and after the tts completed it should restore the volume level of the song. Short sounds like the alarm could be scheduled in row so that these don't overlap.

So in the end we need some framework functions to coordinate the sound output.

thexperiments commented 10 years ago

I would say it is great to have at least some way to output sound :smile: now my doorbell will work again :smiley:

But in general I agree, but for now I'll not touch the framework stuff... got confused by promises and coffeescript again when creating the new plugins....

By the way, just created TTS plugin: https://github.com/thexperiments/pimatic-espeak

sweetpi commented 10 years ago

Works great, fixed some small issues in https://github.com/thexperiments/pimatic-play/pull/1.

thexperiments commented 10 years ago

thanks... these promises and the coffeescript really are not something one can easily get when only working on this topics every now and then

2014-07-20 22:20 GMT+02:00 sweetpi notifications@github.com:

Works great, fixed some small issues in thexperiments/pimatic-play#1 https://github.com/thexperiments/pimatic-play/pull/1.

— Reply to this email directly or view it on GitHub https://github.com/pimatic/pimatic/issues/204#issuecomment-49558298.

sweetpi commented 10 years ago

Yes using promises is a little bit tricky at the beginning, but if you get it, they simplify async control flow and error handling massively.

I'm really not sure if the decision for CoffeeScript was the right one. In my opinion its easier to read and faster to write then plain JavaScript (because of the less syntactic noise) but it makes it very difficult for people with no JS knowledge or people that are used C/Java-style syntax to get started with.

sweetpi commented 10 years ago

@thexperiments Do you release it to the npm registry?

thexperiments commented 10 years ago

either this or we put it to pimatic repository for maintanance

2014-08-28 18:46 GMT+02:00 sweet pi - sweet home notifications@github.com:

@thexperiments https://github.com/thexperiments Do you release it to the npm registry?

— Reply to this email directly or view it on GitHub https://github.com/pimatic/pimatic/issues/204#issuecomment-53753559.

sweetpi commented 10 years ago

Sure if you like I can move it to pimatc/pimatic-play an can manage the npm repository versions.