{"action":"created","comment":{"url":"https://api.github.com/repos/BirdVox/PCEN-SNR/pulls/comments/230566957","pull_request_review_id":171340396,"id":230566957,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMDU2Njk1Nw==","diff_hunk":"@@ -0,0 +1,37 @@\n+from scipy import signal\n+# input : y - the signal, sr - sample rate\n+# output : start_times - vector of start times of the sound events\n+#          end_time - vector of end times of the sound events            \n+def detect_activity(y, sr,\n+        n_mels=128, fmin=1000, fmax=11025, hop_length=512,\n+        gain=0.8, bias=10, power=0.25, pcen_time_constant=0.06, eps=1e-06,\n+        medfilt_time_constant=1, normalized =true,\n+        peak_threshold=0.45, activity_threshold=0.2):\n+    # 1. compute mel-frequency spectrogram\n+    # (call librosa melspec)\n+    melspec = librosa.feature.melspectrogram(y, sr=sr, fmin=fmin, fmax=fmax, n_mels=n_mels)\n+    logmelspec = librosa.power_to_db(melspec)\n+    \n+    # 2. compute PCEN\n+    # (call librosa PCEN)\n+    pcen = librosa.core.pcen(melspec, sr=sr,\n+    gain=gain, bias=bias, power=power, time_constant=pcen_time_constant, eps=eps)\n+    \n+    # 3. compute PCEN-SNR detection function\n+    # (copy-paste from Vincent's notebook)\n+    pcen_snr = np.max(pcen,axis=0) - np.min(pcen,axis=0)\n+    pcen_snr = librosa.power_to_db(pcen_snr / np.median(pcen_snr))\n+    if normalized == true:","path":"notebooks/VAD","position":24,"original_position":24,"commit_id":"1ac1248e8693184b5aea16f4af5833d51dc9eb5f","original_commit_id":"1ac1248e8693184b5aea16f4af5833d51dc9eb5f","user":{"login":"lostanlen","id":3943142,"node_id":"MDQ6VXNlcjM5NDMxNDI=","avatar_url":"https://avatars1.githubusercontent.com/u/3943142?v=4","gravatar_id":"","url":"https://api.github.com/users/lostanlen","html_url":"https://github.com/lostanlen","followers_url":"https://api.github.com/users/lostanlen/followers","following_url":"https://api.github.com/users/lostanlen/following{/other_user}","gists_url":"https://api.github.com/users/lostanlen/gists{/gist_id}","starred_url":"https://api.github.com/users/lostanlen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lostanlen/subscriptions","organizations_url":"https://api.github.com/users/lostanlen/orgs","repos_url":"https://api.github.com/users/lostanlen/repos","events_url":"https://api.github.com/users/lostanlen/events{/privacy}","received_events_url":"https://api.github.com/users/lostanlen/received_events","type":"User","site_admin":false},"body":"you can simplify this to just `if normalized:`","created_at":"2018-11-03T20:26:19Z","updated_at":"2018-11-03T20:30:12Z","html_url":"https://github.com/BirdVox/PCEN-SNR/pull/1#discussion_r230566957","pull_request_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/pulls/1","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/BirdVox/PCEN-SNR/pulls/comments/230566957"},"html":{"href":"https://github.com/BirdVox/PCEN-SNR/pull/1#discussion_r230566957"},"pull_request":{"href":"https://api.github.com/repos/BirdVox/PCEN-SNR/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/BirdVox/PCEN-SNR/pulls/1","id":228098861,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI4MDk4ODYx","html_url":"https://github.com/BirdVox/PCEN-SNR/pull/1","diff_url":"https://github.com/BirdVox/PCEN-SNR/pull/1.diff","patch_url":"https://github.com/BirdVox/PCEN-SNR/pull/1.patch","issue_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/issues/1","number":1,"state":"open","locked":false,"title":"Implement voice activity detection","user":{"login":"natalieyhw","id":43254704,"node_id":"MDQ6VXNlcjQzMjU0NzA0","avatar_url":"https://avatars0.githubusercontent.com/u/43254704?v=4","gravatar_id":"","url":"https://api.github.com/users/natalieyhw","html_url":"https://github.com/natalieyhw","followers_url":"https://api.github.com/users/natalieyhw/followers","following_url":"https://api.github.com/users/natalieyhw/following{/other_user}","gists_url":"https://api.github.com/users/natalieyhw/gists{/gist_id}","starred_url":"https://api.github.com/users/natalieyhw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natalieyhw/subscriptions","organizations_url":"https://api.github.com/users/natalieyhw/orgs","repos_url":"https://api.github.com/users/natalieyhw/repos","events_url":"https://api.github.com/users/natalieyhw/events{/privacy}","received_events_url":"https://api.github.com/users/natalieyhw/received_events","type":"User","site_admin":false},"body":"I have tested it so it should work right! Let me know if you find something wrong.","created_at":"2018-11-03T04:26:58Z","updated_at":"2018-11-03T20:30:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4078c7c26283268538edd2138997d571afd87615","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/pulls/1/commits","review_comments_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/pulls/1/comments","review_comment_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/issues/1/comments","statuses_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/statuses/1ac1248e8693184b5aea16f4af5833d51dc9eb5f","head":{"label":"natalieyhw:patch-2","ref":"patch-2","sha":"1ac1248e8693184b5aea16f4af5833d51dc9eb5f","user":{"login":"natalieyhw","id":43254704,"node_id":"MDQ6VXNlcjQzMjU0NzA0","avatar_url":"https://avatars0.githubusercontent.com/u/43254704?v=4","gravatar_id":"","url":"https://api.github.com/users/natalieyhw","html_url":"https://github.com/natalieyhw","followers_url":"https://api.github.com/users/natalieyhw/followers","following_url":"https://api.github.com/users/natalieyhw/following{/other_user}","gists_url":"https://api.github.com/users/natalieyhw/gists{/gist_id}","starred_url":"https://api.github.com/users/natalieyhw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natalieyhw/subscriptions","organizations_url":"https://api.github.com/users/natalieyhw/orgs","repos_url":"https://api.github.com/users/natalieyhw/repos","events_url":"https://api.github.com/users/natalieyhw/events{/privacy}","received_events_url":"https://api.github.com/users/natalieyhw/received_events","type":"User","site_admin":false},"repo":{"id":154596103,"node_id":"MDEwOlJlcG9zaXRvcnkxNTQ1OTYxMDM=","name":"PCEN-SNR","full_name":"natalieyhw/PCEN-SNR","private":false,"owner":{"login":"natalieyhw","id":43254704,"node_id":"MDQ6VXNlcjQzMjU0NzA0","avatar_url":"https://avatars0.githubusercontent.com/u/43254704?v=4","gravatar_id":"","url":"https://api.github.com/users/natalieyhw","html_url":"https://github.com/natalieyhw","followers_url":"https://api.github.com/users/natalieyhw/followers","following_url":"https://api.github.com/users/natalieyhw/following{/other_user}","gists_url":"https://api.github.com/users/natalieyhw/gists{/gist_id}","starred_url":"https://api.github.com/users/natalieyhw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natalieyhw/subscriptions","organizations_url":"https://api.github.com/users/natalieyhw/orgs","repos_url":"https://api.github.com/users/natalieyhw/repos","events_url":"https://api.github.com/users/natalieyhw/events{/privacy}","received_events_url":"https://api.github.com/users/natalieyhw/received_events","type":"User","site_admin":false},"html_url":"https://github.com/natalieyhw/PCEN-SNR","description":"Bird audio detection with PCEN-SNR","fork":true,"url":"https://api.github.com/repos/natalieyhw/PCEN-SNR","forks_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/forks","keys_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/keys{/key_id}","collaborators_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/teams","hooks_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/hooks","issue_events_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/issues/events{/number}","events_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/events","assignees_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/assignees{/user}","branches_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/branches{/branch}","tags_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/tags","blobs_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/git/refs{/sha}","trees_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/git/trees{/sha}","statuses_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/statuses/{sha}","languages_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/languages","stargazers_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/stargazers","contributors_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/contributors","subscribers_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/subscribers","subscription_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/subscription","commits_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/commits{/sha}","git_commits_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/git/commits{/sha}","comments_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/comments{/number}","issue_comment_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/issues/comments{/number}","contents_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/contents/{+path}","compare_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/compare/{base}...{head}","merges_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/merges","archive_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/downloads","issues_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/issues{/number}","pulls_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/pulls{/number}","milestones_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/milestones{/number}","notifications_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/labels{/name}","releases_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/releases{/id}","deployments_url":"https://api.github.com/repos/natalieyhw/PCEN-SNR/deployments","created_at":"2018-10-25T02:09:08Z","updated_at":"2018-10-25T02:09:10Z","pushed_at":"2018-11-03T04:26:47Z","git_url":"git://github.com/natalieyhw/PCEN-SNR.git","ssh_url":"git@github.com:natalieyhw/PCEN-SNR.git","clone_url":"https://github.com/natalieyhw/PCEN-SNR.git","svn_url":"https://github.com/natalieyhw/PCEN-SNR","homepage":null,"size":3238,"stargazers_count":0,"watchers_count":0,"language":"Jupyter Notebook","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"BirdVox:master","ref":"master","sha":"4e711e6edf3133976e946f44a0f19449cb9413b1","user":{"login":"BirdVox","id":25643193,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1NjQzMTkz","avatar_url":"https://avatars1.githubusercontent.com/u/25643193?v=4","gravatar_id":"","url":"https://api.github.com/users/BirdVox","html_url":"https://github.com/BirdVox","followers_url":"https://api.github.com/users/BirdVox/followers","following_url":"https://api.github.com/users/BirdVox/following{/other_user}","gists_url":"https://api.github.com/users/BirdVox/gists{/gist_id}","starred_url":"https://api.github.com/users/BirdVox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BirdVox/subscriptions","organizations_url":"https://api.github.com/users/BirdVox/orgs","repos_url":"https://api.github.com/users/BirdVox/repos","events_url":"https://api.github.com/users/BirdVox/events{/privacy}","received_events_url":"https://api.github.com/users/BirdVox/received_events","type":"Organization","site_admin":false},"repo":{"id":152309513,"node_id":"MDEwOlJlcG9zaXRvcnkxNTIzMDk1MTM=","name":"PCEN-SNR","full_name":"BirdVox/PCEN-SNR","private":false,"owner":{"login":"BirdVox","id":25643193,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1NjQzMTkz","avatar_url":"https://avatars1.githubusercontent.com/u/25643193?v=4","gravatar_id":"","url":"https://api.github.com/users/BirdVox","html_url":"https://github.com/BirdVox","followers_url":"https://api.github.com/users/BirdVox/followers","following_url":"https://api.github.com/users/BirdVox/following{/other_user}","gists_url":"https://api.github.com/users/BirdVox/gists{/gist_id}","starred_url":"https://api.github.com/users/BirdVox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BirdVox/subscriptions","organizations_url":"https://api.github.com/users/BirdVox/orgs","repos_url":"https://api.github.com/users/BirdVox/repos","events_url":"https://api.github.com/users/BirdVox/events{/privacy}","received_events_url":"https://api.github.com/users/BirdVox/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/BirdVox/PCEN-SNR","description":"Bird audio detection with PCEN-SNR","fork":false,"url":"https://api.github.com/repos/BirdVox/PCEN-SNR","forks_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/forks","keys_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/teams","hooks_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/hooks","issue_events_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/issues/events{/number}","events_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/events","assignees_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/assignees{/user}","branches_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/branches{/branch}","tags_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/tags","blobs_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/git/refs{/sha}","trees_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/statuses/{sha}","languages_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/languages","stargazers_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/stargazers","contributors_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/contributors","subscribers_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/subscribers","subscription_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/subscription","commits_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/commits{/sha}","git_commits_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/git/commits{/sha}","comments_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/comments{/number}","issue_comment_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/issues/comments{/number}","contents_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/contents/{+path}","compare_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/merges","archive_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/downloads","issues_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/issues{/number}","pulls_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/pulls{/number}","milestones_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/milestones{/number}","notifications_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/labels{/name}","releases_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/releases{/id}","deployments_url":"https://api.github.com/repos/BirdVox/PCEN-SNR/deployments","created_at":"2018-10-09T19:31:08Z","updated_at":"2018-10-12T22:22:21Z","pushed_at":"2018-11-03T04:26:59Z","git_url":"git://github.com/BirdVox/PCEN-SNR.git","ssh_url":"git@github.com:BirdVox/PCEN-SNR.git","clone_url":"https://github.com/BirdVox/PCEN-SNR.git","svn_url":"https://github.com/BirdVox/PCEN-SNR","homepage":null,"size":3234,"stargazers_count":0,"watchers_count":0,"language":"Jupyter Notebook","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":2,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BirdVox/PCEN-SNR/pulls/1"},"html":{"href":"https://github.com/BirdVox/PCEN-SNR/pull/1"},"issue":{"href":"https://api.github.com/repos/BirdVox/PCEN-SNR/issues/1"},"comments":{"href":"https://api.github.com/repos/BirdVox/PCEN-SNR/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/BirdVox/PCEN-SNR/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/BirdVox/PCEN-SNR/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BirdVox/PCEN-SNR/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/BirdVox/PCEN-SNR/statuses/1ac1248e8693184b5aea16f4af5833d51dc9eb5f"}},"author_association":"NONE"}}
{"actor":{"display_login":"lostanlen"}}