marcomusy / pianoplayer

Automatic fingering generator for piano scores
MIT License
723 stars 82 forks source link

Exception on loading a music xml file #17

Closed GitterHubber closed 4 years ago

GitterHubber commented 4 years ago

Windows 7, x64 system with python 3.6.

I get an exception after loading a XML file. The program first prints the following

Your hand span set to size-M which is 17.22 cm
(max relaxed distance between thumb and pinkie)
Reading beam 0 with 63 objects in stream.
meas.1   finger:2 on C4         v=0.1      [2, 2, 3, 2, 5, 4] d:
meas.1   finger:2 on C4         v=0.1      [2, 3, 2, 5, 4] d:5
meas.2   finger:3 on D4         v=0.1      [3, 2, 5, 4, 2] d:5
meas.2   finger:2 on C4         v=0.1      [2, 5, 4, 2, 2] d:5
meas.2   finger:5 on F4         v=0.1      [5, 4, 2, 2, 3] d:5
meas.3   finger:4 on E4         v=0.1      [4, 2, 2, 3, 2] d:5
meas.3   finger:2 on C4         v=0.6      [2, 2, 3, 2, 5, 4] d:
meas.3   finger:2 on C4         v=0.8      [2, 3, 2, 5, 4] d:5
meas.4   finger:3 on D4         v=0.9      [3, 2, 5, 4, 1] d:5
meas.4   finger:2 on C4         v=0.8      [2, 5, 4, 1, 1] d:5
meas.4   finger:5 on G4         v=3.3      [5, 4, 1, 1, 5] d:5
meas.5   finger:4 on F4         v=3.3      [4, 1, 1, 5, 3] d:5
meas.5   finger:1 on C4         v=3.2      [1, 1, 5, 3, 2, 1] d:
meas.5   finger:1 on C4         v=4.0      [1, 5, 3, 2, 1] d:5
meas.6   finger:5 on C5         v=1.3      [5, 4, 3, 2, 1] d:5
meas.6   finger:4 on A4         v=0.8      [4, 3, 2, 1, 5] d:5
meas.6   finger:3 on F4         v=0.4      [3, 2, 1, 5, 5] d:5
meas.7   finger:2 on E4         v=0.7      [2, 1, 5, 5, 4, 2] d:
meas.7   finger:1 on D4         v=0.6      [1, 5, 5, 4, 2, 4] d:
meas.7   finger:5 on B-4        v=0.5      [5, 5, 4, 2, 4, 3] d:
meas.7   finger:5 on B-4        v=0.6      [5, 4, 2, 4, 3] d:5
meas.8   finger:4 on A4         v=0.5      [4, 2, 4, 3, 1] d:5
meas.8   finger:2 on F4         v=0.7      [2, 4, 3, 1, 2] d:5
meas.8   finger:4 on A4         v=0.9      [4, 3, 1, 2, 1] d:5
meas.9   finger:3 on G4         v=0.9      [3, 2, 3, 2, 5] d:5
meas.9   finger:2 on C4         v=0.1      [2, 3, 2, 5, 4] d:5
meas.10   finger:3 on D4        v=0.1      [3, 2, 5, 4, 2] d:5
meas.10   finger:2 on C4        v=0.1      [2, 5, 4, 2, 3] d:5
meas.10   finger:5 on F4        v=0.1      [5, 4, 2, 3, 2] d:5
meas.11   finger:4 on E4        v=0.8      [4, 2, 3, 2, 5] d:5
meas.11   finger:2 on C4        v=0.8      [2, 3, 2, 5, 4] d:5
meas.12   finger:3 on D4        v=0.9      [3, 2, 5, 4, 1] d:5
meas.12   finger:2 on C4        v=2.6      [2, 5, 4, 1, 5] d:5
meas.12   finger:5 on G4        v=1.9      [5, 4, 1, 5, 3] d:5
meas.13   finger:4 on F4        v=2.1      [4, 1, 5, 3, 1] d:5
meas.13   finger:1 on C4        v=2.6      [1, 5, 3, 2, 1] d:5
meas.14   finger:5 on C5        v=1.3      [5, 4, 3, 2, 1] d:5
meas.14   finger:4 on A4        v=0.8      [4, 3, 2, 1, 5] d:5
meas.14   finger:3 on F4        v=0.6      [3, 2, 1, 5, 4] d:5
meas.15   finger:2 on E4        v=0.6      [2, 1, 5, 4, 2] d:5
meas.15   finger:1 on D4        v=0.4      [1, 5, 4, 2, 3] d:5
meas.15   finger:5 on B-4       v=0.3      [5, 4, 2, 3, 2] d:5
meas.16   finger:4 on A4
meas.16   finger:2 on F4
meas.16   finger:3 on G4
meas.17   finger:2 on F4
meas.17   finger:1 on C4
meas.17   finger:1 on C4
meas.18   finger:5 on A4
meas.18   finger:3 on F4
meas.18   finger:4 on G4
meas.19   finger:0 on F4
Your hand span set to size-M which is 17.22 cm
(max relaxed distance between thumb and pinkie)

and then throws an exception

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\tkinter\__init__.py", line 1705, in __call
__
    return self.func(*args)
  File "pianoplayer", line 89, in generateCMD
    self.lh.noteseq = reader(sf, beam=self.LeftHandBeam)
  File "C:\Program Files\Python36\lib\site-packages\pianoplayer\scorereader.py",
 line 32, in reader
    strm = sf.parts[beam].flat
  File "C:\Program Files\Python36\lib\site-packages\music21\stream\iterator.py",
 line 328, in __getitem__
    e = fe[k]
IndexError: list index out of range

I have attached the xml file that causes this error. Any pointers to this would be very helpful. TIA

hb.zip

marcomusy commented 4 years ago

@GitterHubber As your score only has the right hand beam you should untick the left hand in the GUI:

image

or if using the command line: pianoplayer -r hb.xml

Note that the file extension should be .xml

image

GitterHubber commented 4 years ago

Thanks, for the info, I just saw the score images that you attached the last few notes don't seem to be numbered, is this by design?

marcomusy commented 4 years ago

yes, it's by design: there are not enough "future" notes to make a valid prediction at the end of the score.