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

local variable 'ninenotes' referenced before assignment #52

Open
Kobe972 opened this issue Feb 12, 2023 · 5 comments
Open

local variable 'ninenotes' referenced before assignment #52

Kobe972 opened this issue Feb 12, 2023 · 5 comments

Comments

@Kobe972
Copy link

Kobe972 commented Feb 12, 2023

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
@pmatos
Copy link

pmatos commented Jun 18, 2023

I got the same issue here. Such an interesting project. Shame that this is still happening and has not been fixed yet.

Linux user here, used attached midi file and the following command line:

pianoplayer -o scientist-annotated.xml -v -M scientist-coldplay.midi

scientist-coldplay.midi.gz

@pmatos
Copy link

pmatos commented Jun 18, 2023

@marcomusy Are you still interested in fixing this? ^

@pmatos
Copy link

pmatos commented Jun 18, 2023

I think this might have been fixed post release, so using git HEAD of master might work.

@pmatos
Copy link

pmatos commented Jun 18, 2023

Unfortunately even in git HEAD of master, ninenotes is undefined in generate, if we take the if i > N - 10: branch.

if i > N - 10:

@marcomusy
Copy link
Owner

Hi I just uploaded a patch in pip:

pip install pianoplayer -U

Caveat:
the minimum nr of notes to process must be 9 (in the lower beam you had 8), and for chords the output is not very good anyway (but fingering chords has never been a problem..).

scientist-coldplay.mscz.gz

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