Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Beeplay.js: Write a song in JavaScript (watilde.github.io)
70 points by yror10 on June 8, 2014 | hide | past | favorite | 21 comments


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/

Presentation here: http://www.slideshare.net/eshiota/web-audio-band-playing-wit...


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.


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


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.


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);


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


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.


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/


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

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


Flocking might interest you: http://flockingjs.org/


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


I remember in PASCAL with the sound() function:

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


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.


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


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


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



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


now all we need is a javascript powered mod player.


You mean like this[0] one?

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


Look very nice




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: