Live data from Hacker News

Beeplay.js: Write a song in JavaScript

watilde.github.io

21–22 of 22 posts

Re: Beeplay.js: Write a song in JavaScript

#21

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

Re: Beeplay.js: Write a song in JavaScript

#22
post #21

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.
Post reply on HN