pianoplayer
pianoplayer copied to clipboard
Getting IndexError while running the script
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!
Hi Vasily - yes that would be helpful otherwise I have no way to reproduce the issue, Thanks! Marco
Thank you, Marco, for a quick reply! Here it is. We_Three_Kings.zip
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:
Thanks, Marco! Possibly. Although I was able to play this midi file in Synthesia and Piano From Above without any issues.
Hi again, Marco. I tried what you suggested:
- Converted midi to mxl in MuseScore3.
- Opened the newly created mxl file with your GUI and ran your script.
- Output.xml was generated with no errors!
- 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.
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.
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.
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
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.
last error should be fixed in the latest release.