+def conv (str):
+ def sub_alteration (m):
+ alt = m.group (3)
+ alt = {
+ '-1': 'FLAT',
+ '-2': 'DOUBLE-FLAT',
+ '0': 'NATURAL',
+ '1': 'SHARP',
+ '2': 'DOUBLE-SHARP',
+ }[alt]
+
+ return '(ly:make-pitch %s %s %s)' % (m.group(1), m.group (2), alt)
+
+ str =re.sub ("\\(ly:make-pitch *([0-9-]+) *([0-9-]+) *([0-9-]+) *\\)", sub_alteration, str)
+ return str
+conversions.append (((1,9,7), conv, 'use symbolic constants for alterations.'))
+