2004-10-29 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * Documentation/user/notation.itely (Automatic note splitting):
+ note about lyrics.
+
+ * Documentation/user/converters.itely (Invoking convert-ly): note
+ about version numbers.
+
+ * scripts/abc2ly.py (dump_score): revise lyric dumping
+
+ * scripts/mup2ly.py (pre_processor_commands): always open file.
+
+ * scripts/etf2ly.py (Frame.calculate): always close \grace.
+ (Etf_file.dump): add \version
+
+ * VERSION: 2.3.25 released.
+
* lily/scm-option.cc: add 'resolution to ly:get-option argument
list.
Print usage help.
@end table
-
+convert-ly always converts up to the last syntax change handled by
+it. This means that the @code{\version} number left in the file is
+usually lower than the version of convert-ly itself.
@refbugs
represented exactly with normal notes and dots, but the engraver will
not insert tuplets.
+The @internalsref{Completion_heads_engraver} can be combined with
+@code{\lyricsto} or @code{\addlyrics}.
+
@seealso
Examples: @inputfileref{input/regression,completion-heads.ly}.
global_key = [0] * 7 # UGH
names = ["One", "Two", "Three"]
DIGITS='0123456789'
-alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
HSPACE=' \t'
midi_specs = ''
if strict:
sys.exit (1)
+
+def alphabet (i):
+ return chr (i + ord('A'))
def check_clef(s):
if not s:
elif keyword == "name":
value = re.sub ('\\\\','\\\\\\\\', value)
## < 2.2
- ##voices_append ("\\property Staff.instrument = %s\n" % value )
voices_append ("\\set Staff.instrument = %s\n" % value )
__main__.part_names = 1
elif keyword == "sname" or keyword == "snm":
- ##voices_append ("\\property Staff.instr = %s\n" % value )
voices_append ("\\set Staff.instr = %s\n" % value )
else:
break
def dump_lyrics (outf):
if (len(lyrics)):
- outf.write("\n\\score\n{\n \\context Lyrics\n <<\n")
+ outf.write("\n\\score\n{\n \\lyrics\n <<\n")
for i in range (len (lyrics)):
outf.write ( lyrics [i])
outf.write ("\n")
Nowadays abc2ly outputs explicits barlines (?)
"""
## < 2.2
- ##outf.write ("\n\\property Score.defaultBarType = \"empty\"\n")
outf.write ("\n\\set Score.defaultBarType = \"empty\"\n")
ks.sort ()
for k in ks:
if re.match('[1-9]', k):
- m = alphabet[string.atoi(k)]
+ m = chr(string.atoi(k) + 'A')
else:
m = k
for i in range (len(slyrics[voice_idx_dict[k]])):
- l=alphabet[i]
- outf.write ("\nwords%sV%s = {" % (m, l))
+ l= alphabet(i)
+ outf.write ("\nwords%sV%s = \lyricmode {" % (m, l))
outf.write ("\n" + slyrics [voice_idx_dict[k]][i])
outf.write ("\n}")
ks.sort ()
for k in ks:
if re.match ('[1-9]', k):
- m = alphabet[string.atoi(k)]
+ m = chr(string.atoi(k) + 'A')
else:
m = k
outf.write ("\nvoice%s = {" % m)
sys.stderr.write("abc2ly: Warning, unable to parse Q specification: %s\n" % a)
def dump_score (outf):
- outf.write (r"""\score{
+ outf.write (r"""
+
+\score{
<<
""")
ks.sort ()
for k in ks:
if re.match('[1-9]', k):
- m = alphabet[string.atoi(k)]
+ m = alphabet (string.atoi(k))
else:
m = k
if k == 'default' and len (voice_idx_dict) > 1:
break
- if len ( slyrics [voice_idx_dict[k]] ):
- outf.write ("\n \\addlyrics")
outf.write ("\n\t\\context Staff=\"%s\"\n\t{\n" %k )
if k != 'default':
outf.write ("\t \\voicedefault\n")
outf.write ("\t \\voice%s " % m)
outf.write ("\n\t}\n")
- if len ( slyrics [voice_idx_dict[k]] ):
- outf.write ("\n\t\\context Lyrics=\"%s\" \n\t<<\t" % k)
+
+ l = ord( 'A' )
+ for lyrics in slyrics [voice_idx_dict[k]]:
+ outf.write ("\n\t\\addlyrics { \n")
if re.match('[1-9]',k):
- m = alphabet[string.atoi(k)]
+ m = alphabet (string.atoi(k))
else:
m = k
- for i in range (len(slyrics[voice_idx_dict[k]])):
- l=alphabet[i]
- outf.write("\n\t { \\words%sV%s }" % ( m, l) )
- outf.write ( "\n\t>>\n" )
+
+ outf.write ( " \\words%sV%s } " % ( m, chr (l)) )
+ l += 1
+
outf.write ("\n >>")
outf.write ("\n\t\\layout {\n")
if part_names:
if a == 'C':
if not state.common_time:
state.common_time = 1
- voices_append ("\\property Staff.TimeSignature \\override #\'style = #'C\n")
+ voices_append (" \\override Staff.TimeSignature #\'style = #'C\n")
a = '4/4'
if a == 'C|':
if not state.common_time:
state.common_time = 1
- voices_append ("\\property Staff.TimeSignature \\override #\'style = #'C\n")
+ voices_append ("\\override Staff.TimeSignature #\'style = #'C\n")
a = '2/2'
if not length_specified:
set_default_len_from_time_sig (a)
sys.stderr.write ('lilypond output to: `%s\'...' % out_filename)
outf = open (out_filename, 'w')
+ outf.write ('\\version "2.3.25"\n')
+
# dump_global (outf)
dump_header (outf, header)
dump_slyrics (outf)
# 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
tag = '%% Lily was here -- automatically converted by %s from %s' % ( program_name, f)
+
s = ''
- s = tag + '\n\n'
+ s = tag + '\n\\version "2.3.25"\n\n'
for i in range (len (tracks)):
s = s + dump_track (tracks[i], i)
for f in files:
-
g = f
g = strip_extension (g, '.midi')
g = strip_extension (g, '.mid')
h = sys.stdin
elif f and not os.path.isfile (f):
f = strip_extension (f, '.mup') + '.mup'
- h = open (f)
+
+ h = open (f)
progress ( _("Processing `%s'..." % f))
raw_lines = h.readlines ()
p = Pre_processor (raw_lines)