watilde / beeplay

Write a song in JavaScript
http://watilde.github.io/beeplay
MIT License
1.04k stars 54 forks source link

Update API design #14

Open watilde opened 8 years ago

watilde commented 8 years ago

Sync with this nice proposal https://github.com/rwaldron/johnny-five/issues/372#issuecomment-45456970

beeplay.play({
  song: [
    ["C4", 1 / 4],
    ["D4", 1 / 4],
    ["F4", 1 / 4],
    ["D4", 1 / 4],
    ["A4", 1 / 4],
    [null, 1 / 4],
    ["A4", 1],
    ["G4", 1],
    [null, 1 / 2],
    ["C4", 1 / 4],
    ["D4", 1 / 4],
    ["F4", 1 / 4],
    ["D4", 1 / 4],
    ["G4", 1 / 4],
    [null, 1 / 4],
    ["G4", 1],
    ["F4", 1],
    [null, 1 / 2]
  ],
  tempo: 100
});

beeplay.play({
  song: "C D F D A - A A A A G G G G - - C D F D G - G G G G F F F F - -",
  beats: 1 / 4,
  tempo: 100
});