c = mus.Chord("Am7")
print(c.info())

"""
Explanation: Intro to pychord
Create a Chord
End of explanation
"""


c = mus.Chord("C")
c.transpose(2)
c

c = mus.Chord("Dm/G")
c.transpose(3)
c

"""
Explanation: Transpose a Chord
End of explanation
"""


c = mus.Chord("Dm7")
c.components()

"""
Explanation: Get Component Notes
End of explanation
"""


c = mus.note_to_chord(['C', 'E', 'G'])
print(c)
print(mus.note_to_chord(["F", "G", "C"]))
print("Ddim7:", mus.note_to_chord(["D", "F", "Ab", "Cb"]))
# mus.Chord("Ddim7") # => ValueError: Unknown quality: dim7
print(mus.Chord("Ddim6").components())
print(mus.note_to_chord(['D', 'F', 'Ab', 'Bb'])) 
print("Dbdim7=Db E G Bb: ", mus.note_to_chord(["Db", "E", "G", "Bb"]))
print("BbM6=Bb D F G", mus.note_to_chord(["Bb", "D", "F", "G"]))

"""
Explanation: Find Chords
End of explanation
"""


cp = mus.ChordProgression(["C", "G/B", "Am"])
print(cp)
cp.append("Em/G")
print(cp)
cp.transpose(+3)
print(cp)

"""
Explanation: Chord Progressions
End of explanation
"""


print(mus.Chord.from_note_index(note=1, quality="", scale="Cmaj"))
print(mus.Chord.from_note_index(note=3, quality="m7", scale="Fmaj"))
print(mus.Chord.from_note_index(note=5, quality="7", scale="Amin"))

"""
Explanation: Create a Chord from Note Index in a Scale
End of explanation
"""


chordList = [ "EbM7", "Cm6", "Dm7", "Dbdim6", "Cm7", "BM7", "Bb6"]
chords = [mus.Chord(c) for c in chordList]
for c in chordList:
    print(f"{c} - ", mus.Chord(c).components())

create_midi('/Users/af59986/Dev/presentations/music/hoffman-a_letter_for_alex.midi', chords)


"""
Explanation: Overwrite the default Quality components with yours
```python



from pychord import Chord, QualityManager
Chord("C11").components()
['C', 'G', 'Bb', 'D', 'F']
quality_manager = QualityManager()
quality_manager.set_quality("11", (0, 4, 7, 10, 14, 17))
Chord("C11").components()
['C', 'E', 'G', 'Bb', 'D', 'F']
```



Hoffman's - A Letter for Alexandr(i)a
End of explanation
"""


# working around pychord
print("Gaug7:", mus.note_to_chord('G B D# F'.split()))
print("Bbdim7:", mus.note_to_chord("Bb Db E G".split()))
print("Bb7:", mus.Chord("Bb7").components())
print("Bb7+11:", mus.Chord("Bb7+11").components())
print("BbM7:", mus.Chord("BbM7").components_with_pitch(4))
# print("BbM7+11:", mus.Chord("BbM7+11").components())
print("BbM7+11:", mus.note_to_chord(['Bb', 'D', 'F', 'A', 'E']))
print("Bbadd11:", mus.Chord("Bbadd11").components())
# print("BbMadd9:", mus.Chord("BbMadd").components())
# print("BbM7add11:", mus.Chord("BbM7add11").components())
# print("Bb7add11:", mus.Chord("Bb7add11").components())
# print("Bbm7add11:", mus.Chord("Bbm7add11").components())
# print("BbM7add#11", mus.note_to_chord('Bb D F A E'.split()))
print("Bm7#5:", mus.note_to_chord("B D G A".split()))
print("B6:", mus.Chord("B6").components())
print("Bb6:", mus.Chord("Bb6").components())
print("Bm7b5:", mus.Chord("Bm7b5").components())
print("Absus2-7#5", mus.note_to_chord('Ab Bb D Gb'.split()))

# section_a = chorder('Bm7, D9, AbM7, GM7, G7+5, Bbdim6')
section_a = chorder('Bm7, D9, GM7, G7+5')
section_b = chorder('Bm7, Bbm7, Bm7, C7')
# section_c = chorder('Dm7, Em7, Bm7b5, BbM7, Absus2, Gmaj7')
section_c = chorder('Dm7, Em7, Bm7b5, BbM7, Bb7+5/Ab, Gmaj7')

# song = sum([section_a,section_b, section_a, section_b, section_c], [])
song = section_a + section_b + section_a + section_b + section_c
print(song)

create_midi('/Users/af59986/Dev/presentations/music/hoffman-physics2.midi', song)


"""
Explanation: Hoffman's Physics Song
End of explanation
"""


