{"action":"created","issue":{"url":"https://api.github.com/repos/bmcfee/librosa/issues/151","labels_url":"https://api.github.com/repos/bmcfee/librosa/issues/151/labels{/name}","comments_url":"https://api.github.com/repos/bmcfee/librosa/issues/151/comments","events_url":"https://api.github.com/repos/bmcfee/librosa/issues/151/events","html_url":"https://github.com/bmcfee/librosa/issues/151","id":54928949,"number":151,"title":"errors in estimate_tuning","user":{"login":"bmcfee","id":1190540,"avatar_url":"https://avatars.githubusercontent.com/u/1190540?v=3","gravatar_id":"","url":"https://api.github.com/users/bmcfee","html_url":"https://github.com/bmcfee","followers_url":"https://api.github.com/users/bmcfee/followers","following_url":"https://api.github.com/users/bmcfee/following{/other_user}","gists_url":"https://api.github.com/users/bmcfee/gists{/gist_id}","starred_url":"https://api.github.com/users/bmcfee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmcfee/subscriptions","organizations_url":"https://api.github.com/users/bmcfee/orgs","repos_url":"https://api.github.com/users/bmcfee/repos","events_url":"https://api.github.com/users/bmcfee/events{/privacy}","received_events_url":"https://api.github.com/users/bmcfee/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bmcfee/librosa/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"craffel","id":417568,"avatar_url":"https://avatars.githubusercontent.com/u/417568?v=3","gravatar_id":"","url":"https://api.github.com/users/craffel","html_url":"https://github.com/craffel","followers_url":"https://api.github.com/users/craffel/followers","following_url":"https://api.github.com/users/craffel/following{/other_user}","gists_url":"https://api.github.com/users/craffel/gists{/gist_id}","starred_url":"https://api.github.com/users/craffel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craffel/subscriptions","organizations_url":"https://api.github.com/users/craffel/orgs","repos_url":"https://api.github.com/users/craffel/repos","events_url":"https://api.github.com/users/craffel/events{/privacy}","received_events_url":"https://api.github.com/users/craffel/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/bmcfee/librosa/milestones/5","labels_url":"https://api.github.com/repos/bmcfee/librosa/milestones/5/labels","id":665904,"number":5,"title":"0.4","description":"","creator":{"login":"bmcfee","id":1190540,"avatar_url":"https://avatars.githubusercontent.com/u/1190540?v=3","gravatar_id":"","url":"https://api.github.com/users/bmcfee","html_url":"https://github.com/bmcfee","followers_url":"https://api.github.com/users/bmcfee/followers","following_url":"https://api.github.com/users/bmcfee/following{/other_user}","gists_url":"https://api.github.com/users/bmcfee/gists{/gist_id}","starred_url":"https://api.github.com/users/bmcfee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmcfee/subscriptions","organizations_url":"https://api.github.com/users/bmcfee/orgs","repos_url":"https://api.github.com/users/bmcfee/repos","events_url":"https://api.github.com/users/bmcfee/events{/privacy}","received_events_url":"https://api.github.com/users/bmcfee/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":12,"state":"open","created_at":"2014-05-21T15:55:46Z","updated_at":"2015-01-20T19:40:23Z","due_on":"2014-12-31T08:00:00Z","closed_at":null},"comments":8,"created_at":"2015-01-20T19:40:23Z","updated_at":"2015-01-21T02:50:37Z","closed_at":null,"body":"The tuning estimator fails 52 / 72 unit tests on a simple harmonic input.\r\n\r\nTuning estimation from frequency measurement input (ie, `librosa.core.pitch.pitch_tuning`) works, so these errors are due to `piptrack`.\r\n\r\n```\r\ntest_core.test_estimate_tuning(427.4740541075866, 0.01, 12, -0.5) ... ok\r\ntest_core.test_estimate_tuning(430.57170731858804, 0.01, 12, -0.375) ... FAIL\r\ntest_core.test_estimate_tuning(433.6918074016825, 0.01, 12, -0.25) ... FAIL\r\ntest_core.test_estimate_tuning(440.0, 0.01, 12, 0.0) ... FAIL\r\ntest_core.test_estimate_tuning(446.39994737251044, 0.01, 12, 0.25) ... ok\r\ntest_core.test_estimate_tuning(449.6347454078113, 0.01, 12, 0.375) ... ok\r\ntest_core.test_estimate_tuning(1016.7103732476002, 0.01, 12, -0.5) ... ok\r\ntest_core.test_estimate_tuning(1024.077875724268, 0.01, 12, -0.375) ... ok\r\ntest_core.test_estimate_tuning(1031.4987661609414, 0.01, 12, -0.25) ... FAIL\r\ntest_core.test_estimate_tuning(1046.5022612023945, 0.01, 12, 0.0) ... ok\r\ntest_core.test_estimate_tuning(1061.7239871044592, 0.01, 12, 0.25) ... FAIL\r\ntest_core.test_estimate_tuning(1069.4176767828126, 0.01, 12, 0.375) ... ok\r\ntest_core.test_estimate_tuning(4066.8414929904015, 0.01, 12, -0.5) ... ok\r\ntest_core.test_estimate_tuning(4096.311502897072, 0.01, 12, -0.375) ... FAIL\r\ntest_core.test_estimate_tuning(4125.995064643765, 0.01, 12, -0.25) ... FAIL\r\ntest_core.test_estimate_tuning(4186.009044809578, 0.01, 12, 0.0) ... FAIL\r\ntest_core.test_estimate_tuning(4246.895948417838, 0.01, 12, 0.25) ... FAIL\r\ntest_core.test_estimate_tuning(4277.67070713125, 0.01, 12, 0.375) ... FAIL\r\ntest_core.test_estimate_tuning(427.4740541075866, 0.001, 12, -0.5) ... FAIL\r\ntest_core.test_estimate_tuning(430.57170731858804, 0.001, 12, -0.375) ... FAIL\r\ntest_core.test_estimate_tuning(433.6918074016825, 0.001, 12, -0.25) ... FAIL\r\ntest_core.test_estimate_tuning(440.0, 0.001, 12, 0.0) ... FAIL\r\ntest_core.test_estimate_tuning(446.39994737251044, 0.001, 12, 0.25) ... FAIL\r\ntest_core.test_estimate_tuning(449.6347454078113, 0.001, 12, 0.375) ... FAIL\r\ntest_core.test_estimate_tuning(1016.7103732476002, 0.001, 12, -0.5) ... ok\r\ntest_core.test_estimate_tuning(1024.077875724268, 0.001, 12, -0.375) ... FAIL\r\ntest_core.test_estimate_tuning(1031.4987661609414, 0.001, 12, -0.25) ... FAIL\r\ntest_core.test_estimate_tuning(1046.5022612023945, 0.001, 12, 0.0) ... FAIL\r\ntest_core.test_estimate_tuning(1061.7239871044592, 0.001, 12, 0.25) ... FAIL\r\ntest_core.test_estimate_tuning(1069.4176767828126, 0.001, 12, 0.375) ... FAIL\r\ntest_core.test_estimate_tuning(4066.8414929904015, 0.001, 12, -0.5) ... ok\r\ntest_core.test_estimate_tuning(4096.311502897072, 0.001, 12, -0.375) ... FAIL\r\ntest_core.test_estimate_tuning(4125.995064643765, 0.001, 12, -0.25) ... FAIL\r\ntest_core.test_estimate_tuning(4186.009044809578, 0.001, 12, 0.0) ... FAIL\r\ntest_core.test_estimate_tuning(4246.895948417838, 0.001, 12, 0.25) ... FAIL\r\ntest_core.test_estimate_tuning(4277.67070713125, 0.001, 12, 0.375) ... FAIL\r\ntest_core.test_estimate_tuning(427.4740541075866, 0.01, 12, -0.5) ... FAIL\r\ntest_core.test_estimate_tuning(430.57170731858804, 0.01, 12, -0.375) ... ok\r\ntest_core.test_estimate_tuning(433.6918074016825, 0.01, 12, -0.25) ... ok\r\ntest_core.test_estimate_tuning(440.0, 0.01, 12, 0.0) ... FAIL\r\ntest_core.test_estimate_tuning(446.39994737251044, 0.01, 12, 0.25) ... ok\r\ntest_core.test_estimate_tuning(449.6347454078113, 0.01, 12, 0.375) ... ok\r\ntest_core.test_estimate_tuning(1016.7103732476002, 0.01, 12, -0.5) ... ok\r\ntest_core.test_estimate_tuning(1024.077875724268, 0.01, 12, -0.375) ... ok\r\ntest_core.test_estimate_tuning(1031.4987661609414, 0.01, 12, -0.25) ... ok\r\ntest_core.test_estimate_tuning(1046.5022612023945, 0.01, 12, 0.0) ... FAIL\r\ntest_core.test_estimate_tuning(1061.7239871044592, 0.01, 12, 0.25) ... FAIL\r\ntest_core.test_estimate_tuning(1069.4176767828126, 0.01, 12, 0.375) ... ok\r\ntest_core.test_estimate_tuning(4066.8414929904015, 0.01, 12, -0.5) ... ok\r\ntest_core.test_estimate_tuning(4096.311502897072, 0.01, 12, -0.375) ... FAIL\r\ntest_core.test_estimate_tuning(4125.995064643765, 0.01, 12, -0.25) ... FAIL\r\ntest_core.test_estimate_tuning(4186.009044809578, 0.01, 12, 0.0) ... FAIL\r\ntest_core.test_estimate_tuning(4246.895948417838, 0.01, 12, 0.25) ... FAIL\r\ntest_core.test_estimate_tuning(4277.67070713125, 0.01, 12, 0.375) ... FAIL\r\ntest_core.test_estimate_tuning(427.4740541075866, 0.001, 12, -0.5) ... FAIL\r\ntest_core.test_estimate_tuning(430.57170731858804, 0.001, 12, -0.375) ... FAIL\r\ntest_core.test_estimate_tuning(433.6918074016825, 0.001, 12, -0.25) ... FAIL\r\ntest_core.test_estimate_tuning(440.0, 0.001, 12, 0.0) ... FAIL\r\ntest_core.test_estimate_tuning(446.39994737251044, 0.001, 12, 0.25) ... FAIL\r\ntest_core.test_estimate_tuning(449.6347454078113, 0.001, 12, 0.375) ... FAIL\r\ntest_core.test_estimate_tuning(1016.7103732476002, 0.001, 12, -0.5) ... FAIL\r\ntest_core.test_estimate_tuning(1024.077875724268, 0.001, 12, -0.375) ... FAIL\r\ntest_core.test_estimate_tuning(1031.4987661609414, 0.001, 12, -0.25) ... FAIL\r\ntest_core.test_estimate_tuning(1046.5022612023945, 0.001, 12, 0.0) ... FAIL\r\ntest_core.test_estimate_tuning(1061.7239871044592, 0.001, 12, 0.25) ... FAIL\r\ntest_core.test_estimate_tuning(1069.4176767828126, 0.001, 12, 0.375) ... FAIL\r\ntest_core.test_estimate_tuning(4066.8414929904015, 0.001, 12, -0.5) ... ok\r\ntest_core.test_estimate_tuning(4096.311502897072, 0.001, 12, -0.375) ... FAIL\r\ntest_core.test_estimate_tuning(4125.995064643765, 0.001, 12, -0.25) ... FAIL\r\ntest_core.test_estimate_tuning(4186.009044809578, 0.001, 12, 0.0) ... FAIL\r\ntest_core.test_estimate_tuning(4246.895948417838, 0.001, 12, 0.25) ... FAIL\r\ntest_core.test_estimate_tuning(4277.67070713125, 0.001, 12, 0.375) ... FAIL\r\n```"},"comment":{"url":"https://api.github.com/repos/bmcfee/librosa/issues/comments/70776060","html_url":"https://github.com/bmcfee/librosa/issues/151#issuecomment-70776060","issue_url":"https://api.github.com/repos/bmcfee/librosa/issues/151","id":70776060,"user":{"login":"craffel","id":417568,"avatar_url":"https://avatars.githubusercontent.com/u/417568?v=3","gravatar_id":"","url":"https://api.github.com/users/craffel","html_url":"https://github.com/craffel","followers_url":"https://api.github.com/users/craffel/followers","following_url":"https://api.github.com/users/craffel/following{/other_user}","gists_url":"https://api.github.com/users/craffel/gists{/gist_id}","starred_url":"https://api.github.com/users/craffel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craffel/subscriptions","organizations_url":"https://api.github.com/users/craffel/orgs","repos_url":"https://api.github.com/users/craffel/repos","events_url":"https://api.github.com/users/craffel/events{/privacy}","received_events_url":"https://api.github.com/users/craffel/received_events","type":"User","site_admin":false},"created_at":"2015-01-21T02:50:37Z","updated_at":"2015-01-21T02:50:37Z","body":"> You mean pitch[(mag >= threshold) & pitch_mask]?\r\n\r\nHaha no, I changed \r\n```\r\npitch_mask = pitch >= 0\r\n```\r\n\r\n> But it still fails in the majority of remaining cases:\r\n\r\nI don't think it's because of piptrack, unless these estimates are not good enough. \r\n\r\n```Python\r\ntarget_hz = 433.6918074016825\r\ny = np.sin(2 * np.pi * target_hz * t)\r\npitch, mag = librosa.piptrack(y=y, sr=sr)\r\npitch_mask = pitch >= 0\r\nthreshold = np.median(mag[pitch_mask])\r\npitch[(mag > threshold) & pitch_mask]\r\n```\r\n(`t`, `sr`, etc all defined as above) yields\r\n```Python\r\narray([ 430.22036743,  433.70071411,  433.61798096,  433.61798096,\r\n        433.61798096,  433.61798096,  433.61798096,  433.61798096,\r\n        433.61798096,  433.61798096,  433.61798096,  433.61798096,\r\n        433.61798096,  433.61798096,  433.61798096,  433.61798096,\r\n        433.61798096,  433.61798096,  433.61798096,  433.61798096,\r\n        433.61798096,  433.61798096,  433.61798096,  433.61798096,\r\n        433.61798096,  433.61798096,  433.61798096,  433.61798096,\r\n        433.61798096,  433.61798096,  433.61798096,  433.61798096,\r\n        433.61798096,  433.61798096,  433.61798096,  433.61798096,\r\n        433.61798096,  433.61798096,  433.61798096,  433.61798096,\r\n        433.61798096,  433.61798096,  433.61798096,  433.61798096,\r\n        433.61798096,  433.61798096,  433.61798096,  433.61798096,\r\n        433.61798096,  433.61798096,  433.61798096,  433.61798096,\r\n        433.61843872,  433.30184937,  436.79724121], dtype=float32)\r\n```\r\nand  `target_hz = 440` yields\r\n```Python\r\narray([ 436.36004639,  439.99731445,  439.96273804,  439.96273804,\r\n        439.96273804,  439.96273804,  439.96273804,  439.96273804,\r\n        439.96273804,  439.96273804,  439.96273804,  439.96273804,\r\n        439.96273804,  439.96273804,  439.96273804,  439.96273804,\r\n        439.96273804,  439.96273804,  439.96273804,  439.96273804,\r\n        439.96273804,  439.96273804,  439.96273804,  439.96273804,\r\n        439.96273804,  439.96273804,  439.96273804,  439.96273804,\r\n        439.96273804,  439.96273804,  439.96273804,  439.96273804,\r\n        439.96273804,  439.96273804,  439.96273804,  439.96273804,\r\n        439.96273804,  439.96273804,  439.96273804,  439.96273804,\r\n        439.96273804,  439.96273804,  439.96273804,  439.96273804,\r\n        439.96273804,  439.96273804,  439.96273804,  439.96273804,\r\n        439.96273804,  439.96273804,  439.96273804,  439.96273804,\r\n        439.96298218,  440.02789307,  443.61868286], dtype=float32)\r\n```"}}