Hi Colin! I see a number of issues and PRs related to get_piano_roll(), yet I'm not sure which of them my issue fits best with so I'm opening a new one:
I notice many notes in the piano roll are sustained for much longer than they should be, resulting in long horizontal lines, independent of the choice for fs.
For example, here is a plt.imshow() for the get_piano_roll output for piano instrument in file number 028/028.mid in the POP909 Dataset:
def plot_piano_roll(pr_array):
plt.figure(figsize=(8, 8))
plt.imshow(np.flipud(pr_array), aspect='auto')
plt.show()
for instrument in pm.instruments:
name = instrument.name.upper()
if name in ['MELODY', 'PIANO']:
print(f"get_piano_rolls: instrument.name = {name}")
piano_rolls[name] = instrument.get_piano_roll(fs=fs)
if name == 'PIANO':
plot_piano_roll(piano_rolls[name])

The same part displayed in Logic Pro looks different; it does not have the long horizontal lines:

Also, when I plot it using the method from the Magenta music_generation.ipynb Colab Notebook, there are no long horizontal lines:

I've tried different fs values (from 4 to 1000) and different image sizes to see if the long horizontal lines in the first image are just some sort of plotting artifact, but... I can't get rid of them.
This issue applies to both the instrument.get_piano_roll() and the full pm.get_piano_roll().
The issue applies to several other files in that POP909 dataset, e.g. 028, 030, 038, 039, 040, 046, 047, 050, 052, 057, 061, 064, 065, 066, 068,... I stopped counting. Logic and other viewers show them ok, but get_piano_roll seems to incorrectly sustain notes for many, many measures.
Is there something I'm doing wrong that 's leading to the "long horizontal lines"? I'd like an array that reflects something more like from the other two plotting methods.
Thanks!
Hi Colin! I see a number of issues and PRs related to
get_piano_roll(), yet I'm not sure which of them my issue fits best with so I'm opening a new one:I notice many notes in the piano roll are sustained for much longer than they should be, resulting in long horizontal lines, independent of the choice for
fs.For example, here is a
plt.imshow()for theget_piano_rolloutput for piano instrument in file number028/028.midin the POP909 Dataset:The same part displayed in Logic Pro looks different; it does not have the long horizontal lines:

Also, when I plot it using the method from the Magenta music_generation.ipynb Colab Notebook, there are no long horizontal lines:

I've tried different
fsvalues (from 4 to 1000) and different image sizes to see if the long horizontal lines in the first image are just some sort of plotting artifact, but... I can't get rid of them.This issue applies to both the
instrument.get_piano_roll()and the fullpm.get_piano_roll().The issue applies to several other files in that POP909 dataset, e.g.
028, 030, 038, 039, 040, 046, 047, 050, 052, 057, 061, 064, 065, 066, 068,... I stopped counting. Logic and other viewers show them ok, butget_piano_rollseems to incorrectly sustain notes for many, many measures.Is there something I'm doing wrong that 's leading to the "long horizontal lines"? I'd like an array that reflects something more like from the other two plotting methods.
Thanks!