From e66d322479c5d24e774ed690b6ce36e1040b0de4 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 24 Dec 2002 21:54:43 +0000 Subject: [PATCH] * 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 --- ChangeLog | 10 ++++++++ .../J.S.Bach/baerenreiter-sarabande.ly | 5 ---- scripts/abc2ly.py | 14 ++++++----- scripts/etf2ly.py | 16 ++++++++----- scripts/midi2ly.py | 16 +++++++------ scripts/mup2ly.py | 18 ++++++++------- scripts/musedata2ly.py | 17 +++++--------- scripts/pmx2ly.py | 23 ++++++++++--------- 8 files changed, 65 insertions(+), 54 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71c214f373..e205bf3e1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2002-12-24 Han-Wen Nienhuys + * 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. diff --git a/input/mutopia/J.S.Bach/baerenreiter-sarabande.ly b/input/mutopia/J.S.Bach/baerenreiter-sarabande.ly index 073ab9f836..b73bd54e7e 100644 --- a/input/mutopia/J.S.Bach/baerenreiter-sarabande.ly +++ b/input/mutopia/J.S.Bach/baerenreiter-sarabande.ly @@ -146,12 +146,7 @@ sarabandeCelloGlobal = \notes{ 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 diff --git a/scripts/abc2ly.py b/scripts/abc2ly.py index eac86759a2..296bb48407 100644 --- a/scripts/abc2ly.py +++ b/scripts/abc2ly.py @@ -49,8 +49,11 @@ #TODO: +# +# Convert to new chord styles. +# # UNDEF -> None - +# program_name = 'abc2ly' @@ -924,7 +927,6 @@ def try_parse_note (str, parser_state): (str, num,den,current_dots) = parse_duration (str, parser_state) - if re.match('[ \t]*\)', str): str = string.lstrip (str) @@ -934,9 +936,6 @@ def try_parse_note (str, parser_state): 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) @@ -960,7 +959,10 @@ def try_parse_note (str, parser_state): 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 diff --git a/scripts/etf2ly.py b/scripts/etf2ly.py index 4219f1d8df..df3b6d3504 100644 --- a/scripts/etf2ly.py +++ b/scripts/etf2ly.py @@ -233,8 +233,9 @@ class Slur: 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))) @@ -700,15 +701,18 @@ class Chord: 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 diff --git a/scripts/midi2ly.py b/scripts/midi2ly.py index a6c3acd926..3b3f00dd9e 100644 --- a/scripts/midi2ly.py +++ b/scripts/midi2ly.py @@ -429,7 +429,7 @@ class Note: 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] @@ -450,9 +450,9 @@ class Note: 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 @@ -788,12 +788,14 @@ def dump_chord (ch): 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 diff --git a/scripts/mup2ly.py b/scripts/mup2ly.py index 88868a8e03..2630c4931d 100644 --- a/scripts/mup2ly.py +++ b/scripts/mup2ly.py @@ -455,8 +455,8 @@ class Slur: 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") @@ -721,19 +721,21 @@ class Chord: 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 diff --git a/scripts/musedata2ly.py b/scripts/musedata2ly.py index 99d74fb764..dd6eaabdb5 100644 --- a/scripts/musedata2ly.py +++ b/scripts/musedata2ly.py @@ -226,27 +226,22 @@ class Chord: 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: diff --git a/scripts/pmx2ly.py b/scripts/pmx2ly.py index 412906db09..c462713be9 100644 --- a/scripts/pmx2ly.py +++ b/scripts/pmx2ly.py @@ -135,11 +135,12 @@ class Slur: 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 = [] @@ -337,18 +338,18 @@ class Chord: 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 -- 2.39.2