Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

muspy.show_pianoroll bug when the music tracks are altered. #80

Open
Juno-T opened this issue Nov 30, 2023 · 1 comment
Open

muspy.show_pianoroll bug when the music tracks are altered. #80

Juno-T opened this issue Nov 30, 2023 · 1 comment

Comments

@Juno-T
Copy link

Juno-T commented Nov 30, 2023

To reproduce:

dataset = muspy.LakhMIDIAlignedDataset("path/to/dataset")
music = dataset[1].copy()
music.tracks = music.tracks[:1]
muspy.show_pianoroll(music, mode="hybrid", preset="frame")

The error:

File venv/lib/python3.10/site-packages/muspy/outputs/pianoroll.py:57, in to_pypianoroll(music)
     55 for tempo in music.tempos:
     56     tempo_arr[position : tempo.time] = qpm
---> 57     tempo_arr[tempo.time] = tempo.qpm
     58     position = tempo.time + 1
     59     qpm = tempo.qpm

IndexError: index 29085 is out of bounds for axis 0 with size 29085

The bug is probably how the music length is calculated.
i.e.
music.get_end_time() return the same number as music.tempos[-1].time if the tracks are altered.
I'm not sure if get_end_time() function or the piano roll function should be fixed.

@egndz
Copy link

egndz commented Feb 11, 2024

I cannot reproduce the error, instead I get:

File "/Users/egehangunduz/Desktop/github/muspy/test.py", line 10, in <module> muspy.show_pianoroll(music, mode="hybrid", preset="frame") File "/Users/egehangunduz/Desktop/github/muspy/muspy/visualization/pianoroll.py", line 12, in show_pianoroll return multitrack.plot(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/egehangunduz/Desktop/github/muspy/env/lib/python3.11/site-packages/pypianoroll/multitrack.py", line 697, in plot return plot_multitrack(self, axs, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/egehangunduz/Desktop/github/muspy/env/lib/python3.11/site-packages/pypianoroll/visualization.py", line 465, in plot_multitrack merged_drums = drums.blend() ^^^^^^^^^^^^^ File "/Users/egehangunduz/Desktop/github/muspy/env/lib/python3.11/site-packages/pypianoroll/multitrack.py", line 431, in blend stacked = self.stack() ^^^^^^^^^^^^ File "/Users/egehangunduz/Desktop/github/muspy/env/lib/python3.11/site-packages/pypianoroll/multitrack.py", line 413, in stack return np.stack(pianorolls) ^^^^^^^^^^^^^^^^^^^^ File "/Users/egehangunduz/Desktop/github/muspy/env/lib/python3.11/site-packages/numpy/core/shape_base.py", line 445, in stack raise ValueError('need at least one array to stack') ValueError: need at least one array to stack

can you please try to reproduce it and let me know so I can assign myself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants