{"action":"created","comment":{"url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/pulls/comments/244644602","pull_request_review_id":188564690,"id":244644602,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0NDY0NDYwMg==","diff_hunk":"@@ -0,0 +1,109 @@\n+import { Component } from 'react';\n+\n+const DEFAULT_NOTE_LENGTH = 0.5;\n+\n+class NoteScheduler extends Component {\n+\n+  scheduleNote(note) {\n+    this.currentTime = this.props.audioContext.currentTime;\n+\n+    if (note.params === undefined || note.params.fundamental === undefined) {\n+      this.params = {\n+        fundamental: 440\n+      };\n+    } else {\n+      this.params = note.params;\n+    }\n+\n+    this.params = note.params;\n+\n+    let destination = this.props.audioContext.destination;\n+\n+    note.graph.forEach((node) => this.connectNode(node, destination));\n+  }\n+\n+  connectNode(node, destination) {\n+    switch (node.type) {\n+      case \"gain\":\n+        let gainNode = this.connectGainNode(node.properties, destination);\n+        this.connectSources(node.connections, gainNode);\n+        break;\n+\n+      case \"oscillator\":\n+        let oscillatorNode = this.connectOscillatorNode(node.properties, destination);\n+        this.connectSources(node.connections, oscillatorNode);\n+        break;\n+\n+      default:\n+        console.log(\"Node type not found\");\n+    }\n+  }\n+\n+  connectGainNode(properties, destination) {\n+    if (properties.value !== undefined) {\n+      let constantGainNode = this.props.audioContext.createGain();\n+      constantGainNode.gain.setValueAtTime(properties.value, this.currentTime);\n+      constantGainNode.connect(destination);\n+      return constantGainNode;\n+    }\n+    else if (properties.values !== undefined) {\n+      var envelopeGainNode = this.props.audioContext.createGain()\n+      envelopeGainNode.gain.setValueAtTime(0.00001, this.currentTime)\n+      properties.values.forEach((value) => this.setEnvelopeValue(envelopeGainNode, value))\n+      envelopeGainNode.gain.exponentialRampToValueAtTime(0.00001, this.currentTime + DEFAULT_NOTE_LENGTH)\n+      envelopeGainNode.connect(destination)\n+      return envelopeGainNode\n+    }\n+  }\n+\n+  setEnvelopeValue(envelopeGainNode, value) {\n+    if (value.type === undefined)\n+      return\n+    let calculatedTime = value.timeFrom === \"start\" ? this.currentTime + value.time : this.currentTime + DEFAULT_NOTE_LENGTH - value.time\n+    switch (value.type) {\n+      case \"linear\":\n+        envelopeGainNode.gain.linearRampToValueAtTime(value.value, calculatedTime)","path":"src/components/NoteScheduler/NoteScheduler.js","position":65,"original_position":65,"commit_id":"1648c8270ec9fd5b2bdeb33100e27b0124be51a1","original_commit_id":"1648c8270ec9fd5b2bdeb33100e27b0124be51a1","user":{"login":"AdamZink","id":22451030,"node_id":"MDQ6VXNlcjIyNDUxMDMw","avatar_url":"https://avatars3.githubusercontent.com/u/22451030?v=4","gravatar_id":"","url":"https://api.github.com/users/AdamZink","html_url":"https://github.com/AdamZink","followers_url":"https://api.github.com/users/AdamZink/followers","following_url":"https://api.github.com/users/AdamZink/following{/other_user}","gists_url":"https://api.github.com/users/AdamZink/gists{/gist_id}","starred_url":"https://api.github.com/users/AdamZink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AdamZink/subscriptions","organizations_url":"https://api.github.com/users/AdamZink/orgs","repos_url":"https://api.github.com/users/AdamZink/repos","events_url":"https://api.github.com/users/AdamZink/events{/privacy}","received_events_url":"https://api.github.com/users/AdamZink/received_events","type":"User","site_admin":false},"body":"Add semicolons in this method too","created_at":"2019-01-01T18:30:35Z","updated_at":"2019-01-01T18:32:39Z","html_url":"https://github.com/AdamZink/react-web-audio-demo/pull/2#discussion_r244644602","pull_request_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/pulls/2","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/AdamZink/react-web-audio-demo/pulls/comments/244644602"},"html":{"href":"https://github.com/AdamZink/react-web-audio-demo/pull/2#discussion_r244644602"},"pull_request":{"href":"https://api.github.com/repos/AdamZink/react-web-audio-demo/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/pulls/2","id":241454911,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQxNDU0OTEx","html_url":"https://github.com/AdamZink/react-web-audio-demo/pull/2","diff_url":"https://github.com/AdamZink/react-web-audio-demo/pull/2.diff","patch_url":"https://github.com/AdamZink/react-web-audio-demo/pull/2.patch","issue_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/issues/2","number":2,"state":"open","locked":false,"title":"Play sine tone with Web Audio API","user":{"login":"AdamZink","id":22451030,"node_id":"MDQ6VXNlcjIyNDUxMDMw","avatar_url":"https://avatars3.githubusercontent.com/u/22451030?v=4","gravatar_id":"","url":"https://api.github.com/users/AdamZink","html_url":"https://github.com/AdamZink","followers_url":"https://api.github.com/users/AdamZink/followers","following_url":"https://api.github.com/users/AdamZink/following{/other_user}","gists_url":"https://api.github.com/users/AdamZink/gists{/gist_id}","starred_url":"https://api.github.com/users/AdamZink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AdamZink/subscriptions","organizations_url":"https://api.github.com/users/AdamZink/orgs","repos_url":"https://api.github.com/users/AdamZink/repos","events_url":"https://api.github.com/users/AdamZink/events{/privacy}","received_events_url":"https://api.github.com/users/AdamZink/received_events","type":"User","site_admin":false},"body":"Add JSON defining a tone, then parse that JSON and schedule Web Audio API events to produce the sound","created_at":"2018-12-29T16:46:51Z","updated_at":"2019-01-01T18:32:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f599f733e30be34a83759e36f14a2116c0f43ae4","assignee":{"login":"AdamZink","id":22451030,"node_id":"MDQ6VXNlcjIyNDUxMDMw","avatar_url":"https://avatars3.githubusercontent.com/u/22451030?v=4","gravatar_id":"","url":"https://api.github.com/users/AdamZink","html_url":"https://github.com/AdamZink","followers_url":"https://api.github.com/users/AdamZink/followers","following_url":"https://api.github.com/users/AdamZink/following{/other_user}","gists_url":"https://api.github.com/users/AdamZink/gists{/gist_id}","starred_url":"https://api.github.com/users/AdamZink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AdamZink/subscriptions","organizations_url":"https://api.github.com/users/AdamZink/orgs","repos_url":"https://api.github.com/users/AdamZink/repos","events_url":"https://api.github.com/users/AdamZink/events{/privacy}","received_events_url":"https://api.github.com/users/AdamZink/received_events","type":"User","site_admin":false},"assignees":[{"login":"AdamZink","id":22451030,"node_id":"MDQ6VXNlcjIyNDUxMDMw","avatar_url":"https://avatars3.githubusercontent.com/u/22451030?v=4","gravatar_id":"","url":"https://api.github.com/users/AdamZink","html_url":"https://github.com/AdamZink","followers_url":"https://api.github.com/users/AdamZink/followers","following_url":"https://api.github.com/users/AdamZink/following{/other_user}","gists_url":"https://api.github.com/users/AdamZink/gists{/gist_id}","starred_url":"https://api.github.com/users/AdamZink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AdamZink/subscriptions","organizations_url":"https://api.github.com/users/AdamZink/orgs","repos_url":"https://api.github.com/users/AdamZink/repos","events_url":"https://api.github.com/users/AdamZink/events{/privacy}","received_events_url":"https://api.github.com/users/AdamZink/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/pulls/2/commits","review_comments_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/pulls/2/comments","review_comment_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/issues/2/comments","statuses_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/statuses/1648c8270ec9fd5b2bdeb33100e27b0124be51a1","head":{"label":"AdamZink:add-web-audio","ref":"add-web-audio","sha":"1648c8270ec9fd5b2bdeb33100e27b0124be51a1","user":{"login":"AdamZink","id":22451030,"node_id":"MDQ6VXNlcjIyNDUxMDMw","avatar_url":"https://avatars3.githubusercontent.com/u/22451030?v=4","gravatar_id":"","url":"https://api.github.com/users/AdamZink","html_url":"https://github.com/AdamZink","followers_url":"https://api.github.com/users/AdamZink/followers","following_url":"https://api.github.com/users/AdamZink/following{/other_user}","gists_url":"https://api.github.com/users/AdamZink/gists{/gist_id}","starred_url":"https://api.github.com/users/AdamZink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AdamZink/subscriptions","organizations_url":"https://api.github.com/users/AdamZink/orgs","repos_url":"https://api.github.com/users/AdamZink/repos","events_url":"https://api.github.com/users/AdamZink/events{/privacy}","received_events_url":"https://api.github.com/users/AdamZink/received_events","type":"User","site_admin":false},"repo":{"id":162229121,"node_id":"MDEwOlJlcG9zaXRvcnkxNjIyMjkxMjE=","name":"react-web-audio-demo","full_name":"AdamZink/react-web-audio-demo","private":false,"owner":{"login":"AdamZink","id":22451030,"node_id":"MDQ6VXNlcjIyNDUxMDMw","avatar_url":"https://avatars3.githubusercontent.com/u/22451030?v=4","gravatar_id":"","url":"https://api.github.com/users/AdamZink","html_url":"https://github.com/AdamZink","followers_url":"https://api.github.com/users/AdamZink/followers","following_url":"https://api.github.com/users/AdamZink/following{/other_user}","gists_url":"https://api.github.com/users/AdamZink/gists{/gist_id}","starred_url":"https://api.github.com/users/AdamZink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AdamZink/subscriptions","organizations_url":"https://api.github.com/users/AdamZink/orgs","repos_url":"https://api.github.com/users/AdamZink/repos","events_url":"https://api.github.com/users/AdamZink/events{/privacy}","received_events_url":"https://api.github.com/users/AdamZink/received_events","type":"User","site_admin":false},"html_url":"https://github.com/AdamZink/react-web-audio-demo","description":"Sample React application for synthesizing tones with Web Audio API","fork":false,"url":"https://api.github.com/repos/AdamZink/react-web-audio-demo","forks_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/forks","keys_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/teams","hooks_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/hooks","issue_events_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/issues/events{/number}","events_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/events","assignees_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/assignees{/user}","branches_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/branches{/branch}","tags_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/tags","blobs_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/git/refs{/sha}","trees_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/statuses/{sha}","languages_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/languages","stargazers_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/stargazers","contributors_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/contributors","subscribers_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/subscribers","subscription_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/subscription","commits_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/commits{/sha}","git_commits_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/git/commits{/sha}","comments_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/comments{/number}","issue_comment_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/issues/comments{/number}","contents_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/contents/{+path}","compare_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/merges","archive_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/downloads","issues_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/issues{/number}","pulls_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/pulls{/number}","milestones_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/milestones{/number}","notifications_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/labels{/name}","releases_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/releases{/id}","deployments_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/deployments","created_at":"2018-12-18T04:15:58Z","updated_at":"2018-12-19T23:54:10Z","pushed_at":"2018-12-29T16:46:52Z","git_url":"git://github.com/AdamZink/react-web-audio-demo.git","ssh_url":"git@github.com:AdamZink/react-web-audio-demo.git","clone_url":"https://github.com/AdamZink/react-web-audio-demo.git","svn_url":"https://github.com/AdamZink/react-web-audio-demo","homepage":null,"size":18,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"AdamZink:master","ref":"master","sha":"da199832c04d8ee41cf0c31354c02e3a7c637f96","user":{"login":"AdamZink","id":22451030,"node_id":"MDQ6VXNlcjIyNDUxMDMw","avatar_url":"https://avatars3.githubusercontent.com/u/22451030?v=4","gravatar_id":"","url":"https://api.github.com/users/AdamZink","html_url":"https://github.com/AdamZink","followers_url":"https://api.github.com/users/AdamZink/followers","following_url":"https://api.github.com/users/AdamZink/following{/other_user}","gists_url":"https://api.github.com/users/AdamZink/gists{/gist_id}","starred_url":"https://api.github.com/users/AdamZink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AdamZink/subscriptions","organizations_url":"https://api.github.com/users/AdamZink/orgs","repos_url":"https://api.github.com/users/AdamZink/repos","events_url":"https://api.github.com/users/AdamZink/events{/privacy}","received_events_url":"https://api.github.com/users/AdamZink/received_events","type":"User","site_admin":false},"repo":{"id":162229121,"node_id":"MDEwOlJlcG9zaXRvcnkxNjIyMjkxMjE=","name":"react-web-audio-demo","full_name":"AdamZink/react-web-audio-demo","private":false,"owner":{"login":"AdamZink","id":22451030,"node_id":"MDQ6VXNlcjIyNDUxMDMw","avatar_url":"https://avatars3.githubusercontent.com/u/22451030?v=4","gravatar_id":"","url":"https://api.github.com/users/AdamZink","html_url":"https://github.com/AdamZink","followers_url":"https://api.github.com/users/AdamZink/followers","following_url":"https://api.github.com/users/AdamZink/following{/other_user}","gists_url":"https://api.github.com/users/AdamZink/gists{/gist_id}","starred_url":"https://api.github.com/users/AdamZink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AdamZink/subscriptions","organizations_url":"https://api.github.com/users/AdamZink/orgs","repos_url":"https://api.github.com/users/AdamZink/repos","events_url":"https://api.github.com/users/AdamZink/events{/privacy}","received_events_url":"https://api.github.com/users/AdamZink/received_events","type":"User","site_admin":false},"html_url":"https://github.com/AdamZink/react-web-audio-demo","description":"Sample React application for synthesizing tones with Web Audio API","fork":false,"url":"https://api.github.com/repos/AdamZink/react-web-audio-demo","forks_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/forks","keys_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/teams","hooks_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/hooks","issue_events_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/issues/events{/number}","events_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/events","assignees_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/assignees{/user}","branches_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/branches{/branch}","tags_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/tags","blobs_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/git/refs{/sha}","trees_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/statuses/{sha}","languages_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/languages","stargazers_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/stargazers","contributors_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/contributors","subscribers_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/subscribers","subscription_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/subscription","commits_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/commits{/sha}","git_commits_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/git/commits{/sha}","comments_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/comments{/number}","issue_comment_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/issues/comments{/number}","contents_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/contents/{+path}","compare_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/merges","archive_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/downloads","issues_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/issues{/number}","pulls_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/pulls{/number}","milestones_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/milestones{/number}","notifications_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/labels{/name}","releases_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/releases{/id}","deployments_url":"https://api.github.com/repos/AdamZink/react-web-audio-demo/deployments","created_at":"2018-12-18T04:15:58Z","updated_at":"2018-12-19T23:54:10Z","pushed_at":"2018-12-29T16:46:52Z","git_url":"git://github.com/AdamZink/react-web-audio-demo.git","ssh_url":"git@github.com:AdamZink/react-web-audio-demo.git","clone_url":"https://github.com/AdamZink/react-web-audio-demo.git","svn_url":"https://github.com/AdamZink/react-web-audio-demo","homepage":null,"size":18,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/AdamZink/react-web-audio-demo/pulls/2"},"html":{"href":"https://github.com/AdamZink/react-web-audio-demo/pull/2"},"issue":{"href":"https://api.github.com/repos/AdamZink/react-web-audio-demo/issues/2"},"comments":{"href":"https://api.github.com/repos/AdamZink/react-web-audio-demo/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/AdamZink/react-web-audio-demo/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/AdamZink/react-web-audio-demo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AdamZink/react-web-audio-demo/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/AdamZink/react-web-audio-demo/statuses/1648c8270ec9fd5b2bdeb33100e27b0124be51a1"}},"author_association":"OWNER"}}
{"actor":{"display_login":"AdamZink"}}