]> git.donarmstrong.com Git - lilypond.git/commitdiff
MusicXML: Add a way to force a pitch output to be in absolute pitch
authorReinhold Kainhofer <reinhold@kainhofer.com>
Tue, 18 Nov 2008 19:16:19 +0000 (20:16 +0100)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Tue, 18 Nov 2008 20:51:21 +0000 (21:51 +0100)
Even when we convert in relative pitch mode, some pitches will still
need to be written out in absolute pitch. Examples are the arguments
of \transposition or \transpose...

python/musicexp.py

index 22cfcdcd53888461e0020fd778ed0eae861b8cf2..e0f3f52c979ab50e5a97e85842af2fbe697bc19c 100644 (file)
@@ -271,6 +271,7 @@ class Pitch:
         self.alteration = 0
         self.step = 0
         self.octave = 0
+        self._force_absolute_pitch = False
         
     def __repr__(self):
         return self.ly_expression()
@@ -340,7 +341,7 @@ class Pitch:
 
     def ly_expression (self):
         str = self.ly_step_expression ()
-        if relative_pitches:
+        if relative_pitches and not self._force_absolute_pitch:
             str += self.relative_pitch ()
         else:
             str += self.absolute_pitch ()