MCPcopy Create free account
hub / github.com/bspaans/python-mingus / determine

Function determine

mingus/core/scales.py:62–86  ·  view source on GitHub ↗

Determine the scales containing the notes. All major and minor scales are recognized. Example: >>> determine(['A', 'Bb', 'E', 'F#', 'G']) ['G melodic minor', 'G Bachian', 'D harmonic major']

(notes)

Source from the content-addressed store, hash-verified

60
61
62def determine(notes):
63 """Determine the scales containing the notes.
64
65 All major and minor scales are recognized.
66
67 Example:
68 >>> determine(['A', 'Bb', 'E', 'F#', 'G'])
69 ['G melodic minor', 'G Bachian', 'D harmonic major']
70 """
71 notes = set(notes)
72 res = []
73
74 for key in keys:
75 for scale in _Scale.__subclasses__():
76 if scale.type == "major":
77 if notes <= set(scale(key[0]).ascending()) or notes <= set(
78 scale(key[0]).descending()
79 ):
80 res.append(scale(key[0]).name)
81 elif scale.type == "minor":
82 if notes <= set(
83 scale(get_notes(key[1])[0]).ascending()
84 ) or notes <= set(scale(get_notes(key[1])[0]).descending()):
85 res.append(scale(get_notes(key[1])[0]).name)
86 return res
87
88
89class _Scale(object):

Callers

nothing calls this directly

Calls 3

get_notesFunction · 0.90
ascendingMethod · 0.45
descendingMethod · 0.45

Tested by

no test coverage detected