{"action":"created","comment":{"url":"https://api.github.com/repos/tensorflow/magenta/pulls/comments/83512263","pull_request_review_id":4354674,"id":83512263,"diff_hunk":"@@ -148,85 +149,84 @@ class Metronome(threading.Thread):\n     velocity: The velocity of the metronome's tick `note_on` message.\n     pitch: The pitch of the metronome's tick `note_on` message.\n     duration: The duration of the metronome's tick.\n-    qpb: The number of quarter notes per bar.\n   \"\"\"\n+  # The pitch interval in semitones to raise metronome downbeats only.\n+  _ACCENT_PITCH_INTERVAL = 7\n+  # The amount to add to metronome velocity on downbeats only.\n+  _ACCENT_VELOCITY_DELTA = 1\n \n   def __init__(self,\n                outport,\n                qpm,\n+               qpb,\n                start_time,\n                stop_time=None,\n                velocity=_DEFAULT_METRONOME_VELOCITY,\n                pitch=_DEFAULT_METRONOME_PITCH,\n-               duration=_DEFAULT_METRONOME_TICK_DURATION,\n-               qpb=4):\n+               duration=_DEFAULT_METRONOME_TICK_DURATION):\n     self._outport = outport\n     self._qpm = qpm\n+    self._qpb = qpb\n     self._start_time = start_time\n     self._velocity = velocity\n     self._pitch = pitch\n     self._duration = duration\n     # A signal for when to stop the metronome.\n     self._stop_time = stop_time\n-    self._qpb = qpb\n-    self._count = 0\n-    # The amount to add to metronome velocity on downbeats only.\n-    self._accent_velocity_delta = 10\n-    # The pitch interval in semitones to raise metronome downbeats only.\n-    self._accent_pitch_interval = 7\n     super(Metronome, self).__init__()\n \n-    # limit metronome accent velocity to 127 max value.\n-    self._accent_velocity = min(velocity + self._accent_velocity_delta, 127)\n-    # only raise metronome accent pitch if there is headroom.\n-    self._accent_pitch = (\n-        self._pitch if self._pitch + self._accent_pitch_interval > 127\n-        else self._pitch + self._accent_pitch_interval)\n \n   def run(self):\n     \"\"\"Outputs metronome tone on the qpm interval until stop signal received.\"\"\"\n+\n+    # limit metronome accent velocity to 127 max value.\n+    accent_velocity = min(self._velocity + self._ACCENT_VELOCITY_DELTA, 127)\n+    # only raise metronome accent pitch if there is headroom.\n+    accent_pitch = (\n+      self._pitch if self._pitch + self._ACCENT_PITCH_INTERVAL > 127\n+      else self._pitch + self._ACCENT_PITCH_INTERVAL)\n+\n     period = 60. / self._qpm\n+    metric_position = 1","path":"magenta/interfaces/midi/midi_hub.py","position":48,"original_position":65,"commit_id":"928b526b7d42400f6911e54266a3678b8cdf979d","original_commit_id":"928b526b7d42400f6911e54266a3678b8cdf979d","user":{"login":"adarob","id":1088232,"avatar_url":"https://avatars.githubusercontent.com/u/1088232?v=3","gravatar_id":"","url":"https://api.github.com/users/adarob","html_url":"https://github.com/adarob","followers_url":"https://api.github.com/users/adarob/followers","following_url":"https://api.github.com/users/adarob/following{/other_user}","gists_url":"https://api.github.com/users/adarob/gists{/gist_id}","starred_url":"https://api.github.com/users/adarob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adarob/subscriptions","organizations_url":"https://api.github.com/users/adarob/orgs","repos_url":"https://api.github.com/users/adarob/repos","events_url":"https://api.github.com/users/adarob/events{/privacy}","received_events_url":"https://api.github.com/users/adarob/received_events","type":"User","site_admin":false},"body":"start at 0","created_at":"2016-10-14T22:30:27Z","updated_at":"2016-10-14T22:32:01Z","html_url":"https://github.com/tensorflow/magenta/pull/269#discussion_r83512263","pull_request_url":"https://api.github.com/repos/tensorflow/magenta/pulls/269","_links":{"self":{"href":"https://api.github.com/repos/tensorflow/magenta/pulls/comments/83512263"},"html":{"href":"https://github.com/tensorflow/magenta/pull/269#discussion_r83512263"},"pull_request":{"href":"https://api.github.com/repos/tensorflow/magenta/pulls/269"}}},"pull_request":{"url":"https://api.github.com/repos/tensorflow/magenta/pulls/269","id":88953022,"html_url":"https://github.com/tensorflow/magenta/pull/269","diff_url":"https://github.com/tensorflow/magenta/pull/269.diff","patch_url":"https://github.com/tensorflow/magenta/pull/269.patch","issue_url":"https://api.github.com/repos/tensorflow/magenta/issues/269","number":269,"state":"open","locked":false,"title":"Adding metronome accents","user":{"login":"hanzorama","id":16696309,"avatar_url":"https://avatars.githubusercontent.com/u/16696309?v=3","gravatar_id":"","url":"https://api.github.com/users/hanzorama","html_url":"https://github.com/hanzorama","followers_url":"https://api.github.com/users/hanzorama/followers","following_url":"https://api.github.com/users/hanzorama/following{/other_user}","gists_url":"https://api.github.com/users/hanzorama/gists{/gist_id}","starred_url":"https://api.github.com/users/hanzorama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanzorama/subscriptions","organizations_url":"https://api.github.com/users/hanzorama/orgs","repos_url":"https://api.github.com/users/hanzorama/repos","events_url":"https://api.github.com/users/hanzorama/events{/privacy}","received_events_url":"https://api.github.com/users/hanzorama/received_events","type":"User","site_admin":false},"body":"-accent by pitch and velocity change on downbeats","created_at":"2016-10-12T04:47:15Z","updated_at":"2016-10-14T22:32:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b96ad456945031e1eb3a0f8d58f6492518a4a3f4","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/tensorflow/magenta/pulls/269/commits","review_comments_url":"https://api.github.com/repos/tensorflow/magenta/pulls/269/comments","review_comment_url":"https://api.github.com/repos/tensorflow/magenta/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tensorflow/magenta/issues/269/comments","statuses_url":"https://api.github.com/repos/tensorflow/magenta/statuses/928b526b7d42400f6911e54266a3678b8cdf979d","head":{"label":"hanzorama:metronome_accents","ref":"metronome_accents","sha":"928b526b7d42400f6911e54266a3678b8cdf979d","user":{"login":"hanzorama","id":16696309,"avatar_url":"https://avatars.githubusercontent.com/u/16696309?v=3","gravatar_id":"","url":"https://api.github.com/users/hanzorama","html_url":"https://github.com/hanzorama","followers_url":"https://api.github.com/users/hanzorama/followers","following_url":"https://api.github.com/users/hanzorama/following{/other_user}","gists_url":"https://api.github.com/users/hanzorama/gists{/gist_id}","starred_url":"https://api.github.com/users/hanzorama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanzorama/subscriptions","organizations_url":"https://api.github.com/users/hanzorama/orgs","repos_url":"https://api.github.com/users/hanzorama/repos","events_url":"https://api.github.com/users/hanzorama/events{/privacy}","received_events_url":"https://api.github.com/users/hanzorama/received_events","type":"User","site_admin":false},"repo":{"id":65040957,"name":"magenta","full_name":"hanzorama/magenta","owner":{"login":"hanzorama","id":16696309,"avatar_url":"https://avatars.githubusercontent.com/u/16696309?v=3","gravatar_id":"","url":"https://api.github.com/users/hanzorama","html_url":"https://github.com/hanzorama","followers_url":"https://api.github.com/users/hanzorama/followers","following_url":"https://api.github.com/users/hanzorama/following{/other_user}","gists_url":"https://api.github.com/users/hanzorama/gists{/gist_id}","starred_url":"https://api.github.com/users/hanzorama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanzorama/subscriptions","organizations_url":"https://api.github.com/users/hanzorama/orgs","repos_url":"https://api.github.com/users/hanzorama/repos","events_url":"https://api.github.com/users/hanzorama/events{/privacy}","received_events_url":"https://api.github.com/users/hanzorama/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hanzorama/magenta","description":"Magenta: Music and Art Generation with Machine Intelligence","fork":true,"url":"https://api.github.com/repos/hanzorama/magenta","forks_url":"https://api.github.com/repos/hanzorama/magenta/forks","keys_url":"https://api.github.com/repos/hanzorama/magenta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hanzorama/magenta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hanzorama/magenta/teams","hooks_url":"https://api.github.com/repos/hanzorama/magenta/hooks","issue_events_url":"https://api.github.com/repos/hanzorama/magenta/issues/events{/number}","events_url":"https://api.github.com/repos/hanzorama/magenta/events","assignees_url":"https://api.github.com/repos/hanzorama/magenta/assignees{/user}","branches_url":"https://api.github.com/repos/hanzorama/magenta/branches{/branch}","tags_url":"https://api.github.com/repos/hanzorama/magenta/tags","blobs_url":"https://api.github.com/repos/hanzorama/magenta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hanzorama/magenta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hanzorama/magenta/git/refs{/sha}","trees_url":"https://api.github.com/repos/hanzorama/magenta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hanzorama/magenta/statuses/{sha}","languages_url":"https://api.github.com/repos/hanzorama/magenta/languages","stargazers_url":"https://api.github.com/repos/hanzorama/magenta/stargazers","contributors_url":"https://api.github.com/repos/hanzorama/magenta/contributors","subscribers_url":"https://api.github.com/repos/hanzorama/magenta/subscribers","subscription_url":"https://api.github.com/repos/hanzorama/magenta/subscription","commits_url":"https://api.github.com/repos/hanzorama/magenta/commits{/sha}","git_commits_url":"https://api.github.com/repos/hanzorama/magenta/git/commits{/sha}","comments_url":"https://api.github.com/repos/hanzorama/magenta/comments{/number}","issue_comment_url":"https://api.github.com/repos/hanzorama/magenta/issues/comments{/number}","contents_url":"https://api.github.com/repos/hanzorama/magenta/contents/{+path}","compare_url":"https://api.github.com/repos/hanzorama/magenta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hanzorama/magenta/merges","archive_url":"https://api.github.com/repos/hanzorama/magenta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hanzorama/magenta/downloads","issues_url":"https://api.github.com/repos/hanzorama/magenta/issues{/number}","pulls_url":"https://api.github.com/repos/hanzorama/magenta/pulls{/number}","milestones_url":"https://api.github.com/repos/hanzorama/magenta/milestones{/number}","notifications_url":"https://api.github.com/repos/hanzorama/magenta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hanzorama/magenta/labels{/name}","releases_url":"https://api.github.com/repos/hanzorama/magenta/releases{/id}","deployments_url":"https://api.github.com/repos/hanzorama/magenta/deployments","created_at":"2016-08-05T18:36:37Z","updated_at":"2016-08-05T18:36:38Z","pushed_at":"2016-10-14T05:40:07Z","git_url":"git://github.com/hanzorama/magenta.git","ssh_url":"git@github.com:hanzorama/magenta.git","clone_url":"https://github.com/hanzorama/magenta.git","svn_url":"https://github.com/hanzorama/magenta","homepage":"","size":11503,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":false,"has_wiki":false,"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":"tensorflow:master","ref":"master","sha":"29361e3c5dbf36e886817d99ca97272e75126f92","user":{"login":"tensorflow","id":15658638,"avatar_url":"https://avatars.githubusercontent.com/u/15658638?v=3","gravatar_id":"","url":"https://api.github.com/users/tensorflow","html_url":"https://github.com/tensorflow","followers_url":"https://api.github.com/users/tensorflow/followers","following_url":"https://api.github.com/users/tensorflow/following{/other_user}","gists_url":"https://api.github.com/users/tensorflow/gists{/gist_id}","starred_url":"https://api.github.com/users/tensorflow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tensorflow/subscriptions","organizations_url":"https://api.github.com/users/tensorflow/orgs","repos_url":"https://api.github.com/users/tensorflow/repos","events_url":"https://api.github.com/users/tensorflow/events{/privacy}","received_events_url":"https://api.github.com/users/tensorflow/received_events","type":"Organization","site_admin":false},"repo":{"id":58157629,"name":"magenta","full_name":"tensorflow/magenta","owner":{"login":"tensorflow","id":15658638,"avatar_url":"https://avatars.githubusercontent.com/u/15658638?v=3","gravatar_id":"","url":"https://api.github.com/users/tensorflow","html_url":"https://github.com/tensorflow","followers_url":"https://api.github.com/users/tensorflow/followers","following_url":"https://api.github.com/users/tensorflow/following{/other_user}","gists_url":"https://api.github.com/users/tensorflow/gists{/gist_id}","starred_url":"https://api.github.com/users/tensorflow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tensorflow/subscriptions","organizations_url":"https://api.github.com/users/tensorflow/orgs","repos_url":"https://api.github.com/users/tensorflow/repos","events_url":"https://api.github.com/users/tensorflow/events{/privacy}","received_events_url":"https://api.github.com/users/tensorflow/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tensorflow/magenta","description":"Magenta: Music and Art Generation with Machine Intelligence","fork":false,"url":"https://api.github.com/repos/tensorflow/magenta","forks_url":"https://api.github.com/repos/tensorflow/magenta/forks","keys_url":"https://api.github.com/repos/tensorflow/magenta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tensorflow/magenta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tensorflow/magenta/teams","hooks_url":"https://api.github.com/repos/tensorflow/magenta/hooks","issue_events_url":"https://api.github.com/repos/tensorflow/magenta/issues/events{/number}","events_url":"https://api.github.com/repos/tensorflow/magenta/events","assignees_url":"https://api.github.com/repos/tensorflow/magenta/assignees{/user}","branches_url":"https://api.github.com/repos/tensorflow/magenta/branches{/branch}","tags_url":"https://api.github.com/repos/tensorflow/magenta/tags","blobs_url":"https://api.github.com/repos/tensorflow/magenta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tensorflow/magenta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tensorflow/magenta/git/refs{/sha}","trees_url":"https://api.github.com/repos/tensorflow/magenta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tensorflow/magenta/statuses/{sha}","languages_url":"https://api.github.com/repos/tensorflow/magenta/languages","stargazers_url":"https://api.github.com/repos/tensorflow/magenta/stargazers","contributors_url":"https://api.github.com/repos/tensorflow/magenta/contributors","subscribers_url":"https://api.github.com/repos/tensorflow/magenta/subscribers","subscription_url":"https://api.github.com/repos/tensorflow/magenta/subscription","commits_url":"https://api.github.com/repos/tensorflow/magenta/commits{/sha}","git_commits_url":"https://api.github.com/repos/tensorflow/magenta/git/commits{/sha}","comments_url":"https://api.github.com/repos/tensorflow/magenta/comments{/number}","issue_comment_url":"https://api.github.com/repos/tensorflow/magenta/issues/comments{/number}","contents_url":"https://api.github.com/repos/tensorflow/magenta/contents/{+path}","compare_url":"https://api.github.com/repos/tensorflow/magenta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tensorflow/magenta/merges","archive_url":"https://api.github.com/repos/tensorflow/magenta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tensorflow/magenta/downloads","issues_url":"https://api.github.com/repos/tensorflow/magenta/issues{/number}","pulls_url":"https://api.github.com/repos/tensorflow/magenta/pulls{/number}","milestones_url":"https://api.github.com/repos/tensorflow/magenta/milestones{/number}","notifications_url":"https://api.github.com/repos/tensorflow/magenta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tensorflow/magenta/labels{/name}","releases_url":"https://api.github.com/repos/tensorflow/magenta/releases{/id}","deployments_url":"https://api.github.com/repos/tensorflow/magenta/deployments","created_at":"2016-05-05T20:10:40Z","updated_at":"2016-10-14T19:39:26Z","pushed_at":"2016-10-14T18:51:24Z","git_url":"git://github.com/tensorflow/magenta.git","ssh_url":"git@github.com:tensorflow/magenta.git","clone_url":"https://github.com/tensorflow/magenta.git","svn_url":"https://github.com/tensorflow/magenta","homepage":"","size":15594,"stargazers_count":3344,"watchers_count":3344,"language":"Python","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":388,"mirror_url":null,"open_issues_count":14,"forks":388,"open_issues":14,"watchers":3344,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tensorflow/magenta/pulls/269"},"html":{"href":"https://github.com/tensorflow/magenta/pull/269"},"issue":{"href":"https://api.github.com/repos/tensorflow/magenta/issues/269"},"comments":{"href":"https://api.github.com/repos/tensorflow/magenta/issues/269/comments"},"review_comments":{"href":"https://api.github.com/repos/tensorflow/magenta/pulls/269/comments"},"review_comment":{"href":"https://api.github.com/repos/tensorflow/magenta/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tensorflow/magenta/pulls/269/commits"},"statuses":{"href":"https://api.github.com/repos/tensorflow/magenta/statuses/928b526b7d42400f6911e54266a3678b8cdf979d"}}}}
{"actor":{"display_login":"adarob"}}