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

method ConcreteScale.deriveByDegree not working for scale.MelodicMinorScale for some degrees #1649

Open
me-kell opened this issue Sep 23, 2023 · 1 comment

Comments

@me-kell
Copy link

me-kell commented Sep 23, 2023

music21 version

9.1.0

Problem summary

The method ConcreteScale.deriveByDegree is not working for scale.MelodicMinorScale for some degrees (e.g. 6, and 7).

Steps to reproduce

>>> scale.MelodicMinorScale('c').deriveByDegree(6, 'c')

...
music21.scale.intervalNetwork.IntervalNetworkException: could not find any edges

All other scales and degrees seem to work as expected.

for s in [
    scale.MelodicMinorScale,
    scale.MinorScale,
    scale.MajorScale,
    scale.HarmonicMinorScale,
    scale.OctatonicScale,
    scale.WholeToneScale,
    scale.ChromaticScale,
]:
    sc = s('c')
    print(sc.name)
    print([p.name for p in sc.pitches])
    for i in range(1, len(sc.pitches)):
        try:
            derived1 = sc.deriveByDegree(i, "c")
            pitches = [p.name for p in derived1.pitches]
        except Exception as e:
            pitches = f"Exception: {e}"
        print(i, pitches)

Expected vs. actual behavior

Actual behaviour: see output on C melodic minor for degrees 6 and 7.

C melodic minor
['C', 'D', 'E-', 'F', 'G', 'A', 'B', 'C']
1 ['C', 'D', 'E-', 'F', 'G', 'A', 'B', 'C']
2 ['B-', 'C', 'D-', 'E-', 'F', 'G', 'A', 'B-']
3 ['A', 'B', 'C', 'D', 'E', 'F#', 'G#', 'A']
4 ['G', 'A', 'B-', 'C', 'D', 'E', 'F#', 'G']
5 ['F', 'G', 'A-', 'B-', 'C', 'D', 'E', 'F']
6 Exception: could not find any edges
7 Exception: could not find any edges
C minor
['C', 'D', 'E-', 'F', 'G', 'A-', 'B-', 'C']
1 ['C', 'D', 'E-', 'F', 'G', 'A-', 'B-', 'C']
2 ['B-', 'C', 'D-', 'E-', 'F', 'G-', 'A-', 'B-']
3 ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'A']
4 ['G', 'A', 'B-', 'C', 'D', 'E-', 'F', 'G']
5 ['F', 'G', 'A-', 'B-', 'C', 'D-', 'E-', 'F']
6 ['E', 'F#', 'G', 'A', 'B', 'C', 'D', 'E']
7 ['D', 'E', 'F', 'G', 'A', 'B-', 'C', 'D']
C major
['C', 'D', 'E', 'F', 'G', 'A', 'B', 'C']
1 ['C', 'D', 'E', 'F', 'G', 'A', 'B', 'C']
2 ['B-', 'C', 'D', 'E-', 'F', 'G', 'A', 'B-']
3 ['A-', 'B-', 'C', 'D-', 'E-', 'F', 'G', 'A-']
4 ['G', 'A', 'B', 'C', 'D', 'E', 'F#', 'G']
5 ['F', 'G', 'A', 'B-', 'C', 'D', 'E', 'F']
6 ['E-', 'F', 'G', 'A-', 'B-', 'C', 'D', 'E-']
7 ['D-', 'E-', 'F', 'G-', 'A-', 'B-', 'C', 'D-']
C harmonic minor
['C', 'D', 'E-', 'F', 'G', 'A-', 'B', 'C']
1 ['C', 'D', 'E-', 'F', 'G', 'A-', 'B', 'C']
2 ['B-', 'C', 'D-', 'E-', 'F', 'G-', 'A', 'B-']
3 ['A', 'B', 'C', 'D', 'E', 'F', 'G#', 'A']
4 ['G', 'A', 'B-', 'C', 'D', 'E-', 'F#', 'G']
5 ['F', 'G', 'A-', 'B-', 'C', 'D-', 'E', 'F']
6 ['E', 'F#', 'G', 'A', 'B', 'C', 'D#', 'E']
7 ['D-', 'E-', 'F-', 'G-', 'A-', 'B--', 'C', 'D-']
C Octatonic
['C', 'D', 'E-', 'F', 'G-', 'A-', 'A', 'B', 'C']
1 ['C', 'D', 'E-', 'F', 'G-', 'A-', 'A', 'B', 'C']
2 ['B-', 'C', 'D-', 'E-', 'F-', 'G-', 'G', 'A', 'B-']
3 ['A', 'B', 'C', 'D', 'E-', 'F', 'G-', 'A-', 'A']
4 ['G', 'A', 'B-', 'C', 'D-', 'E-', 'F-', 'G-', 'G']
5 ['G-', 'A-', 'A', 'B', 'C', 'D', 'E-', 'F', 'G-']
6 ['F-', 'G-', 'G', 'A', 'B-', 'C', 'D-', 'E-', 'F-']
7 ['E-', 'F', 'G-', 'A-', 'A', 'B', 'C', 'D', 'E-']
8 ['D-', 'E-', 'F-', 'G-', 'G', 'A', 'B-', 'C', 'D-']
C Whole tone
['C', 'D', 'E', 'F#', 'G#', 'A#', 'B#']
1 ['C', 'D', 'E', 'F#', 'G#', 'A#', 'B#']
2 ['B-', 'C', 'D', 'E', 'F#', 'G#', 'A#']
3 ['A-', 'B-', 'C', 'D', 'E', 'F#', 'G#']
4 ['G-', 'A-', 'B-', 'C', 'D', 'E', 'F#']
5 ['F-', 'G-', 'A-', 'B-', 'C', 'D', 'E']
6 ['D', 'E', 'F#', 'G#', 'A#', 'B#', 'D']
C Chromatic
['C', 'C#', 'D', 'E-', 'E', 'F', 'F#', 'G', 'A-', 'A', 'B-', 'B', 'C']
1 ['C', 'C#', 'D', 'E-', 'E', 'F', 'F#', 'G', 'A-', 'A', 'B-', 'B', 'C']
2 ['B', 'C', 'C#', 'D', 'E-', 'E', 'F', 'F#', 'G', 'A-', 'A', 'B-', 'B']
3 ['B-', 'B', 'C', 'C#', 'D', 'E-', 'E', 'F', 'F#', 'G', 'A-', 'A', 'B-']
4 ['A', 'B-', 'B', 'C', 'C#', 'D', 'E-', 'E', 'F', 'F#', 'G', 'A-', 'A']
5 ['G#', 'A', 'B-', 'B', 'C', 'C#', 'D', 'E-', 'E', 'F', 'F#', 'G', 'A-']
6 ['G', 'A-', 'A', 'B-', 'B', 'C', 'C#', 'D', 'E-', 'E', 'F', 'F#', 'G']
7 ['F#', 'G', 'A-', 'A', 'B-', 'B', 'C', 'C#', 'D', 'E-', 'E', 'F', 'F#']
8 ['F', 'F#', 'G', 'A-', 'A', 'B-', 'B', 'C', 'C#', 'D', 'E-', 'E', 'F']
9 ['E', 'F', 'F#', 'G', 'A-', 'A', 'B-', 'B', 'C', 'C#', 'D', 'E-', 'E']
10 ['E-', 'E', 'F', 'F#', 'G', 'A-', 'A', 'B-', 'B', 'C', 'C#', 'D', 'E-']
11 ['D', 'E-', 'E', 'F', 'F#', 'G', 'A-', 'A', 'B-', 'B', 'C', 'C#', 'D']
12 ['C#', 'D', 'E-', 'E', 'F', 'F#', 'G', 'A-', 'A', 'B-', 'B', 'C', 'C#']
@me-kell
Copy link
Author

me-kell commented Sep 23, 2023

I'm not sure but the edges of the intervaleNetwork of the MelodicMinorScale have a different pattern/structure than in other scales. Specially #6 and #7:

for s in [
    scale.MelodicMinorScale,
    scale.MinorScale,
    scale.MajorScale,
    scale.HarmonicMinorScale,
    scale.OctatonicScale,
    scale.WholeToneScale,
    scale.ChromaticScale,
]:
    sc = s('c')
    print(sc.name)
    pprint.pprint(sc._abstract._net.edges)
C melodic minor
OrderedDict([(0, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(Terminus.LOW, 0), (0, Terminus.LOW)]>),
             (1, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(0, 1), (1, 0)]>),
             (2, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(1, 2), (2, 1)]>),
             (3, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(2, 3), (3, 2)]>),
             (4, <music21.scale.intervalNetwork.Edge Direction.ASCENDING M2 [(3, 4)]>),
             (5, <music21.scale.intervalNetwork.Edge Direction.ASCENDING M2 [(4, 6)]>),
             (6, <music21.scale.intervalNetwork.Edge Direction.ASCENDING m2 [(6, Terminus.HIGH)]>),
             (7, <music21.scale.intervalNetwork.Edge Direction.DESCENDING M2 [(Terminus.HIGH, 7)]>),
             (8, <music21.scale.intervalNetwork.Edge Direction.DESCENDING M2 [(7, 5)]>),
             (9, <music21.scale.intervalNetwork.Edge Direction.DESCENDING m2 [(5, 3)]>)])
C minor
OrderedDict([(0, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(Terminus.LOW, 0), (0, Terminus.LOW)]>),
             (1, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(0, 1), (1, 0)]>),
             (2, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(1, 2), (2, 1)]>),
             (3, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(2, 3), (3, 2)]>),
             (4, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(3, 4), (4, 3)]>),
             (5, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(4, 5), (5, 4)]>),
             (6, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(5, Terminus.HIGH), (Terminus.HIGH, 5)]>)])
C major
OrderedDict([(0, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(Terminus.LOW, 0), (0, Terminus.LOW)]>),
             (1, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(0, 1), (1, 0)]>),
             (2, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(1, 2), (2, 1)]>),
             (3, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(2, 3), (3, 2)]>),
             (4, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(3, 4), (4, 3)]>),
             (5, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(4, 5), (5, 4)]>),
             (6, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(5, Terminus.HIGH), (Terminus.HIGH, 5)]>)])
C harmonic minor
OrderedDict([(0, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(Terminus.LOW, 0), (0, Terminus.LOW)]>),
             (1, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(0, 1), (1, 0)]>),
             (2, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(1, 2), (2, 1)]>),
             (3, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(2, 3), (3, 2)]>),
             (4, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(3, 4), (4, 3)]>),
             (5, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(4, 5), (5, 4)]>),
             (6, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(5, Terminus.HIGH), (Terminus.HIGH, 5)]>)])
C Octatonic
OrderedDict([(0, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(Terminus.LOW, 0), (0, Terminus.LOW)]>),
             (1, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(0, 1), (1, 0)]>),
             (2, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(1, 2), (2, 1)]>),
             (3, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(2, 3), (3, 2)]>),
             (4, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(3, 4), (4, 3)]>),
             (5, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(4, 5), (5, 4)]>),
             (6, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(5, 6), (6, 5)]>),
             (7, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(6, Terminus.HIGH), (Terminus.HIGH, 6)]>)])
C Whole tone
OrderedDict([(0, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(Terminus.LOW, 0), (0, Terminus.LOW)]>),
             (1, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(0, 1), (1, 0)]>),
             (2, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(1, 2), (2, 1)]>),
             (3, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(2, 3), (3, 2)]>),
             (4, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(3, 4), (4, 3)]>),
             (5, <music21.scale.intervalNetwork.Edge Direction.BI M2 [(4, Terminus.HIGH), (Terminus.HIGH, 4)]>)])
C Chromatic
OrderedDict([(0, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(Terminus.LOW, 0), (0, Terminus.LOW)]>),
             (1, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(0, 1), (1, 0)]>),
             (2, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(1, 2), (2, 1)]>),
             (3, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(2, 3), (3, 2)]>),
             (4, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(3, 4), (4, 3)]>),
             (5, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(4, 5), (5, 4)]>),
             (6, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(5, 6), (6, 5)]>),
             (7, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(6, 7), (7, 6)]>),
             (8, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(7, 8), (8, 7)]>),
             (9, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(8, 9), (9, 8)]>),
             (10, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(9, 10), (10, 9)]>),
             (11, <music21.scale.intervalNetwork.Edge Direction.BI m2 [(10, Terminus.HIGH), (Terminus.HIGH, 10)]>)])

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

1 participant