Skip to content

Commit

Permalink
Accidentally broke key.Key('F#m') etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
mscuthbert committed May 2, 2022
1 parent 3740e3b commit bb1fc84
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion music21/harmony.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def key(self):
>>> [str(p) for p in h1.pitches]
['D-2', 'F-2', 'A-2', 'C-3', 'E-3', 'G-3']
>>> h1.key = 'CM'
>>> h1.key = 'CM' # = C-Major
>>> [str(p) for p in h1.pitches]
['D-2', 'F-2', 'A-2', 'C-3', 'E-3', 'G-3']
Expand Down
14 changes: 9 additions & 5 deletions music21/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,15 +775,12 @@ def transposePitchFromC(self, p: pitch.Pitch, *, inPlace=False) -> Optional[pitc
'B--4'
If inPlace is True then the original pitch is
modified.
modified and nothing is returned.
>>> p5 = pitch.Pitch('C5')
>>> ks.transposePitchFromC(p5, inPlace=True)
<music21.pitch.Pitch E-5>
>>> p5.nameWithOctave
'E-5'
Changed in v8: original pitch returned if inPlace=True
'''
transInterval = None
transTimes = 0
Expand Down Expand Up @@ -920,6 +917,13 @@ class Key(KeySignature, scale.DiatonicScale):
<music21.pitch.Pitch D5>,
<music21.pitch.Pitch E5>]
If you prefer not to use uppercase and lowercase to distinguish major and minor,
the shorthand of CM or Cm can also be used:
>>> key.Key('EM')
<music21.key.Key of E major>
>>> key.Key('F#m')
<music21.key.Key of f# minor>
'''
_sharps = 0
_mode = None
Expand Down Expand Up @@ -955,7 +959,7 @@ def __init__(self,
elif isinstance(tonic, note.Note):
tonicPitch = tonic.pitch
else:
tonicPitch = pitch.Pitch(tonic)
tonicPitch = pitch.Pitch(tonicStr)

KeySignature.__init__(self, sharps)
scale.DiatonicScale.__init__(self, tonic=tonicPitch)
Expand Down

0 comments on commit bb1fc84

Please sign in to comment.