GithubHelp home page GithubHelp logo

marcomusy / pianoplayer Goto Github PK

View Code? Open in Web Editor NEW
704.0 17.0 79.0 9.9 MB

Automatic fingering generator for piano scores

License: MIT License

Python 99.07% Batchfile 0.93%
piano-fingering piano-keyboard piano3d piano-fingers piano music21 fingering

pianoplayer's People

Contributors

codacy-badger avatar kanma avatar marcomusy avatar pramoneda avatar voice-and-co avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pianoplayer's Issues

integer parsing

There is a bug

t = np.linspace(0, duration, duration * sample_rate, False)

You need to parse int(duration * sample_rate) otherwise it yields the following error when using 3D player:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/envs/piano/lib/python3.6/tkinter/__init__.py", line 1705, in __call__
    return self.func(*args)
  File "/home/ubuntu/anaconda3/envs/piano/bin/pianoplayer", line 103, in vpCMD
    vk.play()
  File "/home/ubuntu/anaconda3/envs/piano/lib/python3.6/site-packages/pianoplayer/vtk_keyboard.py", line 134, in play
    if self.rightHand: self._moveHand( 1, t)
  File "/home/ubuntu/anaconda3/envs/piano/lib/python3.6/site-packages/pianoplayer/vtk_keyboard.py", line 198, in _moveHand
    playSound(n, self.speedfactor)
  File "/home/ubuntu/anaconda3/envs/piano/lib/python3.6/site-packages/pianoplayer/wavegenerator.py", line 75, in playSound
    soundof([n], n.duration/speedfactor)
  File "/home/ubuntu/anaconda3/envs/piano/lib/python3.6/site-packages/pianoplayer/wavegenerator.py", line 30, in soundof
    t = np.linspace(0, duration, (duration * sample_rate), False)
  File "<__array_function__ internals>", line 6, in linspace
  File "/home/ubuntu/anaconda3/envs/piano/lib/python3.6/site-packages/numpy/core/function_base.py", line 113, in linspace
    num = operator.index(num)
TypeError: 'float' object cannot be interpreted as an integer

Windows binary

I ran this command on Windows
python setup.py install

How can I launch the program?

Using pianoplayer inside Jupyter notebooks

Have you looked at integrating pianoplayer with Jupyter notebooks?

I have a demo repository here which includes requirements to run the repo interactively on MyBinder.

To display the score should be simple if, if there's a pianoplayer function available that returns the score as a PNG or SVG image file.

Few errors

  • First is

music21: Certain music21 functions might need these optional packages: matplotlib, numpy, scipy; if you run into errors, install them by following the instructions at http://mit.edu/music21/doc/installing/installAdditional.html

Music21 v.4 is the last version that will support Python 2. Please start using Python 3 instead.

Set music21.environment.UserSettings()['warnings'] = 0 to disable this message.

I'm using Python 3.7

  • Second is

sh: musescore: command not found

I'm using Musescore 3.

  • And when I open the output.xml, it doesn't seem to work.

https://imgur.com/17DG3JQ

Here is the sheet I used: https://musescore.com/user/13934766/scores/3579721

Errors package

I downloaded the 2000 most popular piano sheet music from Musescore, as mxl.

I ran the lastest pip version of pianoplayer on all of the files (on XXS setting), and started getting errors, like #21 and others (python errors).

Here I share an archive of all of the files that had execution errors (148 out of 2000), in the hope this helps you make this system more robust.

File names are constructed from musescore ID, and title, so you can always trace back to musescore.com in order to see the file.

errors.zip

Fingering with voltas

It seems to me that the program reads the partition continuously from start to end. It would be nice if it could take into account prima volta, seconda volta, etc..

Exception on loading a music xml file

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

Getting hand data from the XML file

Hello,

I have trouble getting the hand information from the XML file. How can I check which hand's fingering is happening at a particular note ?

Windows 10 Installation instructions

I'm trying to get this set up on a Windows 10 machine and since I don't know what I'm doing I'm having a bit of trouble. I set up a virtualenv and pip installed pianoplayer. I was hoping to just run pianoplayer 123.xml to get some results.

When I run pianoplayer, I get: 'pianoplayer' is not recognized as an internal or external command, operable program or batch file.

I tried to run the script directly from what I could find, but I get: can't find '__main__' module as an error.

Just wondering if I absolutely need Anaconda, I'm running on plain python for now. Thanks!

On Windows

"pip install pianoplayer" gives

ERROR: Cannot install pianoplayer==1.0.0, pianoplayer==1.1.0, pianoplayer==1.1.1, pianoplayer==2.0.0, pianoplayer==2.0.1, pianoplayer==2.0.4, pianoplayer==2.0.5, pianoplayer==2.0.6, pianoplayer==2.0.7 and pianoplayer==2.1.0 because these package versions have conflicting dependencies.

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!

Long sequences with no fingerings

Several songs produce long sequences with no fingerings, what is the reason?
The example below was downloaded from https://www.mutopiaproject.org/ftp/JoplinS/original/original.mid
(I added some debug output values in your code.)

python.exe pianoplayer original.mid --verbose -d 9

music21: Certain music21 functions might need these optional packages: matplotlib, numpy;
                   if you run into errors, install them by following the instructions at
                   http://mit.edu/music21/doc/installing/installAdditional.html
Your hand span set to size-M which is 17.22 cm
(max relaxed distance between thumb and pinkie)
Reading beam 0 with 613 objects in stream.
time:0.0        meas.None       finger:1 on B-5 duration:0.3    v=27.9  [1, 5, 1, 5, 1, 5, 1, 5, 4]
time:-0.05      meas.None       finger:5 on B-6 duration:0.3    v=31.5     [5, 1, 5, 1, 5, 1, 5, 1, 5]
time:0.25       meas.None       finger:1 on B5  duration:0.55   v=31.5        [1, 5, 1, 5, 1, 5, 1, 5, 1]
time:0.2        meas.None       finger:5 on B6  duration:0.55   v=32.4           [5, 1, 5, 1, 5, 1, 5, 1, 5]
time:0.75       meas.None       finger:1 on B-5 duration:0.3    v=32.8              [1, 5, 1, 5, 1, 5, 1, 5, 3]
time:0.7        meas.None       finger:5 on B-6 duration:0.3    v=37.7                 [5, 1, 5, 1, 5, 1, 5, 1, 5]
time:1.0        meas.None       finger:1 on B6  duration:0.55   v=35.7                    [1, 5, 1, 5, 1, 5, 1, 5, 5]
time:0.95       meas.None       finger:5 on B5  duration:0.55   v=37.7                       [5, 1, 5, 1, 5, 1, 5, 1, 5]
time:1.5        meas.None       finger:1 on B-5 duration:0.3    v=34.0                          [1, 5, 1, 5, 1, 5, 1, 5, 3]
time:1.45       meas.None       finger:5 on B-6 duration:0.3    v=31.3  [5, 1, 5, 1, 5, 1, 5, 1, 5]
time:1.75       meas.None       finger:1 on B5  duration:0.3    v=30.6     [1, 5, 1, 5, 1, 5, 1, 5, 2]
time:1.7        meas.None       finger:5 on B6  duration:0.3    v=32.1        [5, 1, 5, 1, 5, 1, 5, 1, 5]
time:2.0        meas.None       finger:1 on F#5 duration:0.3    v=24.8           [1, 5, 1, 5, 1, 5, 1, 5, 1]
time:1.95       meas.None       finger:5 on F#6 duration:0.3    v=22.5              [5, 1, 5, 1, 5, 1, 5, 1, 5]
time:2.25       meas.None       finger:1 on G6  duration:0.55   v=20.3                 [1, 5, 1, 5, 1, 5, 1, 5, 4]
time:2.2        meas.None       finger:0 on G5  duration:0.55   v=-1                      [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:2.75       meas.None       finger:0 on E5  duration:1.3    v=-1                         [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:2.7        meas.None       finger:0 on E6  duration:1.3    v=-1                            [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:4.0        meas.None       finger:0 on F#5 duration:0.3    v=-1    [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:3.95       meas.None       finger:0 on F#6 duration:0.3    v=-1       [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:4.25       meas.None       finger:0 on G5  duration:0.55   v=-1          [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:4.2        meas.None       finger:0 on G6  duration:0.55   v=-1             [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:4.75       meas.None       finger:0 on F#6 duration:0.3    v=-1                [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:4.7        meas.None       finger:0 on F#5 duration:0.3    v=-1                   [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:5.0        meas.None       finger:0 on G5  duration:0.55   v=-1                      [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:4.95       meas.None       finger:0 on G6  duration:0.55   v=-1                         [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:5.5        meas.None       finger:0 on F#5 duration:0.3    v=-1                            [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:5.45       meas.None       finger:0 on F#6 duration:0.3    v=-1    [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:5.75       meas.None       finger:0 on G5  duration:0.3    v=-1       [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:5.7        meas.None       finger:0 on G6  duration:0.3    v=-1          [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:6.0        meas.None       finger:0 on C#6 duration:0.3    v=-1             [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:5.95       meas.None       finger:0 on C#5 duration:0.3    v=-1                [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:6.25       meas.None       finger:0 on D5  duration:0.55   v=-1                   [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:6.2        meas.None       finger:0 on D6  duration:0.55   v=-1                      [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:6.75       meas.None       finger:0 on B4  duration:1.3    v=-1                         [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:6.7        meas.None       finger:0 on B5  duration:1.3    v=-1                            [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:8.0        meas.None       finger:0 on C5  duration:0.4    v=-1    [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:7.95       meas.None       finger:0 on E5  duration:0.4    v=-1       [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:7.9        meas.None       finger:0 on C6  duration:0.4    v=-1          [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:7.85       meas.None       finger:0 on A4  duration:0.4    v=-1             [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:8.25       meas.None       finger:0 on A4  duration:0.65   v=-1                [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:8.2        meas.None       finger:0 on C6  duration:0.65   v=-1                   [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:8.15       meas.None       finger:0 on E5  duration:0.65   v=-1                      [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:8.1        meas.None       finger:0 on C5  duration:0.65   v=-1                         [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:8.75       meas.None       finger:0 on C5  duration:0.4    v=-1                            [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:8.7        meas.None       finger:0 on E5  duration:0.4    v=-1    [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:8.65       meas.None       finger:0 on C6  duration:0.4    v=-1       [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:8.6        meas.None       finger:0 on A4  duration:0.4    v=-1          [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:9.0        meas.None       finger:0 on C5  duration:0.65   v=-1             [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:8.95       meas.None       finger:0 on E-5 duration:0.65   v=-1                [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:8.9        meas.None       finger:0 on C6  duration:0.65   v=-1                   [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:8.85       meas.None       finger:0 on G4  duration:0.65   v=-1                      [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:9.5        meas.None       finger:0 on C5  duration:0.65   v=-1                         [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:9.45       meas.None       finger:0 on E-5 duration:0.65   v=-1                            [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:9.4        meas.None       finger:0 on C6  duration:0.65   v=-1    [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:9.35       meas.None       finger:0 on G4  duration:0.65   v=-1       [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:10.0       meas.None       finger:0 on F#4 duration:0.48333333333333334    v=-1          [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:9.95       meas.None       finger:0 on C6  duration:0.48333333333333334    v=-1             [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:9.9        meas.None       finger:0 on D5  duration:0.48333333333333334    v=-1                [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:9.85       meas.None       finger:0 on C5  duration:0.48333333333333334    v=-1                   [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:31/3       meas.None       finger:0 on G#4 duration:0.25   v=-1                      [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:10.5       meas.None       finger:0 on A4  duration:0.5    v=-1                         [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:11.0       meas.None       finger:0 on D4  duration:1.0    v=-1                            [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:12.0       meas.None       finger:0 on C4  duration:0.35   v=-1    [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:11.95      meas.None       finger:0 on E4  duration:0.35   v=-1       [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:11.9       meas.None       finger:0 on C5  duration:0.35   v=-1          [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:12.25      meas.None       finger:0 on C4  duration:0.6    v=-1             [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:12.2       meas.None       finger:0 on E4  duration:0.6    v=-1                [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:12.15      meas.None       finger:0 on C5  duration:0.6    v=-1                   [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:12.75      meas.None       finger:0 on C5  duration:0.35   v=-1                      [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:12.7       meas.None       finger:0 on E4  duration:0.35   v=-1                         [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:12.65      meas.None       finger:0 on C4  duration:0.35   v=-1                            [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:13.0       meas.None       finger:0 on C4  duration:0.6    v=-1    [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:12.95      meas.None       finger:0 on E-4 duration:0.6    v=-1       [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:12.9       meas.None       finger:0 on C5  duration:0.6    v=-1          [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:13.5       meas.None       finger:0 on C4  duration:0.6    v=-1             [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:13.45      meas.None       finger:0 on E-4 duration:0.6    v=-1                [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:13.4       meas.None       finger:0 on C5  duration:0.6    v=-1                   [0, 0, 0, 0, 0, 0, 0, 0, 0]
time:14.0       meas.None       finger:0 on C5  duration:0.6    v=-1                      [0, 0, 0, 0, 0, 0, 0, 0, 0]

No output.xml

After the program is finished processing, there is no output.xml file, or it is nowhere to be found. The first time running the program, it was found in the folder, but no longer. Also, the GUI Musescore function does not work, returning 'musescore' is not recognized as an internal or external command, operable program or batch file..

Incorrect Fingering

I tried this out on a simple scale, and it generated some.. interesting fingerings:
image

Basically just alternates 1 and 2 going up the scale, haha. Is this a limitation, or am I doing something wrong?

Attached the midi xml file:
export.zip

Problem installing

Hello!
The last month, i've been trying to install this program, but i just can't seem to do it.
I never worked with python before, but i managed to get pip install working now.
When i put in the pip install --upgrade pianoplayer , it says :

Collecting pianoplayer
Using cached pianoplayer-2.1.0.tar.gz (1.2 MB)
Collecting music21
Using cached music21-5.7.2.tar.gz (18.5 MB)
Collecting vtkplotter
Using cached vtkplotter-2020.3.1.tar.gz (18.4 MB)
ERROR: Could not find a version that satisfies the requirement vtk (from vtkplotter->pianoplayer) (from versions: none)
ERROR: No matching distribution found for vtk (from vtkplotter->pianoplayer)

when i then try to open the batch file, it just flashes and dissapears.
Could someone please help me out?
Thank you!
Regards,
Brend

Cannot visualize: `ERROR: texture file wood1 does not exist`

Hello. I'm trying to visualize my MIDI file with this command:

pianoplayer midi_file.midi -vz

However, the command fails with these errors:

[vedo.mesh.py:463] ERROR: texture file wood1 does not exist
[vedo.mesh.py:463] ERROR: texture file wood1 does not exist
Traceback (most recent call last):
  File "/home/hiroki/.local/bin/pianoplayer", line 224, in <module>
    vk = VirtualKeyboard(songname=xmlfn)
  File "/home/hiroki/.local/lib/python3.9/site-packages/pianoplayer/vkeyboard.py", line 41, in __init__
    self.build_keyboard()
  File "/home/hiroki/.local/lib/python3.9/site-packages/pianoplayer/vkeyboard.py", line 91, in build_keyboard
    self.vp += Text('PianoPlayer ^'+__version__+" ",
NameError: name 'Text' is not defined

I couldn't find the texture files on my computer. How can I get them?

I got trouble with this particular score

Traceback (most recent call last):
  File "/usr/local/bin/pianoplayer", line 155, in <module>
    rh.generateFingering(nmeasures=Nmeasures)
  File "/usr/local/lib/python2.7/dist-packages/pianoplayer/hand.py", line 221, in generateFingering
    bestfpos = self.set_fingers_positions(out, ninenotes, i)
  File "/usr/local/lib/python2.7/dist-packages/pianoplayer/hand.py", line 83, in set_fingers_positions
    newfpos[j]= self.fpos[j] + ni.x - ifx
TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'

Sample file: https://musescore.com/user/5506406/scores/2084736

How to show fingering numbers at the top of the notes of bass cleff

Hi,

Is there a way to show the finger numbers at the top of the notes of bass cleff, currently they are showing at the bottom.

I checked in "pianoplayer -h" but I didn't see an argument for that option, there is only an option to show the fingering numbers below the seam.

Is there a way?

Installing without Anaconda on Windows 10

Installing pianoplayer without Anaconda is possible with the following steps:

  1. If python is not already installed download it from https://www.python.org/downloads/windows/
    (choose preferably version 3.6) and install it the usual way

  2. Click the Start button and start typing sysdm.cpl and click OK. This opens the System Properties window.
    Navigate to the Advanced tab and select Environment Variables
    On the lower panel select Path and click Edit

    image

    Add now two new entries: (path may change depending on your system, e.g. if you installed version 3.6)
    "C:\Python36"
    "C:\Python36\Scripts"

    Click OK and close.

  3. Click the Start button and start typing cmd and click OK. This opens a new terminal.
    Install now pianoplayer. Type: (this may take some time to complete)
    pip install pianoplayer

    If the above fails type instead:
    pip install music21
    pip install --no-deps pianoplayer

  4. Place this file to your desktop. When you save it, make sure its extension is .bat (not .bat.txt)
    Edit it and change the path to:
    anaconda_path="C:\Python36"

  5. Double clicking the desktop icon will start the program.

AttributeError: 'Instrument' object has no attribute 'tie'

I'm getting the following error when running pianoplayer "xy.mid" --verbose -n10 -rvz
(tested on Windows with Python 3.8 & 3.7, and on Manjaro python 3.8)

Traceback (most recent call last):
  File "/home/anton/.local/bin/pianoplayer", line 195, in <module>
    rh.noteseq = reader(sf, beam=args.rbeam)
  File "/home/anton/.local/lib/python3.8/site-packages/pianoplayer/scorereader.py", line 51, in reader
    if n.tie and (n.tie.type=='continue' or n.tie.type=='stop'): continue
AttributeError: 'Instrument' object has no attribute 'tie'

Chords

Can the software give fingering for playing chords?

Musescore

When I press musescore nothing happens? Am I doing something wrong?

Hand size keeps defaulting to M, MuseScore3 not showing fingering

Running this on Windows, so not sure how much of it has to do with this!

Whenever I try to run it from either the GUI or command line using -S, -XS, etc, it defaults to M. It also seems to run through it twice (e.g., I see 'Your hand span set to size-M which is 17.22 cm
(max relaxed distance between thumb and pinkie)'
appear twice with the fingering output following it.

Additionally, opening the output.xml file in MuseScore3 does not show any fingering, just the music. Scanning through the output file XML doesn't seem to clearly show any fingering.

My apologies if this has already been addressed - I've searched through the issues and haven't seen anything in regard to these two issues!

Suggestion to UI

Instead of writing fingering numbers as lyrics, could you consider using MuseScore's fingering notation? I think it would be more ergonomic and aesthetically more pleasing.

consult

Hello, I also encountered a project about fingering. How can I run my data to your model?

Can't run on Win10

I have some issues trying to run pianoplayer on Win10. Python 3.11 and miniconda are installed (but I tryied also with the full Anaconda installation). I've done all the setup steps.

C:\Users\emamerlo\Downloads\pianoplayer-master>pip install pianoplayer
Requirement already satisfied: pianoplayer in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (2.2.1)
Requirement already satisfied: music21 in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from pianoplayer) (9.1.0)
Requirement already satisfied: vedo in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from pianoplayer) (2023.4.6)
Requirement already satisfied: chardet in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from music21->pianoplayer) (5.2.0)
Requirement already satisfied: joblib in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from music21->pianoplayer) (1.3.2)
Requirement already satisfied: jsonpickle in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from music21->pianoplayer) (3.0.2)
Requirement already satisfied: matplotlib in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from music21->pianoplayer) (3.7.2)
Requirement already satisfied: more-itertools in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from music21->pianoplayer) (10.1.0)
Requirement already satisfied: numpy in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from music21->pianoplayer) (1.25.2)
Requirement already satisfied: requests in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from music21->pianoplayer) (2.31.0)
Requirement already satisfied: webcolors>=1.5 in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from music21->pianoplayer) (1.13)
Requirement already satisfied: vtk in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from vedo->pianoplayer) (9.2.6)
Requirement already satisfied: Deprecated in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from vedo->pianoplayer) (1.2.14)
Requirement already satisfied: Pygments in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from vedo->pianoplayer) (2.16.1)
Requirement already satisfied: wrapt<2,>=1.10 in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from Deprecated->vedo->pianoplayer) (1.15.0)
Requirement already satisfied: contourpy>=1.0.1 in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from matplotlib->music21->pianoplayer) (1.1.0)
Requirement already satisfied: cycler>=0.10 in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from matplotlib->music21->pianoplayer) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from matplotlib->music21->pianoplayer) (4.42.1)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from matplotlib->music21->pianoplayer) (1.4.5)
Requirement already satisfied: packaging>=20.0 in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from matplotlib->music21->pianoplayer) (23.1)
Requirement already satisfied: pillow>=6.2.0 in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from matplotlib->music21->pianoplayer) (10.0.0)
Requirement already satisfied: pyparsing<3.1,>=2.3.1 in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from matplotlib->music21->pianoplayer) (3.0.9)
Requirement already satisfied: python-dateutil>=2.7 in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from matplotlib->music21->pianoplayer) (2.8.2)
Requirement already satisfied: charset-normalizer<4,>=2 in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from requests->music21->pianoplayer) (3.2.0)
Requirement already satisfied: idna<4,>=2.5 in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from requests->music21->pianoplayer) (3.4)
Requirement already satisfied: urllib3<3,>=1.21.1 in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from requests->music21->pianoplayer) (2.0.4)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from requests->music21->pianoplayer) (2023.7.22)
Requirement already satisfied: six>=1.5 in c:\users\emamerlo\appdata\local\programs\python\python311\lib\site-packages (from python-dateutil>=2.7->matplotlib->music21->pianoplayer) (1.16.0)

C:\Users\emamerlo\Downloads\pianoplayer-master>pianoplayer.bat
Starting pianoplayer...
La sintassi del nome del file, della directory o del volume non è corretta.
python: can't open file 'C:\\ProgramData\\miniconda3\\Scripts\\pianoplayer': [Errno 2] No such file or directory
Closing window...

if i copy the "pianoplayer" subfolder under the "Scripts" folder:

C:\Users\emamerlo\Downloads\pianoplayer-master>pianoplayer.bat
Starting pianoplayer...
La sintassi del nome del file, della directory o del volume non è corretta.
C:\Users\emamerlo\AppData\Local\Programs\Python\Python311\python.exe: can't find '__main__' module in 'C:\\ProgramData\\miniconda3\\Scripts\\pianoplayer'
Closing window...

I have a dataset of human tagged MIDI files. Can we chat?

I want to evaluate your method, and maybe improve it using a to-be-released dataset of tagged fingerings.
Please contact me via email, **************, I tried your cern address, got an auto-reject.

I would love to talk to you about this stuff.

Can't get it running on windows...

I have seen a few posts like mine and tried following some instructions, but still can't get it running on windows.

Not everyone is a programmer or has ability to follow 10 step instruction to amend windows registry install python and so on.

We windows users can however double click on the install icon and then double click on created icon to run a program. So, would it be possible to get an windows executable file that will run the GUI? It is a shame that we have something that seems to be a great program, that someone has put a lot of work to create it and 90% of people who would enjoy using it and who are not experts on computers can't even get it to run...

Odd results for some accidentals

This is a neat piece of software -- thanks for writing it!

I've been playing with it a bit and noticed that for some "weird" accidentals like Cb the program outputs bizarre fingering choices. If I rewrite the note as B the fingering makes much more sense. I haven't tried the other comparable accidentals (B#, E#, Fb) to know if this is a general or specific problem (nor have I looked at double sharps or double flats). You may not even be actively working on this software anymore, but in case you are this is a minor issue that could use correcting. Thanks!

Best,
Jeffrey

local variable 'ninenotes' referenced before assignment

I installed pianoplayer on windows 11 and imported a simple midi file. When click generate, the command line reports

Your hand span set to size-M which is 17.22 cm
(max relaxed distance between thumb and pinkie)
Reading beam 0 with 14 objects in stream.
Exception in Tkinter callback
Traceback (most recent call last):
  File "D:\Users\myhac\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 1921, in __call__
    return self.func(*args)
  File "D:\Users\myhac\AppData\Local\Programs\Python\Python310\Scripts\pianoplayer", line 83, in generateCMD
    self.rh.generate(nmeasures=self.meas.get())
  File "D:\Users\myhac\AppData\Local\Programs\Python\Python310\lib\site-packages\pianoplayer\hand.py", line 207, in generate
    self.set_fingers_positions(out, ninenotes, 0)
UnboundLocalError: local variable 'ninenotes' referenced before assignment

Enhancement: MIDI Output with encoded fingerings

Because MusicXML is nice for further editing, printing oder PDF output, but not ideal (and sometimes tricky or buggy) for automatic reading e.g. in player applications.
The idea is to provide an option to output the notes to a standard MIDI file with encoded fingerings. Music21 can output MIDI easily, however I do not know which features it supports.
Fingerings could be stored as text events or (what I would prefer) just use the channel information: You could easily store the fingering (1 - 10) as MIDI channel information (1 - 16), what would be ideal for further processing.

Output question

I ran your code and got this output:

pianoplayer output

I was wondering why all the notes are not numbered? Also, wasn't sure why it skipped the last measure. I had the max number of measures at 100.

the program said I could open it in musescore, so I was thinking it was done.

Corrupted output

Seems like some feature is not recognized correctly, output becomes fragmented, LH and RH become desynced ...
image

Exception in Tkinter Callback

Love this program as it's very helpful in learning fingering for new songs but getting an Exception in Tkinter calklback on a couple scores and hoping you might be able to help?

Saving score to output.xml
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\Matth\anaconda3\lib\tkinter\__init__.py", line 1705, in __call__
    return self.func(*args)
  File "C:\Users\Matth\anaconda3\Scripts\pianoplayer", line 93, in generateCMD
    sf.write('xml', fp='output.xml')
  File "C:\Users\Matth\anaconda3\lib\site-packages\music21\stream\__init__.py", line 252, in write
    return super().write(*args, **kwargs)
  File "C:\Users\Matth\anaconda3\lib\site-packages\music21\base.py", line 2562, in write
    return formatWriter.write(self, regularizedConverterFormat, fp, subformats, **keywords)
  File "C:\Users\Matth\anaconda3\lib\site-packages\music21\converter\subConverters.py", line 927, in write
    dataBytes = generalExporter.parse()
  File "C:\Users\Matth\anaconda3\lib\site-packages\music21\musicxml\m21ToXml.py", line 363, in parse
    outObj = self.fromGeneralObject(obj)
  File "C:\Users\Matth\anaconda3\lib\site-packages\music21\musicxml\m21ToXml.py", line 399, in fromGeneralObject
    outObj = meth(obj)
  File "C:\Users\Matth\anaconda3\lib\site-packages\music21\musicxml\m21ToXml.py", line 411, in fromScore
    scOut = sc.makeNotation(inPlace=False)
  File "C:\Users\Matth\anaconda3\lib\site-packages\music21\stream\__init__.py", line 13127, in makeNotation
    **subroutineKeywords)
  File "C:\Users\Matth\anaconda3\lib\site-packages\music21\stream\__init__.py", line 6040, in makeNotation
    bestClef=bestClef)
  File "C:\Users\Matth\anaconda3\lib\site-packages\music21\stream\__init__.py", line 5765, in makeMeasures
    inPlace=inPlace,
  File "C:\Users\Matth\anaconda3\lib\site-packages\music21\stream\makeNotation.py", line 577, in makeMeasures
    'within any measures' % (e, start, end))
music21.exceptions21.StreamException: cannot place element Piano with start/end 180.0/180.0 within any measures

On a different score I get the following error:

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

I did some research and found the following:
This error occurs when you run a program using the Canvas library (used from Unit 2 onwards) more than once. This is a known problem with Canvas, and is not caused by your programming. The only solution is to close all Python windows then re-run IDLE after each time you run your program.

Not sure if the above is relevant. Any idea on how to fix the issue?

cannot find vtkplotter package

I receive the following error on Windows 10 and Ubuntu 18.04 as well after I import a score and click on 3D player in the GUI.

VirtualKeyboard: cannot find vtkplotter package. Not installed?
Try:
(sudo) pip install --upgrade vtkplotter

Any idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.