]> git.donarmstrong.com Git - lilypond.git/commitdiff
*** empty log message ***
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 29 Oct 2004 10:16:20 +0000 (10:16 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 29 Oct 2004 10:16:20 +0000 (10:16 +0000)
ChangeLog
Documentation/user/converters.itely
Documentation/user/notation.itely
scripts/abc2ly.py
scripts/etf2ly.py
scripts/midi2ly.py
scripts/mup2ly.py

index 069a83945c54894eeb8692b49dd9f457c6368f3f..699cb234e6bc84774a3e0fa6fbe0378a8a8fde12 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,21 @@
 
 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.
 
index 52e44729cd87f526c974f65c9790c65c61652a4c..28553b86b97aef86e78a2dc8bfb8e49275b758d9 100644 (file)
@@ -66,7 +66,9 @@ The following options can be given:
     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
 
index 0c24d9d39c2182f60e4bf1f1feb8f4cf7a76a1f5..ca8228a6b46f5d3abc076973bcd04af4722df101 100644 (file)
@@ -821,6 +821,9 @@ Not all durations (especially those containing tuplets) can be
 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}.
index 53a5f61b3f3f1578919d4c966c9b4bd7f59acef0..68200e785e3769859068434d01f4c1af0cc25c4c 100644 (file)
@@ -102,7 +102,6 @@ nobarlines = 0
 global_key = [0] * 7                   # UGH
 names = ["One", "Two", "Three"]
 DIGITS='0123456789'
-alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ"  
 HSPACE=' \t'
 midi_specs = ''
 
@@ -112,6 +111,9 @@ def error (msg):
        if strict:
                sys.exit (1)
        
+
+def alphabet (i):
+       return chr (i + ord('A'))
        
 def check_clef(s):
        if not s:
@@ -164,12 +166,10 @@ def select_voice (name, rol):
                                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
@@ -185,7 +185,7 @@ def dump_header (outf,hdr):
 
 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")
@@ -196,7 +196,6 @@ def dump_default_bar (outf):
        Nowadays abc2ly outputs explicits barlines (?)
        """
        ## < 2.2
-       ##outf.write ("\n\\property Score.defaultBarType = \"empty\"\n")
        outf.write ("\n\\set Score.defaultBarType = \"empty\"\n")
 
 
@@ -205,12 +204,12 @@ def dump_slyrics (outf):
        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}")
 
@@ -220,7 +219,7 @@ def dump_voices (outf):
        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)
@@ -253,7 +252,9 @@ def try_parse_q(a):
                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{
          <<
 """)
 
@@ -261,28 +262,28 @@ def dump_score (outf):
        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:
@@ -644,12 +645,12 @@ def try_parse_header_line (ln, state):
                        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)
@@ -1387,6 +1388,8 @@ for f in files:
        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)
index 599ddfccb3e101befb84745873ad55c940a93ea0..2d0ea2dcba40bab996a08bb4abb2097d264e3254 100644 (file)
@@ -109,9 +109,9 @@ have the correct number of accidentals
 # 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))
@@ -119,7 +119,7 @@ def find_scale (keysig):
                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):
@@ -137,7 +137,7 @@ 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
@@ -395,7 +395,7 @@ class Verse:
                                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:
@@ -463,14 +463,19 @@ class Frame:
 
                # 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):
@@ -493,7 +498,7 @@ class Frame:
                        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
@@ -570,7 +575,7 @@ class Staff:
                                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
                                
@@ -606,7 +611,7 @@ class Staff:
                                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:
@@ -618,7 +623,7 @@ class Staff:
                                                        % (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)
 
@@ -1126,7 +1131,8 @@ class Etf_file:
                        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
 
index c92451dcc59edcc2ba3cc7765827cff2689dcc18..a5bb08a11482dd5cc139c5eac356f081e327832f 100644 (file)
@@ -982,8 +982,9 @@ def convert_midi (f, o):
 
        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)
 
@@ -1083,7 +1084,6 @@ if not files or files[0] == '-':
 
 
 for f in files:
-
        g = f
        g = strip_extension (g, '.midi')
        g = strip_extension (g, '.mid')
index 98ba97c5892d72173b84ae235f522615112f4d0d..cb62a5faab14b6921edc69c26070c216d8be30e9 100644 (file)
@@ -1295,7 +1295,8 @@ for f in files:
                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)