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

"pychord.analyzer.note_to_chord" wrong chord calculated #26

Open
mullerjurgen opened this issue Feb 5, 2019 · 3 comments
Open

"pychord.analyzer.note_to_chord" wrong chord calculated #26

mullerjurgen opened this issue Feb 5, 2019 · 3 comments
Assignees
Labels

Comments

@mullerjurgen
Copy link

Dear all,
the example on the bottom shows the problems with "pychord.analyzer.note_to_chord"
Calling this function the second time using the same parameters returns a different result.
Debugging shows that def: "find_quality" in "pychord/pychord/analyzer.py" has a reference to "QUALITY_DICT" that includes crahed data in "dim6". Try this example and you will see.


-- coding: utf-8 --

#!/usr/bin/env python3

Imports

from future import print_function
import sys
from pychord.analyzer import note_to_chord
from pychord.utils import val_to_note

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Constants
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
k_NOTE_OFF = 0
k_NOTE_ON = 1

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Chords
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

def chord_receive(info,n1,n2,n3,n4):

print("\n",info,"  --------------------")
print("----with notes",  n1,n2,n3,n4)

a_chords = note_to_chord([n1,n2,n3,n4])
print("--------",a_chords)

for a_chord in a_chords:
    print('------------a_chordStr=%s' % (a_chord))
    print("------------components", a_chord.components(True))

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Main
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
try:
chord_receive("first","D","F","G#","B")
chord_receive("second","D","F","G#","B")

except KeyboardInterrupt:
pass

@yuma-m yuma-m self-assigned this Feb 6, 2019
yuma-m added a commit that referenced this issue Feb 6, 2019
@yuma-m
Copy link
Owner

yuma-m commented Feb 6, 2019

@mullerjurgen
Thank you for reporting the bug.
I fixed it in #27 and it will work like below.

>>> from pychord.analyzer import note_to_chord
>>> cs = note_to_chord(["D","F","G#","B"])
>>> cs
[<Chord: Ddim6>, <Chord: Fdim6/D>, <Chord: G#dim6/D>, <Chord: Bdim6/D>]
>>> cs[0].components(visible=True)
['D', 'F', 'G#', 'B']
>>> for c in cs:
...     print(c.components(True))
...     
['D', 'F', 'G#', 'B']
['D', 'F', 'Ab', 'B', 'D']
['D', 'G#', 'B', 'D', 'F']
['D', 'B', 'D', 'F', 'G#']
>>> cs = note_to_chord(["D","F","G#","B"])
>>> for c in cs:
...     print(c.components(True))
...     
['D', 'F', 'G#', 'B']
['D', 'F', 'Ab', 'B', 'D']
['D', 'G#', 'B', 'D', 'F']
['D', 'B', 'D', 'F', 'G#']

@yuma-m yuma-m added the bug label Feb 6, 2019
@mullerjurgen
Copy link
Author

mullerjurgen commented Feb 7, 2019 via email

@yuma-m
Copy link
Owner

yuma-m commented Feb 12, 2019

Hello Jürgen,

Thank you for reporting the issue.
I have never tried to use pychord realtime, but this bug seems very interesting and important.

What do you think, shall I open a new issue?

Yes, would you mind opening a new issue with the program which can reproduce the bug?
I also have MIDI devices, I will check it with my environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants