{"action":"created","comment":{"url":"https://api.github.com/repos/rwaldron/johnny-five/pulls/comments/23793115","id":23793115,"diff_hunk":"@@ -247,12 +247,34 @@ Piezo.prototype.frequency = function(frequency, duration) {\n   return this.tone(tone, duration);\n };\n \n+Piezo.prototype.stringToSong = function(stringSong, beats) {\n+  beats = beats || 1;\n+  var notes = stringSong.match(/\\S+/g);\n+  var song = [];\n+  while (notes.length) {\n+    var note = notes.shift();\n+    if (/^[0-9]+$/.test(note)) {\n+      note = parseInt(note);\n+    }\n+    var lastNote = song[song.length - 1];\n+    if (lastNote && lastNote[0] === note) {\n+      lastNote[1] += beats;\n+    } else {\n+      song.push([note, beats]);\n+    }\n+  }\n+  return song;\n+};\n+\n Piezo.prototype.play = function(tune, callback) {\n   if (typeof tune !== \"object\") {\n     tune = {\n       song: tune\n     };\n   }\n+  if (typeof tune.song === \"string\") {\n+    tune.song = this.stringToSong(tune.song, tune.beats);","path":"lib/piezo.js","position":30,"original_position":30,"commit_id":"10e065e4cad9e30f54b61ec38295f3f283feb668","original_commit_id":"10e065e4cad9e30f54b61ec38295f3f283feb668","user":{"login":"rwaldron","id":27985,"avatar_url":"https://avatars.githubusercontent.com/u/27985?v=3","gravatar_id":"","url":"https://api.github.com/users/rwaldron","html_url":"https://github.com/rwaldron","followers_url":"https://api.github.com/users/rwaldron/followers","following_url":"https://api.github.com/users/rwaldron/following{/other_user}","gists_url":"https://api.github.com/users/rwaldron/gists{/gist_id}","starred_url":"https://api.github.com/users/rwaldron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwaldron/subscriptions","organizations_url":"https://api.github.com/users/rwaldron/orgs","repos_url":"https://api.github.com/users/rwaldron/repos","events_url":"https://api.github.com/users/rwaldron/events{/privacy}","received_events_url":"https://api.github.com/users/rwaldron/received_events","type":"User","site_admin":false},"body":"`this.stringToSong(tune.song, tune.beats);` => `toSong(tune.song, tune.beats);`","created_at":"2015-01-29T19:03:34Z","updated_at":"2015-01-29T19:03:34Z","html_url":"https://github.com/rwaldron/johnny-five/pull/605#discussion_r23793115","pull_request_url":"https://api.github.com/repos/rwaldron/johnny-five/pulls/605","_links":{"self":{"href":"https://api.github.com/repos/rwaldron/johnny-five/pulls/comments/23793115"},"html":{"href":"https://github.com/rwaldron/johnny-five/pull/605#discussion_r23793115"},"pull_request":{"href":"https://api.github.com/repos/rwaldron/johnny-five/pulls/605"}}},"pull_request":{"url":"https://api.github.com/repos/rwaldron/johnny-five/pulls/605","id":28265360,"html_url":"https://github.com/rwaldron/johnny-five/pull/605","diff_url":"https://github.com/rwaldron/johnny-five/pull/605.diff","patch_url":"https://github.com/rwaldron/johnny-five/pull/605.patch","issue_url":"https://api.github.com/repos/rwaldron/johnny-five/issues/605","number":605,"state":"open","locked":false,"title":"made piezo.play accept a string-encoded song","user":{"login":"danyshaanan","id":1116738,"avatar_url":"https://avatars.githubusercontent.com/u/1116738?v=3","gravatar_id":"","url":"https://api.github.com/users/danyshaanan","html_url":"https://github.com/danyshaanan","followers_url":"https://api.github.com/users/danyshaanan/followers","following_url":"https://api.github.com/users/danyshaanan/following{/other_user}","gists_url":"https://api.github.com/users/danyshaanan/gists{/gist_id}","starred_url":"https://api.github.com/users/danyshaanan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danyshaanan/subscriptions","organizations_url":"https://api.github.com/users/danyshaanan/orgs","repos_url":"https://api.github.com/users/danyshaanan/repos","events_url":"https://api.github.com/users/danyshaanan/events{/privacy}","received_events_url":"https://api.github.com/users/danyshaanan/received_events","type":"User","site_admin":false},"body":"@rwaldron, @BrianGenisio\r\n\r\nFollowing https://github.com/julianduque/j5-songs/pull/7\r\n\r\nPlease say if additional modifications are required.\r\n\r\n","created_at":"2015-01-29T09:48:54Z","updated_at":"2015-01-29T19:03:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d83ad68c1b4a7a1427e28396fef89c3f95a6671f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rwaldron/johnny-five/pulls/605/commits","review_comments_url":"https://api.github.com/repos/rwaldron/johnny-five/pulls/605/comments","review_comment_url":"https://api.github.com/repos/rwaldron/johnny-five/pulls/comments/{number}","comments_url":"https://api.github.com/repos/rwaldron/johnny-five/issues/605/comments","statuses_url":"https://api.github.com/repos/rwaldron/johnny-five/statuses/10e065e4cad9e30f54b61ec38295f3f283feb668","head":{"label":"danyshaanan:master","ref":"master","sha":"10e065e4cad9e30f54b61ec38295f3f283feb668","user":{"login":"danyshaanan","id":1116738,"avatar_url":"https://avatars.githubusercontent.com/u/1116738?v=3","gravatar_id":"","url":"https://api.github.com/users/danyshaanan","html_url":"https://github.com/danyshaanan","followers_url":"https://api.github.com/users/danyshaanan/followers","following_url":"https://api.github.com/users/danyshaanan/following{/other_user}","gists_url":"https://api.github.com/users/danyshaanan/gists{/gist_id}","starred_url":"https://api.github.com/users/danyshaanan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danyshaanan/subscriptions","organizations_url":"https://api.github.com/users/danyshaanan/orgs","repos_url":"https://api.github.com/users/danyshaanan/repos","events_url":"https://api.github.com/users/danyshaanan/events{/privacy}","received_events_url":"https://api.github.com/users/danyshaanan/received_events","type":"User","site_admin":false},"repo":{"id":29994023,"name":"johnny-five","full_name":"danyshaanan/johnny-five","owner":{"login":"danyshaanan","id":1116738,"avatar_url":"https://avatars.githubusercontent.com/u/1116738?v=3","gravatar_id":"","url":"https://api.github.com/users/danyshaanan","html_url":"https://github.com/danyshaanan","followers_url":"https://api.github.com/users/danyshaanan/followers","following_url":"https://api.github.com/users/danyshaanan/following{/other_user}","gists_url":"https://api.github.com/users/danyshaanan/gists{/gist_id}","starred_url":"https://api.github.com/users/danyshaanan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danyshaanan/subscriptions","organizations_url":"https://api.github.com/users/danyshaanan/orgs","repos_url":"https://api.github.com/users/danyshaanan/repos","events_url":"https://api.github.com/users/danyshaanan/events{/privacy}","received_events_url":"https://api.github.com/users/danyshaanan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/danyshaanan/johnny-five","description":"JavaScript Robotics and IoT programming framework, developed at Bocoup. Based on Arduino Firmata Protocol","fork":true,"url":"https://api.github.com/repos/danyshaanan/johnny-five","forks_url":"https://api.github.com/repos/danyshaanan/johnny-five/forks","keys_url":"https://api.github.com/repos/danyshaanan/johnny-five/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danyshaanan/johnny-five/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danyshaanan/johnny-five/teams","hooks_url":"https://api.github.com/repos/danyshaanan/johnny-five/hooks","issue_events_url":"https://api.github.com/repos/danyshaanan/johnny-five/issues/events{/number}","events_url":"https://api.github.com/repos/danyshaanan/johnny-five/events","assignees_url":"https://api.github.com/repos/danyshaanan/johnny-five/assignees{/user}","branches_url":"https://api.github.com/repos/danyshaanan/johnny-five/branches{/branch}","tags_url":"https://api.github.com/repos/danyshaanan/johnny-five/tags","blobs_url":"https://api.github.com/repos/danyshaanan/johnny-five/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danyshaanan/johnny-five/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danyshaanan/johnny-five/git/refs{/sha}","trees_url":"https://api.github.com/repos/danyshaanan/johnny-five/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danyshaanan/johnny-five/statuses/{sha}","languages_url":"https://api.github.com/repos/danyshaanan/johnny-five/languages","stargazers_url":"https://api.github.com/repos/danyshaanan/johnny-five/stargazers","contributors_url":"https://api.github.com/repos/danyshaanan/johnny-five/contributors","subscribers_url":"https://api.github.com/repos/danyshaanan/johnny-five/subscribers","subscription_url":"https://api.github.com/repos/danyshaanan/johnny-five/subscription","commits_url":"https://api.github.com/repos/danyshaanan/johnny-five/commits{/sha}","git_commits_url":"https://api.github.com/repos/danyshaanan/johnny-five/git/commits{/sha}","comments_url":"https://api.github.com/repos/danyshaanan/johnny-five/comments{/number}","issue_comment_url":"https://api.github.com/repos/danyshaanan/johnny-five/issues/comments/{number}","contents_url":"https://api.github.com/repos/danyshaanan/johnny-five/contents/{+path}","compare_url":"https://api.github.com/repos/danyshaanan/johnny-five/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danyshaanan/johnny-five/merges","archive_url":"https://api.github.com/repos/danyshaanan/johnny-five/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danyshaanan/johnny-five/downloads","issues_url":"https://api.github.com/repos/danyshaanan/johnny-five/issues{/number}","pulls_url":"https://api.github.com/repos/danyshaanan/johnny-five/pulls{/number}","milestones_url":"https://api.github.com/repos/danyshaanan/johnny-five/milestones{/number}","notifications_url":"https://api.github.com/repos/danyshaanan/johnny-five/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danyshaanan/johnny-five/labels{/name}","releases_url":"https://api.github.com/repos/danyshaanan/johnny-five/releases{/id}","created_at":"2015-01-28T23:39:52Z","updated_at":"2015-01-29T15:39:06Z","pushed_at":"2015-01-29T15:39:06Z","git_url":"git://github.com/danyshaanan/johnny-five.git","ssh_url":"git@github.com:danyshaanan/johnny-five.git","clone_url":"https://github.com/danyshaanan/johnny-five.git","svn_url":"https://github.com/danyshaanan/johnny-five","homepage":"","size":35197,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rwaldron:master","ref":"master","sha":"6aab53b11a70f982965f83f8074f6d8d623c03de","user":{"login":"rwaldron","id":27985,"avatar_url":"https://avatars.githubusercontent.com/u/27985?v=3","gravatar_id":"","url":"https://api.github.com/users/rwaldron","html_url":"https://github.com/rwaldron","followers_url":"https://api.github.com/users/rwaldron/followers","following_url":"https://api.github.com/users/rwaldron/following{/other_user}","gists_url":"https://api.github.com/users/rwaldron/gists{/gist_id}","starred_url":"https://api.github.com/users/rwaldron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwaldron/subscriptions","organizations_url":"https://api.github.com/users/rwaldron/orgs","repos_url":"https://api.github.com/users/rwaldron/repos","events_url":"https://api.github.com/users/rwaldron/events{/privacy}","received_events_url":"https://api.github.com/users/rwaldron/received_events","type":"User","site_admin":false},"repo":{"id":3880513,"name":"johnny-five","full_name":"rwaldron/johnny-five","owner":{"login":"rwaldron","id":27985,"avatar_url":"https://avatars.githubusercontent.com/u/27985?v=3","gravatar_id":"","url":"https://api.github.com/users/rwaldron","html_url":"https://github.com/rwaldron","followers_url":"https://api.github.com/users/rwaldron/followers","following_url":"https://api.github.com/users/rwaldron/following{/other_user}","gists_url":"https://api.github.com/users/rwaldron/gists{/gist_id}","starred_url":"https://api.github.com/users/rwaldron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwaldron/subscriptions","organizations_url":"https://api.github.com/users/rwaldron/orgs","repos_url":"https://api.github.com/users/rwaldron/repos","events_url":"https://api.github.com/users/rwaldron/events{/privacy}","received_events_url":"https://api.github.com/users/rwaldron/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rwaldron/johnny-five","description":"JavaScript Robotics and IoT programming framework, developed at Bocoup. Based on Arduino Firmata Protocol","fork":false,"url":"https://api.github.com/repos/rwaldron/johnny-five","forks_url":"https://api.github.com/repos/rwaldron/johnny-five/forks","keys_url":"https://api.github.com/repos/rwaldron/johnny-five/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rwaldron/johnny-five/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rwaldron/johnny-five/teams","hooks_url":"https://api.github.com/repos/rwaldron/johnny-five/hooks","issue_events_url":"https://api.github.com/repos/rwaldron/johnny-five/issues/events{/number}","events_url":"https://api.github.com/repos/rwaldron/johnny-five/events","assignees_url":"https://api.github.com/repos/rwaldron/johnny-five/assignees{/user}","branches_url":"https://api.github.com/repos/rwaldron/johnny-five/branches{/branch}","tags_url":"https://api.github.com/repos/rwaldron/johnny-five/tags","blobs_url":"https://api.github.com/repos/rwaldron/johnny-five/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rwaldron/johnny-five/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rwaldron/johnny-five/git/refs{/sha}","trees_url":"https://api.github.com/repos/rwaldron/johnny-five/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rwaldron/johnny-five/statuses/{sha}","languages_url":"https://api.github.com/repos/rwaldron/johnny-five/languages","stargazers_url":"https://api.github.com/repos/rwaldron/johnny-five/stargazers","contributors_url":"https://api.github.com/repos/rwaldron/johnny-five/contributors","subscribers_url":"https://api.github.com/repos/rwaldron/johnny-five/subscribers","subscription_url":"https://api.github.com/repos/rwaldron/johnny-five/subscription","commits_url":"https://api.github.com/repos/rwaldron/johnny-five/commits{/sha}","git_commits_url":"https://api.github.com/repos/rwaldron/johnny-five/git/commits{/sha}","comments_url":"https://api.github.com/repos/rwaldron/johnny-five/comments{/number}","issue_comment_url":"https://api.github.com/repos/rwaldron/johnny-five/issues/comments/{number}","contents_url":"https://api.github.com/repos/rwaldron/johnny-five/contents/{+path}","compare_url":"https://api.github.com/repos/rwaldron/johnny-five/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rwaldron/johnny-five/merges","archive_url":"https://api.github.com/repos/rwaldron/johnny-five/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rwaldron/johnny-five/downloads","issues_url":"https://api.github.com/repos/rwaldron/johnny-five/issues{/number}","pulls_url":"https://api.github.com/repos/rwaldron/johnny-five/pulls{/number}","milestones_url":"https://api.github.com/repos/rwaldron/johnny-five/milestones{/number}","notifications_url":"https://api.github.com/repos/rwaldron/johnny-five/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rwaldron/johnny-five/labels{/name}","releases_url":"https://api.github.com/repos/rwaldron/johnny-five/releases{/id}","created_at":"2012-03-30T20:09:52Z","updated_at":"2015-01-29T19:01:56Z","pushed_at":"2015-01-28T21:38:17Z","git_url":"git://github.com/rwaldron/johnny-five.git","ssh_url":"git@github.com:rwaldron/johnny-five.git","clone_url":"https://github.com/rwaldron/johnny-five.git","svn_url":"https://github.com/rwaldron/johnny-five","homepage":"","size":35197,"stargazers_count":3160,"watchers_count":3160,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":392,"mirror_url":null,"open_issues_count":83,"forks":392,"open_issues":83,"watchers":3160,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rwaldron/johnny-five/pulls/605"},"html":{"href":"https://github.com/rwaldron/johnny-five/pull/605"},"issue":{"href":"https://api.github.com/repos/rwaldron/johnny-five/issues/605"},"comments":{"href":"https://api.github.com/repos/rwaldron/johnny-five/issues/605/comments"},"review_comments":{"href":"https://api.github.com/repos/rwaldron/johnny-five/pulls/605/comments"},"review_comment":{"href":"https://api.github.com/repos/rwaldron/johnny-five/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/rwaldron/johnny-five/pulls/605/commits"},"statuses":{"href":"https://api.github.com/repos/rwaldron/johnny-five/statuses/10e065e4cad9e30f54b61ec38295f3f283feb668"}}}}