极线网络显示
I've never been happy with our tonnetz displays (via specshow). At the same time, the tonnetz visualization in Harte et al. 2006 was never very intuitive to me either, since it doesn't present an obvious way to represent time. > Riffing on the time=radius idea above for chroma, I took a whack at tonnetz displays under the same principle. Here I'm retaining the angles from each of the three subspaces (P5, m3, M3), mapping time to radius, and magnitude at each time step in each subspace is encoded by the alpha channel. Subspace angle is redundantly coded as color, just to put some more visual interest in the display. (Monochrome would be fine, but I think it would make no sense to have multiple tonnetz plots overlaid this way, so I opted for a colormap.) > Here's a rough cut (EDIT lightly revised to standardize color scales): > ```Python fig, ax = plt.subplots(nrows=1, ncols=3, subplot_kw=dict(projection='polar'), sharey=True, figsize=(9, 3), constrained_layout=True) times = librosa.times_like(T) th1 = np.arctan2(T[0], T[1]) mag1 = np.sqrt(T[1]**2 + T[0]**2) th2 = np.arctan2(T[2], T[3]) mag2 = np.sqrt(T[3]**2 + T[2]**2) th3 = np.arctan2(T[4], T[5]) mag3 = np.sqrt(T[5]**2 + T[4]2) ax[0].scatter(th1, times, alpha=mag1/mag1.max(), c=th1, cmap='twilight', marker='.', s=5, vmin=-np.pi, vmax=np.pi) ax[1].scatter(th2, times, alpha=mag2/mag2.max(), c=th2, cmap='twilight', marker='.', s=5, vmin=-np.pi, vmax=np.pi) ax[2].scatter(th3, times, alpha=mag3/mag3.max(), c=th3, cmap='twilight', marker='.', s=5, vmin=-np.pi, vmax=np.pi) ax[0].set(title='P5') perm = np.mod(7 * np.arange(12), 12) ax[0].set_thetagrids(360 * np.arange(12) / 12, labels=librosa.midi_to_note(perm, octave=False, key='Eb:maj')) ax[1].set(title='m3') ax[1].set_thetagrids(360 * np.arange(4) / 4, labels=['C·E·A♭', 'E♭·G·B', 'D·G♭·B♭', 'D♭·F·A']) ax[2].set(title='M3') ax[2].set_thetagrids(360 * np.arange(3) / 3, labels=['C·Eb·G♭·A', 'D♭·E·G·B♭', 'D·F·A♭·B']) for axi in ax.flat: axi.set_yscale('function', functions=(np.sqrt, lambda r: r2)) axi.set_rticks([]) axi.set_theta_direction(-1) axi.set_theta_offset(np.pi/2) > Using the Hungarian Dance ♯5 example results in the following:
Here's sweetwaltz:
and the first 90 seconds of Giant steps, just for fun:
What can we read from these? I'm not really sure. I'm not convinced the tonnetz features powered by our simple cqt-based chroma are all that clean. I don't think …
内容来源: librosa/librosa