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

Getting IndexError while running the script #32

Open
catvasily opened this issue Jan 17, 2021 · 10 comments
Open

Getting IndexError while running the script #32

catvasily opened this issue Jan 17, 2021 · 10 comments

Comments

@catvasily
Copy link

Hello.
I installed pianoplayer in Windows 7 and Anaconda with --no-devs option.
Was able to start pianoplayer:

python C:\ProgramData\Anaconda3\Scripts\pianoplayer
In "Import Score" I selected a .mid file (a relatively simple song with 2 channels).
While running, I got an error message:
...
meas.None finger:5 on C5 v=0.1 [5, 4, 3, 4, 2] d:5
meas.None finger:4 on B4 v=0.1 [4, 3, 4, 2, 2] d:5
meas.None finger:3 on A4
meas.None finger:4 on B4
meas.None finger:2 on G4
meas.None finger:3 on G4
meas.None finger:3 on G4
meas.None finger:2 on D4
meas.None finger:4 on E4
meas.None finger:1 on G3
meas.None finger:0 on G4
Your hand span set to size-M which is 17.22 cm
(max relaxed distance between thumb and pinkie)
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\tkinter_init_.py", line 1705, in call
return self.func(*args)
File "C:\ProgramData\Anaconda3\Scripts\pianoplayer", line 89, in generateCMD
self.lh.noteseq = reader(sf, beam=self.LeftHandBeam)
File "C:\ProgramData\Anaconda3\lib\site-packages\pianoplayer\scorereader.py",
line 32, in reader
strm = sf.parts[beam].flat
File "C:\ProgramData\Anaconda3\lib\site-packages\music21\stream\iterator.py",
line 325, in getitem
e = fe[k]
IndexError: list index out of range

Any suggestion? Would be happy to send you the .mid file, if it helps.
Thank you for developing this toolbox!

@marcomusy
Copy link
Owner

Hi Vasily - yes that would be helpful otherwise I have no way to reproduce the issue,
Thanks!
Marco

@catvasily
Copy link
Author

Thank you, Marco, for a quick reply!
Here it is.
We_Three_Kings.zip

@marcomusy
Copy link
Owner

That's a strange error! there must be something fishy in the midi... I will check.. meanwhile I could export it in musescore and then it works ok:

We_Three_Kings.pdf

We_Three_Kings.zip

@catvasily
Copy link
Author

Thanks, Marco!
Possibly.
Although I was able to play this midi file in Synthesia and Piano From Above without any issues.

@catvasily
Copy link
Author

Hi again, Marco.
I tried what you suggested:

  1. Converted midi to mxl in MuseScore3.
  2. Opened the newly created mxl file with your GUI and ran your script.
  3. Output.xml was generated with no errors!
  4. Was able to see the finger numbering in output.xml with MuseScore3.
    However, when I tried to export output.xml back to midi in MuseScore3, the finger numbering's gone in midi.
    I guess this is a limitation of MuseScore.
    So, if we can do finger numbering directly from midi into midi with your script, it would be great!.
    Or, regardless of the input format, the output will be in xml format?
    Thank you and regards.

@marcomusy
Copy link
Owner

Are you sure that midi supports lyrics? After a quick search it looks it doesn't:
https://www.midi.org/forum/4852-what-about-midi-2-0-and-lyrics-in-midi-files

The pianoplayer output is only music-xml, I think musescore has a command-line converter which might make life easier.

@catvasily
Copy link
Author

Hi Marco,
Does your question assume that the numbers indicating fingers are actually stored as lyrics?
I thought there would a specific field in the XML and midi format just for finger hints.

@marcomusy
Copy link
Owner

Hi, no they are by default stored in the fingering slot of xml-music format.
Optionally pianoplayer can store them as lyrics, but only from command line with -b option, e.g.
pianoplayer -b somefile.mscz

@Cool-Joe
Copy link

Cool-Joe commented Jan 22, 2021

Midi can store texts like lyrics, e.g. "FF 05 len text Lyric" and other texts.
See http://www.music.mcgill.ca/~ich/classes/mumt306/StandardMIDIfileformat.html
However the used music21 lib does not support it. It would be a good idea to implement this feature in music21.

The "IndexError: list index out of range" occurs when a file contains not the beams you specified (-rbeam / -lbeam option).
Pianoplayer accesses the given beam index numbers, which must exist in the file.
The problem occurs mostly with midi file format 0, where all notes are in one track.

@marcomusy
Copy link
Owner

last error should be fixed in the latest release.

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

3 participants