Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions music21/pitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4721,9 +4721,8 @@ def transpose(
# set fundamental
self.fundamental = p.fundamental
self.spellingIsInferred = p.spellingIsInferred
# deepcopy _microtone if present (not thru microtone property to detect None)
if p._microtone is not None:
self._microtone = copy.deepcopy(p._microtone)
# deepcopy _microtone (not thru microtone property to detect None)
self._microtone = copy.deepcopy(p._microtone)
return None

# --------------------------------------------------------------------------
Expand Down
7 changes: 7 additions & 0 deletions music21/test/test_pitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from music21 import converter
from music21 import corpus
from music21 import editorial
from music21 import interval
from music21 import key
from music21 import note
from music21 import pitch
Expand Down Expand Up @@ -801,6 +802,12 @@ def testLowNotes(self):
self.assertEqual(lowC.name, 'C')
self.assertEqual(lowC.octave, -1)

def testTransposeInPlaceReplacesMicrotone(self):
p = Pitch('C4')
p.microtone = 50
p.transpose(interval.ChromaticInterval(0.5), inPlace=True)
self.assertEqual(str(p), 'C#4')

def testQuarterToneA(self):
p1 = Pitch('D#~')
# environLocal.printDebug([p1, p1.accidental])
Expand Down
Loading