2002-12-24 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ * scripts/musedata2ly.py (): idem
+
+ * scripts/midi2ly.py (dump_chord): idem
+
+ * scripts/etf2ly.py (version): idem
+
+ * scripts/pmx2ly.py (Slur.calculate): new chord syntax
+
+ * scripts/mup2ly.py (pre_processor_commands): new chord syntax
+
* scm/tex.scm (tex-output-expression): remove eval compat
glut. Other output files too.
sarabandeCelloScripts = \notes{
}
- #(warn "FIXME: Setting beamed lengths")
sarabandeCelloStaff = \context Staff <
- %%#(warn "FIXME: Setting beamed lengths")
- %%\notes c4*0-#(warn "FIXME: Setting beamed lengths")
- \property Staff.Stem \set #'beamed-lengths = #'(3.26)
-
\sarabandeA
\sarabandeCelloGlobal
\sarabandeCelloScripts
#TODO:
+#
+# Convert to new chord styles.
+#
# UNDEF -> None
-
+#
program_name = 'abc2ly'
(str, num,den,current_dots) = parse_duration (str, parser_state)
-
if re.match('[ \t]*\)', str):
str = string.lstrip (str)
str = str[1:]
- if slur_end:
- voices_append ('%s' % ')' *slur_end )
-
bar_acc = get_bar_acc(notename, octave, parser_state)
pit = pitch_to_lilypond_name(notename, acc, bar_acc, global_key[notename])
oct = octave_to_lilypond_quotes (octave)
if not parser_state.parsing_tuplet:
voices_append ("}")
if slur_begin:
- voices_append ('%s' % '(' * slur_begin )
+ voices_append ('-(' * slur_begin )
+ if slur_end:
+ voices_append ('-)' *slur_end )
+
return str
if not cs or not ce:
raise IndexError
- cs.note_suffix = '(' + cs.note_suffix
- ce.note_prefix = ce.note_prefix + ')'
+ cs.note_suffix = '-(' + cs.note_suffix
+ ce.note_suffix = ce.note_suffix + '-)'
+
except IndexError:
sys.stderr.write ("""\nHuh? Slur no %d between (%d,%d), with %d notes""" % (self.number, startnote, endnote, len (chords)))
if rest:
nn = rest
- s = s + '%s%d%s' % (nn, self.duration[0], '.'* self.duration[1])
+ s = s + nn
if not self.pitches:
- s = 'r%d%s' % (self.duration[0] , '.'* self.duration[1])
- s = self.note_prefix + s + self.note_suffix
+ s = 'r'
if len (self.pitches) > 1:
- s = '<%s>' % s
+ s = '<< %s >>' % s
+
+ s = s + '%d%s' % (self.duration[0], '.'* self.duration[1])
+ s = self.note_prefix + s + self.note_suffix
s = self.chord_prefix + s + self.chord_suffix
+
return s
return (o, n, a)
- def dump (self):
+ def dump (self, dump_dur = 1):
global reference_note
s = chr ((self.notename + 2) % 7 + ord ('a'))
s = s + self.alteration_names[self.alteration + 2]
elif commas < 0:
s = s + "," * -commas
- if explicit_durations_p \
+ if and dump_dur (explicit_durations_p \
or Duration.compare (self.duration,
- reference_note.duration):
+ reference_note.duration)):
s = s + self.duration.dump ()
reference_note = self
s = s + dump (notes[0])
elif len (notes) > 1:
global reference_note
- s = s + '<'
- s = s + notes[0].dump ()
+ s = s + '<<'
+ s = s + notes[0].dump (dump_dur = 0)
r = reference_note
for i in notes[1:]:
- s = s + i.dump ()
- s = s + '>'
+ s = s + i.dump (dump_dur = 0 )
+ s = s + '>>'
+
+ s = s + notes[0].duration.dump()
reference_note = r
return s
e= self.end_chord
if e and s:
- s.note_suffix = s.note_suffix + '('
- e.note_prefix = ')' + e.note_prefix
+ s.note_suffix = s.note_suffix + '-('
+ e.note_prefix = e.note_suffix + "-)"
else:
sys.stderr.write ("\nOrphaned slur")
for p in self.pitches:
if str:
str = str + ' '
- str = str + pitch_to_lily_string (p) + sd
+ str = str + pitch_to_lily_string (p)
- for s in self.scripts:
- str = str + '-' + s
str = self.note_prefix +str + self.note_suffix
if len (self.pitches) > 1:
- str = '<%s>' % str
+ str = '<<%s>>' % str
elif self.multimeasure:
- str = 'R' + sd
+ str = 'R'
elif len (self.pitches) == 0:
- str = 'r' + sd
+ str = 'r'
+
+ str = str + sd
+ for s in self.scripts:
+ str = str + '-' + s
str = self.chord_prefix + str + self.chord_suffix
sd = sd + '.' * self.dots
- str = ')' * len (self.slurstart) + str
-
for p in self.pitches:
if str:
str = str + ' '
- str = str + pitch_to_lily_string (p) + sd
- str = str + '(' * len (self.slurstart)
+ str = str + pitch_to_lily_string (p)
+ if len (self.pitches) > 1:
+ str = '<<%s>>' % str
+ elif len (self.pitches) == 0:
+ str = 'r'
+ str = str + sd + '-(' * len (self.slurstart) + '-)' * len (self.slurstart)
for s in self.scripts:
str = str + '-' + s
str = self.note_prefix +str + self.note_suffix
-
- if len (self.pitches) > 1:
- str = '<%s>' % str
- elif len (self.pitches) == 0:
- str = 'r' + sd
-
str = self.chord_prefix + str + self.chord_suffix
-
return str
class Measure_start:
e= self.end_chord
if e and s:
- s.note_suffix = s.note_suffix + '('
- e.note_prefix = ')' + e.note_prefix
+ s.note_suffix = s.note_suffix + '-('
+ e.note_prefix = e.note_suffix + '-)'
else:
sys.stderr.write ("\nOrphaned slur")
-
+
+
class Voice:
def __init__ (self):
self.entries = []
for p in self.pitches:
if str:
str = str + ' '
- str = str + pitch_to_lily_string (p) + sd
-
- for s in self.scripts:
- str = str + '-' + s
+ str = str + pitch_to_lily_string (p)
- str = self.note_prefix +str + self.note_suffix
-
if len (self.pitches) > 1:
- str = '<%s>' % str
+ str = '<<%s>>' % str
elif len (self.pitches) == 0:
- str = 'r' + sd
+ str = 'r'
+
+ str = str + sd
+ for s in self.scripts:
+ str = str + '-' + s
+ str = self.note_prefix + str + self.note_suffix
str = self.chord_prefix + str + self.chord_suffix
return str