tensory/firmataphone — pull request #1 by neilk (2013-01-09 06:09:47+00:00)
Title: Looping notes, rather than "chords"

I added some short note files (.25 second), and then created a lame way for them to loop around.

It just monitors an array for what should be playing, and sets a group of timeouts to play those notes. Then when that's done, it checks again. If there's nothing to do it shuts off the loop.

If a new note is played and nothing is looping, the loop starts immediately. Otherwise you have to wait for the current loop to stop.

It might be better to use web workers and/or events to inject items into a queue of sorts, but this was easier.