{"action":"created","comment":{"url":"https://api.github.com/repos/pegahgh/kaldi/pulls/comments/90272716","pull_request_review_id":10794187,"id":90272716,"diff_hunk":"@@ -73,16 +73,71 @@ void ApplyPerturbation(XvectorPerturbOptions opts,\n   }\n   // Perturb speed of signal egs\n   Matrix<BaseFloat> warped_distorted_shifted_egs(rand_distort_shifted_egs);\n-  if (opts.max_time_stretch != 0.0) \n-    perturb_xvector.TimeStretch(rand_distort_shifted_egs, \n-                                &warped_distorted_shifted_egs);\n+  ////if (opts.max_time_stretch != 0.0) \n+  ////  perturb_xvector.TimeStretch(rand_distort_shifted_egs, \n+  ////                              &warped_distorted_shifted_egs);\n    \n   // If nagation is true, the sample values are randomly negated\n   // with some probability.\n-  if (opts.negation) {\n+  ////if (opts.negation) {\n    \n+  ////}\n+}\n+\n+// add\n+// This function add the noise to the orginial signal. We should not normalize \n+// the signal level of the orginial signal. According to SNR, we rescale the noise\n+// and add it. So that the perturbed signal is created. \n+void ApplyAddAdditiveNoise(const int32 &SNR,\n+                           const Matrix<BaseFloat> &input_eg,\n+                           const Matrix<BaseFloat> &noise_eg,\n+                           Matrix<BaseFloat> *perturb_eg) {\n+  // In the version, we ask the noise_cols >= input_cols. If mfcc, the cols are equal.\n+  // If raw data, we ask the noise_cols > input_cols.\n+  int32 input_rows = input_eg.NumRows(), input_cols = input_eg.NumCols();  \n+  KALDI_ASSERT(noise_eg.NumCols() >= input_cols);\n+\n+  // According to the rows of noise_eg, form the noise_mat\n+  // repeat the noise_eg blocks to have a new block which is longer than input_eg\n+  Matrix<BaseFloat> noise_mat;\n+  if (noise_eg.NumRows() < input_rows) {\n+    int32 repeat_times = (input_rows / noise_eg.NumRows()) + 1;\n+    noise_mat.Resize(noise_eg.NumRows() * repeat_times, noise_eg.NumCols());\n+    for (int32 i = 0; i < repeat_times; ++i) {\n+      noise_mat.Range(i*noise_eg.NumRows(), noise_eg.NumRows(), \n+                      0, noise_eg.NumCols()).CopyFromMat(noise_eg);\n+    }\n+  } else {\n+    noise_mat.Resize(noise_eg.NumRows(), noise_eg.NumCols());\n+    noise_mat.CopyFromMat(noise_eg);\n   }\n+\n+  // select the noise range\n+  int32 noise_rows = noise_mat.NumRows(), noise_cols = noise_mat.NumCols();\n+  int32 start_row_ind = RandInt(0, noise_rows - input_rows),\n+        start_col_ind = RandInt(0, noise_cols - input_cols); \n+  Matrix<BaseFloat> selected_noise_mat(input_rows, input_cols);\n+  selected_noise_mat.AddMat(1.0, noise_mat.Range(start_row_ind, input_rows,\n+                                                  start_col_ind, input_cols));\n+  // compute the energy of noise and input\n+  Matrix<BaseFloat> input_energy_mat(input_rows, input_cols);\n+  input_energy_mat.AddMatMatElements(1.0, input_eg, input_eg, 1.0);","path":"src/xvectorbin/nnet3-xvector-signal-perturb-egs.cc","position":null,"original_position":67,"commit_id":"0e73c48793276ab25ed80317541ffb48b57ada08","original_commit_id":"6bd441bee2a0c1e2f9ee7426db06c069b7531123","user":{"login":"pegahgh","id":9408436,"avatar_url":"https://avatars.githubusercontent.com/u/9408436?v=3","gravatar_id":"","url":"https://api.github.com/users/pegahgh","html_url":"https://github.com/pegahgh","followers_url":"https://api.github.com/users/pegahgh/followers","following_url":"https://api.github.com/users/pegahgh/following{/other_user}","gists_url":"https://api.github.com/users/pegahgh/gists{/gist_id}","starred_url":"https://api.github.com/users/pegahgh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pegahgh/subscriptions","organizations_url":"https://api.github.com/users/pegahgh/orgs","repos_url":"https://api.github.com/users/pegahgh/repos","events_url":"https://api.github.com/users/pegahgh/events{/privacy}","received_events_url":"https://api.github.com/users/pegahgh/received_events","type":"User","site_admin":false},"body":"Although input_energy_mat initialized with zero, it should be AddMatMatElements(1.0, input_eg, input_eg, 0.0), ","created_at":"2016-11-30T16:40:35Z","updated_at":"2016-11-30T16:40:35Z","html_url":"https://github.com/pegahgh/kaldi/pull/10#discussion_r90272716","pull_request_url":"https://api.github.com/repos/pegahgh/kaldi/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/pegahgh/kaldi/pulls/comments/90272716"},"html":{"href":"https://github.com/pegahgh/kaldi/pull/10#discussion_r90272716"},"pull_request":{"href":"https://api.github.com/repos/pegahgh/kaldi/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/pegahgh/kaldi/pulls/10","id":95639167,"html_url":"https://github.com/pegahgh/kaldi/pull/10","diff_url":"https://github.com/pegahgh/kaldi/pull/10.diff","patch_url":"https://github.com/pegahgh/kaldi/pull/10.patch","issue_url":"https://api.github.com/repos/pegahgh/kaldi/issues/10","number":10,"state":"open","locked":false,"title":"add a function--ApplyAddAdditiveNoise","user":{"login":"LvHang","id":20529568,"avatar_url":"https://avatars.githubusercontent.com/u/20529568?v=3","gravatar_id":"","url":"https://api.github.com/users/LvHang","html_url":"https://github.com/LvHang","followers_url":"https://api.github.com/users/LvHang/followers","following_url":"https://api.github.com/users/LvHang/following{/other_user}","gists_url":"https://api.github.com/users/LvHang/gists{/gist_id}","starred_url":"https://api.github.com/users/LvHang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LvHang/subscriptions","organizations_url":"https://api.github.com/users/LvHang/orgs","repos_url":"https://api.github.com/users/LvHang/repos","events_url":"https://api.github.com/users/LvHang/events{/privacy}","received_events_url":"https://api.github.com/users/LvHang/received_events","type":"User","site_admin":false},"body":"@pegahgh \r\nHi Pegah,\r\nI have already finished the function about add additive noise with the option \"--add-noise\".\r\nPlease check it.\r\nThank you for your guidance.\r\n\r\nHang","created_at":"2016-11-29T07:26:25Z","updated_at":"2016-11-30T16:40:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dcc6b5750ef5c0d34604daa9f8c34c73757c2157","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/pegahgh/kaldi/pulls/10/commits","review_comments_url":"https://api.github.com/repos/pegahgh/kaldi/pulls/10/comments","review_comment_url":"https://api.github.com/repos/pegahgh/kaldi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pegahgh/kaldi/issues/10/comments","statuses_url":"https://api.github.com/repos/pegahgh/kaldi/statuses/0e73c48793276ab25ed80317541ffb48b57ada08","head":{"label":"LvHang:xvector-feat-extraction","ref":"xvector-feat-extraction","sha":"0e73c48793276ab25ed80317541ffb48b57ada08","user":{"login":"LvHang","id":20529568,"avatar_url":"https://avatars.githubusercontent.com/u/20529568?v=3","gravatar_id":"","url":"https://api.github.com/users/LvHang","html_url":"https://github.com/LvHang","followers_url":"https://api.github.com/users/LvHang/followers","following_url":"https://api.github.com/users/LvHang/following{/other_user}","gists_url":"https://api.github.com/users/LvHang/gists{/gist_id}","starred_url":"https://api.github.com/users/LvHang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LvHang/subscriptions","organizations_url":"https://api.github.com/users/LvHang/orgs","repos_url":"https://api.github.com/users/LvHang/repos","events_url":"https://api.github.com/users/LvHang/events{/privacy}","received_events_url":"https://api.github.com/users/LvHang/received_events","type":"User","site_admin":false},"repo":{"id":64478877,"name":"kaldi","full_name":"LvHang/kaldi","owner":{"login":"LvHang","id":20529568,"avatar_url":"https://avatars.githubusercontent.com/u/20529568?v=3","gravatar_id":"","url":"https://api.github.com/users/LvHang","html_url":"https://github.com/LvHang","followers_url":"https://api.github.com/users/LvHang/followers","following_url":"https://api.github.com/users/LvHang/following{/other_user}","gists_url":"https://api.github.com/users/LvHang/gists{/gist_id}","starred_url":"https://api.github.com/users/LvHang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LvHang/subscriptions","organizations_url":"https://api.github.com/users/LvHang/orgs","repos_url":"https://api.github.com/users/LvHang/repos","events_url":"https://api.github.com/users/LvHang/events{/privacy}","received_events_url":"https://api.github.com/users/LvHang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/LvHang/kaldi","description":"This is now the official location of the Kaldi project.","fork":true,"url":"https://api.github.com/repos/LvHang/kaldi","forks_url":"https://api.github.com/repos/LvHang/kaldi/forks","keys_url":"https://api.github.com/repos/LvHang/kaldi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LvHang/kaldi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LvHang/kaldi/teams","hooks_url":"https://api.github.com/repos/LvHang/kaldi/hooks","issue_events_url":"https://api.github.com/repos/LvHang/kaldi/issues/events{/number}","events_url":"https://api.github.com/repos/LvHang/kaldi/events","assignees_url":"https://api.github.com/repos/LvHang/kaldi/assignees{/user}","branches_url":"https://api.github.com/repos/LvHang/kaldi/branches{/branch}","tags_url":"https://api.github.com/repos/LvHang/kaldi/tags","blobs_url":"https://api.github.com/repos/LvHang/kaldi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LvHang/kaldi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LvHang/kaldi/git/refs{/sha}","trees_url":"https://api.github.com/repos/LvHang/kaldi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LvHang/kaldi/statuses/{sha}","languages_url":"https://api.github.com/repos/LvHang/kaldi/languages","stargazers_url":"https://api.github.com/repos/LvHang/kaldi/stargazers","contributors_url":"https://api.github.com/repos/LvHang/kaldi/contributors","subscribers_url":"https://api.github.com/repos/LvHang/kaldi/subscribers","subscription_url":"https://api.github.com/repos/LvHang/kaldi/subscription","commits_url":"https://api.github.com/repos/LvHang/kaldi/commits{/sha}","git_commits_url":"https://api.github.com/repos/LvHang/kaldi/git/commits{/sha}","comments_url":"https://api.github.com/repos/LvHang/kaldi/comments{/number}","issue_comment_url":"https://api.github.com/repos/LvHang/kaldi/issues/comments{/number}","contents_url":"https://api.github.com/repos/LvHang/kaldi/contents/{+path}","compare_url":"https://api.github.com/repos/LvHang/kaldi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LvHang/kaldi/merges","archive_url":"https://api.github.com/repos/LvHang/kaldi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LvHang/kaldi/downloads","issues_url":"https://api.github.com/repos/LvHang/kaldi/issues{/number}","pulls_url":"https://api.github.com/repos/LvHang/kaldi/pulls{/number}","milestones_url":"https://api.github.com/repos/LvHang/kaldi/milestones{/number}","notifications_url":"https://api.github.com/repos/LvHang/kaldi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LvHang/kaldi/labels{/name}","releases_url":"https://api.github.com/repos/LvHang/kaldi/releases{/id}","deployments_url":"https://api.github.com/repos/LvHang/kaldi/deployments","created_at":"2016-07-29T12:30:02Z","updated_at":"2016-07-29T12:30:14Z","pushed_at":"2016-11-29T22:10:16Z","git_url":"git://github.com/LvHang/kaldi.git","ssh_url":"git@github.com:LvHang/kaldi.git","clone_url":"https://github.com/LvHang/kaldi.git","svn_url":"https://github.com/LvHang/kaldi","homepage":"http://kaldi-asr.org","size":103916,"stargazers_count":0,"watchers_count":0,"language":"C++","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":"pegahgh:xvector-feat-extraction","ref":"xvector-feat-extraction","sha":"98839b1247c777f4ee477546e741ed8c97432ee5","user":{"login":"pegahgh","id":9408436,"avatar_url":"https://avatars.githubusercontent.com/u/9408436?v=3","gravatar_id":"","url":"https://api.github.com/users/pegahgh","html_url":"https://github.com/pegahgh","followers_url":"https://api.github.com/users/pegahgh/followers","following_url":"https://api.github.com/users/pegahgh/following{/other_user}","gists_url":"https://api.github.com/users/pegahgh/gists{/gist_id}","starred_url":"https://api.github.com/users/pegahgh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pegahgh/subscriptions","organizations_url":"https://api.github.com/users/pegahgh/orgs","repos_url":"https://api.github.com/users/pegahgh/repos","events_url":"https://api.github.com/users/pegahgh/events{/privacy}","received_events_url":"https://api.github.com/users/pegahgh/received_events","type":"User","site_admin":false},"repo":{"id":41936200,"name":"kaldi","full_name":"pegahgh/kaldi","owner":{"login":"pegahgh","id":9408436,"avatar_url":"https://avatars.githubusercontent.com/u/9408436?v=3","gravatar_id":"","url":"https://api.github.com/users/pegahgh","html_url":"https://github.com/pegahgh","followers_url":"https://api.github.com/users/pegahgh/followers","following_url":"https://api.github.com/users/pegahgh/following{/other_user}","gists_url":"https://api.github.com/users/pegahgh/gists{/gist_id}","starred_url":"https://api.github.com/users/pegahgh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pegahgh/subscriptions","organizations_url":"https://api.github.com/users/pegahgh/orgs","repos_url":"https://api.github.com/users/pegahgh/repos","events_url":"https://api.github.com/users/pegahgh/events{/privacy}","received_events_url":"https://api.github.com/users/pegahgh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pegahgh/kaldi","description":"This is now the official location of the Kaldi project.","fork":true,"url":"https://api.github.com/repos/pegahgh/kaldi","forks_url":"https://api.github.com/repos/pegahgh/kaldi/forks","keys_url":"https://api.github.com/repos/pegahgh/kaldi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pegahgh/kaldi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pegahgh/kaldi/teams","hooks_url":"https://api.github.com/repos/pegahgh/kaldi/hooks","issue_events_url":"https://api.github.com/repos/pegahgh/kaldi/issues/events{/number}","events_url":"https://api.github.com/repos/pegahgh/kaldi/events","assignees_url":"https://api.github.com/repos/pegahgh/kaldi/assignees{/user}","branches_url":"https://api.github.com/repos/pegahgh/kaldi/branches{/branch}","tags_url":"https://api.github.com/repos/pegahgh/kaldi/tags","blobs_url":"https://api.github.com/repos/pegahgh/kaldi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pegahgh/kaldi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pegahgh/kaldi/git/refs{/sha}","trees_url":"https://api.github.com/repos/pegahgh/kaldi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pegahgh/kaldi/statuses/{sha}","languages_url":"https://api.github.com/repos/pegahgh/kaldi/languages","stargazers_url":"https://api.github.com/repos/pegahgh/kaldi/stargazers","contributors_url":"https://api.github.com/repos/pegahgh/kaldi/contributors","subscribers_url":"https://api.github.com/repos/pegahgh/kaldi/subscribers","subscription_url":"https://api.github.com/repos/pegahgh/kaldi/subscription","commits_url":"https://api.github.com/repos/pegahgh/kaldi/commits{/sha}","git_commits_url":"https://api.github.com/repos/pegahgh/kaldi/git/commits{/sha}","comments_url":"https://api.github.com/repos/pegahgh/kaldi/comments{/number}","issue_comment_url":"https://api.github.com/repos/pegahgh/kaldi/issues/comments{/number}","contents_url":"https://api.github.com/repos/pegahgh/kaldi/contents/{+path}","compare_url":"https://api.github.com/repos/pegahgh/kaldi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pegahgh/kaldi/merges","archive_url":"https://api.github.com/repos/pegahgh/kaldi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pegahgh/kaldi/downloads","issues_url":"https://api.github.com/repos/pegahgh/kaldi/issues{/number}","pulls_url":"https://api.github.com/repos/pegahgh/kaldi/pulls{/number}","milestones_url":"https://api.github.com/repos/pegahgh/kaldi/milestones{/number}","notifications_url":"https://api.github.com/repos/pegahgh/kaldi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pegahgh/kaldi/labels{/name}","releases_url":"https://api.github.com/repos/pegahgh/kaldi/releases{/id}","deployments_url":"https://api.github.com/repos/pegahgh/kaldi/deployments","created_at":"2015-09-04T20:23:40Z","updated_at":"2016-09-02T21:39:13Z","pushed_at":"2016-11-29T22:10:17Z","git_url":"git://github.com/pegahgh/kaldi.git","ssh_url":"git@github.com:pegahgh/kaldi.git","clone_url":"https://github.com/pegahgh/kaldi.git","svn_url":"https://github.com/pegahgh/kaldi","homepage":"http://kaldi-asr.org","size":105826,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pegahgh/kaldi/pulls/10"},"html":{"href":"https://github.com/pegahgh/kaldi/pull/10"},"issue":{"href":"https://api.github.com/repos/pegahgh/kaldi/issues/10"},"comments":{"href":"https://api.github.com/repos/pegahgh/kaldi/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/pegahgh/kaldi/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/pegahgh/kaldi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pegahgh/kaldi/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/pegahgh/kaldi/statuses/0e73c48793276ab25ed80317541ffb48b57ada08"}}}}
{"actor":{"display_login":"pegahgh"}}