# should cache this.
def find_scale (keysig):
cscale = map (lambda x: (x,0), range (0,7))
- print "cscale: ", cscale
+# print "cscale: ", cscale
ascale = map (lambda x: (x,0), range (-2,5))
- print "ascale: ", ascale
+# print "ascale: ", ascale
transposition = keysig.pitch
if keysig.sig_type == 1:
transposition = transpose(transposition, (2, -1))
trscale = map(lambda x, k=transposition: transpose(x, k), ascale)
else:
trscale = map(lambda x, k=transposition: transpose(x, k), cscale)
- print "trscale: ", trscale
+# print "trscale: ", trscale
return trscale
def EDU_to_duration (edu):
dots = 2
return (log, dots)
-def rat_to_lily_duration (rat):
+def rational_to_lily_skip (rat):
(n,d) = rat
basedur = 1
str = str + ' ' * 4 + line + '\n'
line = ''
- str = """\nverse%s = \\lyricmode {\n %s}\n""" % (encodeint (self.number - 1) ,str)
+ str = """\nverse%s = \\lyricmode {\n %s }\n""" % (encodeint (self.number - 1) ,str)
return str
class KeySignature:
# do grace notes.
lastch = None
+ in_grace = 0
for c in self.chords:
if c.grace and (lastch == None or (not lastch.grace)):
c.chord_prefix = r'\grace {' + c.chord_prefix
+ in_grace = 1
elif not c.grace and lastch and lastch.grace:
lastch.chord_suffix = lastch.chord_suffix + ' } '
-
+ in_grace = 0
+
lastch = c
-
+
+ if lastch and in_grace:
+ lastch.chord_suffix += '}'
def dump (self):
sys.stderr.write ("""\nHuh? Going backwards in frame no %d, start/end (%d,%d)""" % (self.number, self.start, self.end))
left = (0,1)
if left[0]:
- str = str + rat_to_lily_duration (left)
+ str = str + rational_to_lily_skip (left)
str = str + ' | \n'
return str
last_clef = m.clef
if e:
if gap <> (0,1):
- k = k +' ' + rat_to_lily_duration (gap) + '\n'
+ k = k +' ' + rational_to_lily_skip (gap) + '\n'
gap = (0,1)
k = k + e
if fr:
first_frame = fr
if gap <> (0,1):
- laystr = laystr +'} %s {\n ' % rat_to_lily_duration (gap)
+ laystr = laystr +'} %s {\n ' % rational_to_lily_skip (gap)
gap = (0,1)
laystr = laystr + fr.dump ()
else:
% (self.number, m.number))
if first_frame:
l = self.layerid (x)
- laystr = '%s = { { %s } }\n\n' % (l, laystr)
+ laystr = '%s = { { %s } }\n\n' % (l, laystr)
str = str + laystr
layerids.append (l)
sys.stderr.write ("\nLyrics found; edit to use \\addlyrics to couple to a staff\n")
if staffs:
- str = str + '\\score { << %s >> } ' % string.join (staffs)
+ str += '\\version "2.3.25"\n'
+ str = str + '<<\n %s\n>> } ' % string.join (staffs)
return str