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)
| 60 | |
| 61 | |
| 62 | def 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 | |
| 89 | class _Scale(object): |
nothing calls this directly
no test coverage detected