

Beeplay.js: Write a song in JavaScript - yror10
http://watilde.github.io/beeplay/

======
ricardobeat
A friend recently created something similar, and he ended up transcribing the
full-length Super Mario theme song! [http://eshiota.github.io/retro-audio-
js/](http://eshiota.github.io/retro-audio-js/)

Presentation here: [http://www.slideshare.net/eshiota/web-audio-band-playing-
wit...](http://www.slideshare.net/eshiota/web-audio-band-playing-with-a-band-
in-your-browser)

~~~
dceddia
Very awesome! Interestingly, in both Chrome and Firefox, the song stops
playing ("mostly") if you switch to a different tab. I say "mostly" because
Chrome seems to play a single note every 10-20 seconds even with the tab
backgrounded.

~~~
nbody
Yeap, both setTimeout and setInterval are being sacrificed for performance.
Alternatively you could use WebWorkers to offload the timers for precision.

------
jastanton
If play returned a reference to the play function you could chain them like

    
    
        .play('D#5', 1/4)('E5', 1/4)
    

Just a thought on cleaning up the syntax a bit.

~~~
nacs
A cleaner way may be to allow the play() method to accept a plain JS array of
notes:

    
    
      var notes = ['D#5', 1/4, 'E5', 1/4];
                 or
      var notes = [['D#5', 1/4], ['E5', 1/4]];
    
      beeplay().play(notes);

~~~
watilde
I plan to do it! A 'toJSON()' method is only for that.

------
thegeomaster
I'd love to specify wave types or even more advanced stuff such as FM
synthesis. With a little work, modules such as this one may enable a whole new
category of innovative/strange browser apps.

~~~
gosub
CoffeeCollider is a coffeescript clone of SuperCollider, it has a lot of
options for subtractive/additive/fm/granular synthesis and algorithmic
sequencing/composition.

[http://mohayonao.github.io/CoffeeCollider/](http://mohayonao.github.io/CoffeeCollider/)

~~~
gecko39
timbre.js (also from this person) is pretty cool too.
[http://mohayonao.github.io/timbre.js/](http://mohayonao.github.io/timbre.js/)

This weekend I used it to make a white noise generator for studying, etc..
[http://www.noisemachine.co](http://www.noisemachine.co)

------
neovive
I remember making these kinds of songs in BASIC. Very fun!

~~~
filipedeschamps
I remember in PASCAL with the sound() function:

    
    
      sound(100);
      delay(3000);
      nosound;

------
sredmond
I would love to see a MIDI interpreter for something like this. MIDI is
already a series of note events (among other weird things like pitchbend and
sustain, so it couldn't be too hard.

------
filipedeschamps
That's very funny. You should do a Mario theme song also :)

------
jeffehobbs
Nifty! I'd love to be able to specify tone (sine wave, square wave, triangle
wave).

------
aaronfc
An online editor to "play" with it would be appreciated! :)

~~~
yror10
[http://jsfiddle.net/S66zA/](http://jsfiddle.net/S66zA/)

------
Sonata
very nice, although the text shadow on the code makes it a bit hard to read

------
djmollusk
now all we need is a javascript powered mod player.

~~~
stagas
You mean like this[0] one?

[0]: [http://tracker.stagas.com/](http://tracker.stagas.com/)

------
userlabs
Look very nice

