{"action":"created","comment":{"url":"https://api.github.com/repos/tensorflow/magenta-js/pulls/comments/186232203","pull_request_review_id":117780749,"id":186232203,"diff_hunk":"@@ -493,3 +501,242 @@ export class TrioConverter extends DataConverter {\n     return ns;\n   }\n }\n+\n+/**\n+ * Converts between a quantized multitrack `NoteSequence` and `Tensor` objects\n+ * used by `MusicVAE`.\n+ *\n+ * Each track is represented using events from the following vocabulary:\n+ *   - An initial program-select event specifying which MIDI program to use.\n+ *   - A sequence of performance (note-on, note-off, time-shift,\n+ *     velocity-change) events.\n+ *   - An end token.\n+ *\n+ * Tracks are ordered by program number with drums at the end, then one-hot\n+ * encoded and padded with zeros to the maximum number of events. If fewer than\n+ * the maximum number of tracks are present, extra tracks consisting of only an\n+ * end token (then one-hot encoded and zero-padded) will be added.\n+ *\n+ * @param numSteps The total number of events used to encode each\n+ * `NoteSequence`.\n+ * @param numSegments The number of tracks to use. `NoteSequence`s with more\n+ * tracks will have tracks removed. `NoteSequence`s with fewer tracks will be\n+ * padded with empty tracks.\n+ * @param stepsPerQuarter The number of time steps per quarter note.\n+ * @param totalSteps The length of each `NoteSequence` in time steps. Longer\n+ * `NoteSequence`s will be truncated. Shorter `NoteSequence`s will be padded\n+ * with silence.\n+ * @param numVelocityBins The number of bins into which to quantize note\n+ * velocities.\n+ */\n+export interface MultitrackConverterArgs extends BaseConverterArgs {\n+  stepsPerQuarter: number;\n+  totalSteps: number;\n+  numVelocityBins: number;\n+}\n+export class MultitrackConverter extends DataConverter {\n+  readonly NUM_SPLITS = 0;\n+\n+  readonly stepsPerQuarter: number;\n+  readonly totalSteps: number;\n+  readonly numVelocityBins: number;\n+\n+  readonly numPitches: number;\n+  readonly performanceEventDepth: number;\n+  readonly numPrograms: number;\n+  readonly depth: number;\n+\n+  constructor(args: MultitrackConverterArgs) {\n+    super(args);\n+\n+    this.stepsPerQuarter = args.stepsPerQuarter;\n+    this.totalSteps = args.totalSteps;\n+    this.numVelocityBins = args.numVelocityBins;\n+\n+    // Vocabulary:\n+    // note-on, note-off, time-shift, velocity-change, program-select, end-token\n+\n+    this.numPitches = constants.MAX_MIDI_PITCH - constants.MIN_MIDI_PITCH + 1;\n+    this.performanceEventDepth =\n+        2 * this.numPitches + this.totalSteps + this.numVelocityBins;\n+\n+    // Include an extra \"program\" for drums.\n+    this.numPrograms =\n+        constants.MAX_MIDI_PROGRAM - constants.MIN_MIDI_PROGRAM + 2;\n+    this.depth = this.performanceEventDepth + this.numPrograms + 1;","path":"music/src/core/data.ts","position":null,"original_position":106,"commit_id":"a4582dd4f6c0670461558d06e2730134ad5b19b7","original_commit_id":"4582843ae2e6b4372d70d26d510e6e7cb4e3b993","user":{"login":"iansimon","id":1361775,"avatar_url":"https://avatars2.githubusercontent.com/u/1361775?v=4","gravatar_id":"","url":"https://api.github.com/users/iansimon","html_url":"https://github.com/iansimon","followers_url":"https://api.github.com/users/iansimon/followers","following_url":"https://api.github.com/users/iansimon/following{/other_user}","gists_url":"https://api.github.com/users/iansimon/gists{/gist_id}","starred_url":"https://api.github.com/users/iansimon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iansimon/subscriptions","organizations_url":"https://api.github.com/users/iansimon/orgs","repos_url":"https://api.github.com/users/iansimon/repos","events_url":"https://api.github.com/users/iansimon/events{/privacy}","received_events_url":"https://api.github.com/users/iansimon/received_events","type":"User","site_admin":false},"body":"Used explicit endToken property.","created_at":"2018-05-04T22:05:47Z","updated_at":"2018-05-04T22:05:47Z","html_url":"https://github.com/tensorflow/magenta-js/pull/73#discussion_r186232203","pull_request_url":"https://api.github.com/repos/tensorflow/magenta-js/pulls/73","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/tensorflow/magenta-js/pulls/comments/186232203"},"html":{"href":"https://github.com/tensorflow/magenta-js/pull/73#discussion_r186232203"},"pull_request":{"href":"https://api.github.com/repos/tensorflow/magenta-js/pulls/73"}},"in_reply_to_id":186220052},"pull_request":{"url":"https://api.github.com/repos/tensorflow/magenta-js/pulls/73","id":185789792,"html_url":"https://github.com/tensorflow/magenta-js/pull/73","diff_url":"https://github.com/tensorflow/magenta-js/pull/73.diff","patch_url":"https://github.com/tensorflow/magenta-js/pull/73.patch","issue_url":"https://api.github.com/repos/tensorflow/magenta-js/issues/73","number":73,"state":"open","locked":false,"title":"add multitrack data converter","user":{"login":"iansimon","id":1361775,"avatar_url":"https://avatars2.githubusercontent.com/u/1361775?v=4","gravatar_id":"","url":"https://api.github.com/users/iansimon","html_url":"https://github.com/iansimon","followers_url":"https://api.github.com/users/iansimon/followers","following_url":"https://api.github.com/users/iansimon/following{/other_user}","gists_url":"https://api.github.com/users/iansimon/gists{/gist_id}","starred_url":"https://api.github.com/users/iansimon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iansimon/subscriptions","organizations_url":"https://api.github.com/users/iansimon/orgs","repos_url":"https://api.github.com/users/iansimon/repos","events_url":"https://api.github.com/users/iansimon/events{/privacy}","received_events_url":"https://api.github.com/users/iansimon/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-05-03T17:45:02Z","updated_at":"2018-05-04T22:05:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ec92b2a1f7d1a7c5d142ea86b106c7115c67e6b4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/tensorflow/magenta-js/pulls/73/commits","review_comments_url":"https://api.github.com/repos/tensorflow/magenta-js/pulls/73/comments","review_comment_url":"https://api.github.com/repos/tensorflow/magenta-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tensorflow/magenta-js/issues/73/comments","statuses_url":"https://api.github.com/repos/tensorflow/magenta-js/statuses/a4582dd4f6c0670461558d06e2730134ad5b19b7","head":{"label":"iansimon:multitrack_converter","ref":"multitrack_converter","sha":"a4582dd4f6c0670461558d06e2730134ad5b19b7","user":{"login":"iansimon","id":1361775,"avatar_url":"https://avatars2.githubusercontent.com/u/1361775?v=4","gravatar_id":"","url":"https://api.github.com/users/iansimon","html_url":"https://github.com/iansimon","followers_url":"https://api.github.com/users/iansimon/followers","following_url":"https://api.github.com/users/iansimon/following{/other_user}","gists_url":"https://api.github.com/users/iansimon/gists{/gist_id}","starred_url":"https://api.github.com/users/iansimon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iansimon/subscriptions","organizations_url":"https://api.github.com/users/iansimon/orgs","repos_url":"https://api.github.com/users/iansimon/repos","events_url":"https://api.github.com/users/iansimon/events{/privacy}","received_events_url":"https://api.github.com/users/iansimon/received_events","type":"User","site_admin":false},"repo":{"id":128421763,"name":"magenta-js","full_name":"iansimon/magenta-js","owner":{"login":"iansimon","id":1361775,"avatar_url":"https://avatars2.githubusercontent.com/u/1361775?v=4","gravatar_id":"","url":"https://api.github.com/users/iansimon","html_url":"https://github.com/iansimon","followers_url":"https://api.github.com/users/iansimon/followers","following_url":"https://api.github.com/users/iansimon/following{/other_user}","gists_url":"https://api.github.com/users/iansimon/gists{/gist_id}","starred_url":"https://api.github.com/users/iansimon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iansimon/subscriptions","organizations_url":"https://api.github.com/users/iansimon/orgs","repos_url":"https://api.github.com/users/iansimon/repos","events_url":"https://api.github.com/users/iansimon/events{/privacy}","received_events_url":"https://api.github.com/users/iansimon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/iansimon/magenta-js","description":"Magenta.js: Music and Art Generation with Machine Intelligence in the Browser","fork":true,"url":"https://api.github.com/repos/iansimon/magenta-js","forks_url":"https://api.github.com/repos/iansimon/magenta-js/forks","keys_url":"https://api.github.com/repos/iansimon/magenta-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iansimon/magenta-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iansimon/magenta-js/teams","hooks_url":"https://api.github.com/repos/iansimon/magenta-js/hooks","issue_events_url":"https://api.github.com/repos/iansimon/magenta-js/issues/events{/number}","events_url":"https://api.github.com/repos/iansimon/magenta-js/events","assignees_url":"https://api.github.com/repos/iansimon/magenta-js/assignees{/user}","branches_url":"https://api.github.com/repos/iansimon/magenta-js/branches{/branch}","tags_url":"https://api.github.com/repos/iansimon/magenta-js/tags","blobs_url":"https://api.github.com/repos/iansimon/magenta-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iansimon/magenta-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iansimon/magenta-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/iansimon/magenta-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iansimon/magenta-js/statuses/{sha}","languages_url":"https://api.github.com/repos/iansimon/magenta-js/languages","stargazers_url":"https://api.github.com/repos/iansimon/magenta-js/stargazers","contributors_url":"https://api.github.com/repos/iansimon/magenta-js/contributors","subscribers_url":"https://api.github.com/repos/iansimon/magenta-js/subscribers","subscription_url":"https://api.github.com/repos/iansimon/magenta-js/subscription","commits_url":"https://api.github.com/repos/iansimon/magenta-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/iansimon/magenta-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/iansimon/magenta-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/iansimon/magenta-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/iansimon/magenta-js/contents/{+path}","compare_url":"https://api.github.com/repos/iansimon/magenta-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iansimon/magenta-js/merges","archive_url":"https://api.github.com/repos/iansimon/magenta-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iansimon/magenta-js/downloads","issues_url":"https://api.github.com/repos/iansimon/magenta-js/issues{/number}","pulls_url":"https://api.github.com/repos/iansimon/magenta-js/pulls{/number}","milestones_url":"https://api.github.com/repos/iansimon/magenta-js/milestones{/number}","notifications_url":"https://api.github.com/repos/iansimon/magenta-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iansimon/magenta-js/labels{/name}","releases_url":"https://api.github.com/repos/iansimon/magenta-js/releases{/id}","deployments_url":"https://api.github.com/repos/iansimon/magenta-js/deployments","created_at":"2018-04-06T16:55:23Z","updated_at":"2018-05-04T18:35:44Z","pushed_at":"2018-05-04T22:04:57Z","git_url":"git://github.com/iansimon/magenta-js.git","ssh_url":"git@github.com:iansimon/magenta-js.git","clone_url":"https://github.com/iansimon/magenta-js.git","svn_url":"https://github.com/iansimon/magenta-js","homepage":"https://magenta.tensorflow.org","size":549,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tensorflow:master","ref":"master","sha":"a33ebf447bb8f85c5a64af66befc01bb18c678f6","user":{"login":"tensorflow","id":15658638,"avatar_url":"https://avatars1.githubusercontent.com/u/15658638?v=4","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":126883328,"name":"magenta-js","full_name":"tensorflow/magenta-js","owner":{"login":"tensorflow","id":15658638,"avatar_url":"https://avatars1.githubusercontent.com/u/15658638?v=4","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-js","description":"Magenta.js: Music and Art Generation with Machine Intelligence in the Browser","fork":false,"url":"https://api.github.com/repos/tensorflow/magenta-js","forks_url":"https://api.github.com/repos/tensorflow/magenta-js/forks","keys_url":"https://api.github.com/repos/tensorflow/magenta-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tensorflow/magenta-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tensorflow/magenta-js/teams","hooks_url":"https://api.github.com/repos/tensorflow/magenta-js/hooks","issue_events_url":"https://api.github.com/repos/tensorflow/magenta-js/issues/events{/number}","events_url":"https://api.github.com/repos/tensorflow/magenta-js/events","assignees_url":"https://api.github.com/repos/tensorflow/magenta-js/assignees{/user}","branches_url":"https://api.github.com/repos/tensorflow/magenta-js/branches{/branch}","tags_url":"https://api.github.com/repos/tensorflow/magenta-js/tags","blobs_url":"https://api.github.com/repos/tensorflow/magenta-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tensorflow/magenta-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tensorflow/magenta-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/tensorflow/magenta-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tensorflow/magenta-js/statuses/{sha}","languages_url":"https://api.github.com/repos/tensorflow/magenta-js/languages","stargazers_url":"https://api.github.com/repos/tensorflow/magenta-js/stargazers","contributors_url":"https://api.github.com/repos/tensorflow/magenta-js/contributors","subscribers_url":"https://api.github.com/repos/tensorflow/magenta-js/subscribers","subscription_url":"https://api.github.com/repos/tensorflow/magenta-js/subscription","commits_url":"https://api.github.com/repos/tensorflow/magenta-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/tensorflow/magenta-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/tensorflow/magenta-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/tensorflow/magenta-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/tensorflow/magenta-js/contents/{+path}","compare_url":"https://api.github.com/repos/tensorflow/magenta-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tensorflow/magenta-js/merges","archive_url":"https://api.github.com/repos/tensorflow/magenta-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tensorflow/magenta-js/downloads","issues_url":"https://api.github.com/repos/tensorflow/magenta-js/issues{/number}","pulls_url":"https://api.github.com/repos/tensorflow/magenta-js/pulls{/number}","milestones_url":"https://api.github.com/repos/tensorflow/magenta-js/milestones{/number}","notifications_url":"https://api.github.com/repos/tensorflow/magenta-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tensorflow/magenta-js/labels{/name}","releases_url":"https://api.github.com/repos/tensorflow/magenta-js/releases{/id}","deployments_url":"https://api.github.com/repos/tensorflow/magenta-js/deployments","created_at":"2018-03-26T20:02:28Z","updated_at":"2018-05-04T14:58:34Z","pushed_at":"2018-05-04T22:04:28Z","git_url":"git://github.com/tensorflow/magenta-js.git","ssh_url":"git@github.com:tensorflow/magenta-js.git","clone_url":"https://github.com/tensorflow/magenta-js.git","svn_url":"https://github.com/tensorflow/magenta-js","homepage":"https://magenta.tensorflow.org","size":556,"stargazers_count":78,"watchers_count":78,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":8,"open_issues":4,"watchers":78,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tensorflow/magenta-js/pulls/73"},"html":{"href":"https://github.com/tensorflow/magenta-js/pull/73"},"issue":{"href":"https://api.github.com/repos/tensorflow/magenta-js/issues/73"},"comments":{"href":"https://api.github.com/repos/tensorflow/magenta-js/issues/73/comments"},"review_comments":{"href":"https://api.github.com/repos/tensorflow/magenta-js/pulls/73/comments"},"review_comment":{"href":"https://api.github.com/repos/tensorflow/magenta-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tensorflow/magenta-js/pulls/73/commits"},"statuses":{"href":"https://api.github.com/repos/tensorflow/magenta-js/statuses/a4582dd4f6c0670461558d06e2730134ad5b19b7"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"iansimon"}}