{"action":"created","issue":{"url":"https://api.github.com/repos/librosa/librosa/issues/955","repository_url":"https://api.github.com/repos/librosa/librosa","labels_url":"https://api.github.com/repos/librosa/librosa/issues/955/labels{/name}","comments_url":"https://api.github.com/repos/librosa/librosa/issues/955/comments","events_url":"https://api.github.com/repos/librosa/librosa/issues/955/events","html_url":"https://github.com/librosa/librosa/issues/955","id":480934255,"node_id":"MDU6SXNzdWU0ODA5MzQyNTU=","number":955,"title":"reassign_spectrogram docstring is slow and uninformative","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},"labels":[{"id":208911196,"node_id":"MDU6TGFiZWwyMDg5MTExOTY=","url":"https://api.github.com/repos/librosa/librosa/labels/documentation","name":"documentation","color":"009800","default":true}],"state":"open","locked":false,"assignee":{"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},"assignees":[{"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}],"milestone":{"url":"https://api.github.com/repos/librosa/librosa/milestones/19","html_url":"https://github.com/librosa/librosa/milestone/19","labels_url":"https://api.github.com/repos/librosa/librosa/milestones/19/labels","id":4415486,"node_id":"MDk6TWlsZXN0b25lNDQxNTQ4Ng==","number":19,"title":"0.7.1","description":"","creator":{"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},"open_issues":5,"closed_issues":22,"state":"open","created_at":"2019-06-17T15:35:44Z","updated_at":"2019-08-15T00:02:25Z","due_on":"2019-09-30T07:00:00Z","closed_at":null},"comments":4,"created_at":"2019-08-14T23:41:23Z","updated_at":"2019-08-15T00:15:09Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"#### Description\r\nThis issue comes in the wake of PR #926, which closed #394.\r\n\r\nFirst of all, let me express how happy i am that time-frequency reassignment eventually made its way into a wide-audience library such as librosa. Huge thanks to @scjs for his work.\r\n\r\nThat being said, the current docstring example for reassign_spectrogram technically works, but it's built upon a 2-second example of Vibe Ace at 22050 Hz sample rate. The result is not very compelling in terms of the capabilities of time-frequency reassignment. In particular, it's not at all clear that time-frequency reassignment alleviates the Heisenberg time-frequency tradeoff. At first glance, what seems to happen looks more like a threshold-based sparsification of STFT magnitudes. I'm afraid we might convey the wrong kind of message with this example.\r\n\r\nFurthermore, this example is quite slow: ~5 seconds on my laptop, including display in a Jupyter notebook.\r\n\r\nPlease let me know if you want me to make a PR.\r\n\r\n#### Steps/Code to Reproduce\r\n```python\r\ny, sr = librosa.load(librosa.util.example_audio_file())\r\ny_zoom = y[27 * sr : 29 * sr]\r\nfreqs, times, mags = librosa.reassigned_spectrogram(\r\n    y=y_zoom, sr=sr, hop_length=16, n_fft=64, ref_power=1e-4\r\n)\r\ndb = librosa.amplitude_to_db(mags, ref=np.max)\r\nimport matplotlib.pyplot as plt\r\nplt.figure()\r\nplt.subplot(2, 1, 1)\r\nlibrosa.display.specshow(\r\n    db, x_axis=\"s\", y_axis=\"linear\", sr=sr, hop_length=16\r\n)\r\nplt.title(\"Spectrogram\")\r\nplt.subplot(2, 1, 2)\r\nplt.scatter(times, freqs, c=db, s=0.1, cmap=\"magma\")\r\nplt.title(\"Reassigned spectrogram\")\r\nplt.xlim([0, 2])\r\nplt.xticks([0, 0.5, 1, 1.5, 2])\r\nplt.ylabel(\"Hz\")\r\nplt.subplots_adjust(\r\n    left=0.1, bottom=0.05, right=0.95, top=0.95, hspace=0.5\r\n)\r\nplt.show()\r\n```\r\n\r\n#### Actual Results\r\n![reassign_vibe_ace](https://user-images.githubusercontent.com/3943142/63063282-02bb2080-beca-11e9-84ad-8535140b38a7.png)\r\n\r\n\r\n#### Expected Results\r\nI would prefer to see a faster and more pedagogical example, even if it's synthetic.\r\nFor example this:\r\n\r\n![reassigned_synth](https://user-images.githubusercontent.com/3943142/63063527-1024da80-becb-11e9-96b0-31bf226beae3.png)\r\n\r\nRuns in 75 milliseconds on my laptop.\r\n\r\nCode:\r\n\r\n```python\r\nsr = 4000\r\ny = 2e-1 * librosa.clicks(times=[0.1], sr=sr, click_duration=1.0, click_freq=2400.0, length=8000) +\\\r\n    1e-1 * librosa.clicks(times=[1.2], sr=sr, click_duration=0.5, click_freq=400.0, length=8000) +\\\r\n    1e-2 * librosa.chirp(300, 1600, sr=sr, duration=2.0, linear=True) +\\\r\n    1e-3 * np.random.randn(2*sr)\r\n\r\nfreqs, times, mags = librosa.reassigned_spectrogram(\r\n    y=y, sr=sr, n_fft=64, ref_power=1e-2)\r\ndb = librosa.amplitude_to_db(mags, ref=np.max)\r\n\r\nplt.figure(figsize=(8,8))\r\nplt.subplot(2, 1, 1)\r\nlibrosa.display.specshow(\r\n    db, x_axis=\"s\", y_axis=\"linear\", sr=sr, hop_length=16)\r\nplt.title(\"Spectrogram\")\r\nplt.gca().set_xticklabels([])\r\nplt.gca().set_xlabel(None)\r\nplt.subplot(2, 1, 2)\r\nplt.scatter(times, freqs, c=db, s=0.1, cmap=\"magma\")\r\nplt.title(\"Reassigned spectrogram\")\r\nplt.xlabel(\"Time (s)\")\r\nplt.xlim(0, 2)\r\nplt.xticks([0, 0.5, 1, 1.5, 2])\r\nplt.ylabel(\"Hz\")\r\nplt.ylim(0, 2000)\r\n```\r\n\r\n#### Versions\r\nlatest master (0.7.1-dev)"},"comment":{"url":"https://api.github.com/repos/librosa/librosa/issues/comments/521465623","html_url":"https://github.com/librosa/librosa/issues/955#issuecomment-521465623","issue_url":"https://api.github.com/repos/librosa/librosa/issues/955","id":521465623,"node_id":"MDEyOklzc3VlQ29tbWVudDUyMTQ2NTYyMw==","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},"created_at":"2019-08-15T00:15:09Z","updated_at":"2019-08-15T00:15:09Z","author_association":"CONTRIBUTOR","body":"That's true. It's also that, by definition, there will be many points over a tiny surface, often so thin as to resemble a line."}}
{"actor":{"display_login":"lostanlen"}}