{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleChrome/omnitone/pulls/comments/126044005","pull_request_review_id":48479566,"id":126044005,"diff_hunk":"@@ -0,0 +1,134 @@\n+/**\n+ * Copyright 2017 Google Inc. All Rights Reserved.\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+\n+/**\n+ * Test HOAConvolver object.\n+ *\n+ * Load HRIR (SH MaxRE, the new optimized IRs) and shoot an impulse to generate\n+ * a buffer of binaural rendering. Then compare it with the JS-calculated\n+ * result. Thresholding the comparison is necessary because of truncation error.\n+ */\n+describe('HOAConvolver', function () {\n+  // This test is async, override timeout threshold to 5 sec.\n+  this.timeout(5000);\n+\n+  // Threshold for sample comparison.\n+  var THRESHOLD = 2.9802322387695312e-8;\n+\n+  // SH MaxRe HRIRs are 48Khz and 256 samples.\n+  var sampleRate = 48000;\n+  var renderLength = 256;\n+\n+  var context;\n+  var hoaImpulseBuffer;\n+  var hoaSHMaxREBuffer;\n+\n+  /**\n+   * Calculate the expected binaural rendering (based on SH-maxRE algorithm)\n+   * result from the impulse input and generate an AudioBus instance.\n+   * @param  {AudioBuffer} buffer     FOA SH-maxRE HRIR buffer.\n+   * @return {AudioBus}\n+   */\n+  function generateExpectedBusFromHOAIRBuffer (buffer) {\n+    var generatedBus = new AudioBus(2, buffer.length, buffer.sampleRate);\n+\n+    // Get pointers to each buffer.\n+    var ACN = [];\n+    for (var i = 0; i < buffer.numberOfChannels; i++) {\n+      ACN[i] = buffer.getChannelData(i);\n+    }\n+    var L = generatedBus.getChannelData(0);\n+    var R = generatedBus.getChannelData(1);\n+\n+    // Derive ambisonic order from number of channels.\n+    var ambisonicOrder = Math.floor(Math.sqrt(buffer.numberOfChannels)) - 1;\n+\n+    /**\n+     * We wish to exploit front-axis symmetry, hence the left output will be\n+     * the sum of all spherical harmonics while the right output is the\n+     * difference between the positive-m spherical harmonics and the negative-m\n+     * spherical harmonics.\n+     */\n+    for (var i = 0; i < buffer.length; ++i) {\n+      L[i] = 0;\n+      R[i] = 0;\n+      for (var l = 0; l <= ambisonicOrder; l++) {\n+        for (var m = -l; m <= l; m++) {\n+          var acnIndex = l * l + l + m;\n+          L[i] += ACN[acnIndex];\n+          if (m >= 0) {\n+            R[i] += ACN[acnIndex];\n+          } else {\n+            R[i] -= ACN[acnIndex];\n+          }\n+        }\n+      }\n+    }\n+    return generatedBus;\n+  }\n+\n+  beforeEach(function (done) {\n+    context = new OfflineAudioContext(16, renderLength, sampleRate);","path":"test/test-hoa-convolver.js","position":84,"original_position":84,"commit_id":"cee3cfbf3d6bcb5b5e65de826f9d744d7fee8c82","original_commit_id":"cee3cfbf3d6bcb5b5e65de826f9d744d7fee8c82","user":{"login":"hoch","id":676891,"avatar_url":"https://avatars2.githubusercontent.com/u/676891?v=3","gravatar_id":"","url":"https://api.github.com/users/hoch","html_url":"https://github.com/hoch","followers_url":"https://api.github.com/users/hoch/followers","following_url":"https://api.github.com/users/hoch/following{/other_user}","gists_url":"https://api.github.com/users/hoch/gists{/gist_id}","starred_url":"https://api.github.com/users/hoch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hoch/subscriptions","organizations_url":"https://api.github.com/users/hoch/orgs","repos_url":"https://api.github.com/users/hoch/repos","events_url":"https://api.github.com/users/hoch/events{/privacy}","received_events_url":"https://api.github.com/users/hoch/received_events","type":"User","site_admin":false},"body":"16 channels, so we're testing the third-oder. Right? I think we should mention it at the top of the test file.","created_at":"2017-07-06T23:53:21Z","updated_at":"2017-07-07T00:02:16Z","html_url":"https://github.com/GoogleChrome/omnitone/pull/59#discussion_r126044005","pull_request_url":"https://api.github.com/repos/GoogleChrome/omnitone/pulls/59","_links":{"self":{"href":"https://api.github.com/repos/GoogleChrome/omnitone/pulls/comments/126044005"},"html":{"href":"https://github.com/GoogleChrome/omnitone/pull/59#discussion_r126044005"},"pull_request":{"href":"https://api.github.com/repos/GoogleChrome/omnitone/pulls/59"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleChrome/omnitone/pulls/59","id":127516644,"html_url":"https://github.com/GoogleChrome/omnitone/pull/59","diff_url":"https://github.com/GoogleChrome/omnitone/pull/59.diff","patch_url":"https://github.com/GoogleChrome/omnitone/pull/59.patch","issue_url":"https://api.github.com/repos/GoogleChrome/omnitone/issues/59","number":59,"state":"open","locked":false,"title":"Support for Higher-Order Ambisonics (HOA).","user":{"login":"drewbitllama","id":6351926,"avatar_url":"https://avatars1.githubusercontent.com/u/6351926?v=3","gravatar_id":"","url":"https://api.github.com/users/drewbitllama","html_url":"https://github.com/drewbitllama","followers_url":"https://api.github.com/users/drewbitllama/followers","following_url":"https://api.github.com/users/drewbitllama/following{/other_user}","gists_url":"https://api.github.com/users/drewbitllama/gists{/gist_id}","starred_url":"https://api.github.com/users/drewbitllama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drewbitllama/subscriptions","organizations_url":"https://api.github.com/users/drewbitllama/orgs","repos_url":"https://api.github.com/users/drewbitllama/repos","events_url":"https://api.github.com/users/drewbitllama/events{/privacy}","received_events_url":"https://api.github.com/users/drewbitllama/received_events","type":"User","site_admin":false},"body":"Rotation, convolution and rendering classes, w/ example.","created_at":"2017-06-26T17:01:06Z","updated_at":"2017-07-07T00:02:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"14cfb01bdc91e8329f4950bcbd1823949f89a1dd","assignee":{"login":"drewbitllama","id":6351926,"avatar_url":"https://avatars1.githubusercontent.com/u/6351926?v=3","gravatar_id":"","url":"https://api.github.com/users/drewbitllama","html_url":"https://github.com/drewbitllama","followers_url":"https://api.github.com/users/drewbitllama/followers","following_url":"https://api.github.com/users/drewbitllama/following{/other_user}","gists_url":"https://api.github.com/users/drewbitllama/gists{/gist_id}","starred_url":"https://api.github.com/users/drewbitllama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drewbitllama/subscriptions","organizations_url":"https://api.github.com/users/drewbitllama/orgs","repos_url":"https://api.github.com/users/drewbitllama/repos","events_url":"https://api.github.com/users/drewbitllama/events{/privacy}","received_events_url":"https://api.github.com/users/drewbitllama/received_events","type":"User","site_admin":false},"assignees":[{"login":"drewbitllama","id":6351926,"avatar_url":"https://avatars1.githubusercontent.com/u/6351926?v=3","gravatar_id":"","url":"https://api.github.com/users/drewbitllama","html_url":"https://github.com/drewbitllama","followers_url":"https://api.github.com/users/drewbitllama/followers","following_url":"https://api.github.com/users/drewbitllama/following{/other_user}","gists_url":"https://api.github.com/users/drewbitllama/gists{/gist_id}","starred_url":"https://api.github.com/users/drewbitllama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drewbitllama/subscriptions","organizations_url":"https://api.github.com/users/drewbitllama/orgs","repos_url":"https://api.github.com/users/drewbitllama/repos","events_url":"https://api.github.com/users/drewbitllama/events{/privacy}","received_events_url":"https://api.github.com/users/drewbitllama/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleChrome/omnitone/pulls/59/commits","review_comments_url":"https://api.github.com/repos/GoogleChrome/omnitone/pulls/59/comments","review_comment_url":"https://api.github.com/repos/GoogleChrome/omnitone/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleChrome/omnitone/issues/59/comments","statuses_url":"https://api.github.com/repos/GoogleChrome/omnitone/statuses/cee3cfbf3d6bcb5b5e65de826f9d744d7fee8c82","head":{"label":"drewbitllama:master","ref":"master","sha":"cee3cfbf3d6bcb5b5e65de826f9d744d7fee8c82","user":{"login":"drewbitllama","id":6351926,"avatar_url":"https://avatars1.githubusercontent.com/u/6351926?v=3","gravatar_id":"","url":"https://api.github.com/users/drewbitllama","html_url":"https://github.com/drewbitllama","followers_url":"https://api.github.com/users/drewbitllama/followers","following_url":"https://api.github.com/users/drewbitllama/following{/other_user}","gists_url":"https://api.github.com/users/drewbitllama/gists{/gist_id}","starred_url":"https://api.github.com/users/drewbitllama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drewbitllama/subscriptions","organizations_url":"https://api.github.com/users/drewbitllama/orgs","repos_url":"https://api.github.com/users/drewbitllama/repos","events_url":"https://api.github.com/users/drewbitllama/events{/privacy}","received_events_url":"https://api.github.com/users/drewbitllama/received_events","type":"User","site_admin":false},"repo":{"id":95469047,"name":"omnitone","full_name":"drewbitllama/omnitone","owner":{"login":"drewbitllama","id":6351926,"avatar_url":"https://avatars1.githubusercontent.com/u/6351926?v=3","gravatar_id":"","url":"https://api.github.com/users/drewbitllama","html_url":"https://github.com/drewbitllama","followers_url":"https://api.github.com/users/drewbitllama/followers","following_url":"https://api.github.com/users/drewbitllama/following{/other_user}","gists_url":"https://api.github.com/users/drewbitllama/gists{/gist_id}","starred_url":"https://api.github.com/users/drewbitllama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drewbitllama/subscriptions","organizations_url":"https://api.github.com/users/drewbitllama/orgs","repos_url":"https://api.github.com/users/drewbitllama/repos","events_url":"https://api.github.com/users/drewbitllama/events{/privacy}","received_events_url":"https://api.github.com/users/drewbitllama/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/drewbitllama/omnitone","description":"Spatial audio on the web.","fork":true,"url":"https://api.github.com/repos/drewbitllama/omnitone","forks_url":"https://api.github.com/repos/drewbitllama/omnitone/forks","keys_url":"https://api.github.com/repos/drewbitllama/omnitone/keys{/key_id}","collaborators_url":"https://api.github.com/repos/drewbitllama/omnitone/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/drewbitllama/omnitone/teams","hooks_url":"https://api.github.com/repos/drewbitllama/omnitone/hooks","issue_events_url":"https://api.github.com/repos/drewbitllama/omnitone/issues/events{/number}","events_url":"https://api.github.com/repos/drewbitllama/omnitone/events","assignees_url":"https://api.github.com/repos/drewbitllama/omnitone/assignees{/user}","branches_url":"https://api.github.com/repos/drewbitllama/omnitone/branches{/branch}","tags_url":"https://api.github.com/repos/drewbitllama/omnitone/tags","blobs_url":"https://api.github.com/repos/drewbitllama/omnitone/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/drewbitllama/omnitone/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/drewbitllama/omnitone/git/refs{/sha}","trees_url":"https://api.github.com/repos/drewbitllama/omnitone/git/trees{/sha}","statuses_url":"https://api.github.com/repos/drewbitllama/omnitone/statuses/{sha}","languages_url":"https://api.github.com/repos/drewbitllama/omnitone/languages","stargazers_url":"https://api.github.com/repos/drewbitllama/omnitone/stargazers","contributors_url":"https://api.github.com/repos/drewbitllama/omnitone/contributors","subscribers_url":"https://api.github.com/repos/drewbitllama/omnitone/subscribers","subscription_url":"https://api.github.com/repos/drewbitllama/omnitone/subscription","commits_url":"https://api.github.com/repos/drewbitllama/omnitone/commits{/sha}","git_commits_url":"https://api.github.com/repos/drewbitllama/omnitone/git/commits{/sha}","comments_url":"https://api.github.com/repos/drewbitllama/omnitone/comments{/number}","issue_comment_url":"https://api.github.com/repos/drewbitllama/omnitone/issues/comments{/number}","contents_url":"https://api.github.com/repos/drewbitllama/omnitone/contents/{+path}","compare_url":"https://api.github.com/repos/drewbitllama/omnitone/compare/{base}...{head}","merges_url":"https://api.github.com/repos/drewbitllama/omnitone/merges","archive_url":"https://api.github.com/repos/drewbitllama/omnitone/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/drewbitllama/omnitone/downloads","issues_url":"https://api.github.com/repos/drewbitllama/omnitone/issues{/number}","pulls_url":"https://api.github.com/repos/drewbitllama/omnitone/pulls{/number}","milestones_url":"https://api.github.com/repos/drewbitllama/omnitone/milestones{/number}","notifications_url":"https://api.github.com/repos/drewbitllama/omnitone/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/drewbitllama/omnitone/labels{/name}","releases_url":"https://api.github.com/repos/drewbitllama/omnitone/releases{/id}","deployments_url":"https://api.github.com/repos/drewbitllama/omnitone/deployments","created_at":"2017-06-26T16:57:41Z","updated_at":"2017-06-26T16:57:42Z","pushed_at":"2017-07-06T21:10:06Z","git_url":"git://github.com/drewbitllama/omnitone.git","ssh_url":"git@github.com:drewbitllama/omnitone.git","clone_url":"https://github.com/drewbitllama/omnitone.git","svn_url":"https://github.com/drewbitllama/omnitone","homepage":"https://googlechrome.github.io/omnitone","size":258982,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"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":"GoogleChrome:master","ref":"master","sha":"22b6a9a273fdccef74973a22288811d68f1e4f73","user":{"login":"GoogleChrome","id":1778935,"avatar_url":"https://avatars0.githubusercontent.com/u/1778935?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"repo":{"id":60283346,"name":"omnitone","full_name":"GoogleChrome/omnitone","owner":{"login":"GoogleChrome","id":1778935,"avatar_url":"https://avatars0.githubusercontent.com/u/1778935?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleChrome/omnitone","description":"Spatial audio on the web.","fork":false,"url":"https://api.github.com/repos/GoogleChrome/omnitone","forks_url":"https://api.github.com/repos/GoogleChrome/omnitone/forks","keys_url":"https://api.github.com/repos/GoogleChrome/omnitone/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleChrome/omnitone/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleChrome/omnitone/teams","hooks_url":"https://api.github.com/repos/GoogleChrome/omnitone/hooks","issue_events_url":"https://api.github.com/repos/GoogleChrome/omnitone/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleChrome/omnitone/events","assignees_url":"https://api.github.com/repos/GoogleChrome/omnitone/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleChrome/omnitone/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleChrome/omnitone/tags","blobs_url":"https://api.github.com/repos/GoogleChrome/omnitone/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleChrome/omnitone/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleChrome/omnitone/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleChrome/omnitone/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleChrome/omnitone/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleChrome/omnitone/languages","stargazers_url":"https://api.github.com/repos/GoogleChrome/omnitone/stargazers","contributors_url":"https://api.github.com/repos/GoogleChrome/omnitone/contributors","subscribers_url":"https://api.github.com/repos/GoogleChrome/omnitone/subscribers","subscription_url":"https://api.github.com/repos/GoogleChrome/omnitone/subscription","commits_url":"https://api.github.com/repos/GoogleChrome/omnitone/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleChrome/omnitone/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleChrome/omnitone/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleChrome/omnitone/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleChrome/omnitone/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleChrome/omnitone/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleChrome/omnitone/merges","archive_url":"https://api.github.com/repos/GoogleChrome/omnitone/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleChrome/omnitone/downloads","issues_url":"https://api.github.com/repos/GoogleChrome/omnitone/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleChrome/omnitone/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleChrome/omnitone/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleChrome/omnitone/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleChrome/omnitone/labels{/name}","releases_url":"https://api.github.com/repos/GoogleChrome/omnitone/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleChrome/omnitone/deployments","created_at":"2016-06-02T17:21:26Z","updated_at":"2017-07-06T09:32:36Z","pushed_at":"2017-07-06T23:12:36Z","git_url":"git://github.com/GoogleChrome/omnitone.git","ssh_url":"git@github.com:GoogleChrome/omnitone.git","clone_url":"https://github.com/GoogleChrome/omnitone.git","svn_url":"https://github.com/GoogleChrome/omnitone","homepage":"https://googlechrome.github.io/omnitone","size":255841,"stargazers_count":403,"watchers_count":403,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":55,"mirror_url":null,"open_issues_count":6,"forks":55,"open_issues":6,"watchers":403,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleChrome/omnitone/pulls/59"},"html":{"href":"https://github.com/GoogleChrome/omnitone/pull/59"},"issue":{"href":"https://api.github.com/repos/GoogleChrome/omnitone/issues/59"},"comments":{"href":"https://api.github.com/repos/GoogleChrome/omnitone/issues/59/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleChrome/omnitone/pulls/59/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleChrome/omnitone/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleChrome/omnitone/pulls/59/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleChrome/omnitone/statuses/cee3cfbf3d6bcb5b5e65de826f9d744d7fee8c82"}}}}
{"actor":{"display_login":"hoch"}}