From 3b516ac6541617751b2dbb810275049185ccf513 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 4 Nov 2002 00:52:16 +0000 Subject: [PATCH] *** empty log message *** --- ChangeLog | 6 ++ buildscripts/new-chords.py | 129 ++++++++++++++++++++++++++ input/les-nereides.ly | 65 ++++++------- input/mutopia/F.Schubert/standchen.ly | 6 -- ly/spanners-init.ly | 4 +- scm/music-types.scm | 2 +- scripts/convert-ly.py | 16 ++++ 7 files changed, 183 insertions(+), 45 deletions(-) create mode 100644 buildscripts/new-chords.py diff --git a/ChangeLog b/ChangeLog index e7ce3cb0cc..1d4dc97a20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-11-03 Han-Wen Nienhuys + + * scripts/convert-ly.py: more uniformization substitutions. + + * buildscripts/new-chords.py (sub_chords): new file. + 2002-11-03 Jan Nieuwenhuizen * mf/GNUmakefile: Bugfix: Use actual fontname (.AFM FontName) for diff --git a/buildscripts/new-chords.py b/buildscripts/new-chords.py new file mode 100644 index 0000000000..47f4023ae0 --- /dev/null +++ b/buildscripts/new-chords.py @@ -0,0 +1,129 @@ + +# to nwe chord syntax. +import re +import string +import sys + +def sub_chord (m): + str = m.group(1) + + if re.search (r'\\\\', str): + return '<%s>' % str + + if re.match (r'^\s*\)?\s*\\[a-zA-Z]+', str): + return '<%s>' % str + + durs = [] + def sub_durs (m): + durs.append(m.group(2)) + return m.group (1) + + str = re.sub ("([a-z]+[,'!? ]*)([0-9.]+)", sub_durs, str) + dur_str = '' + + for d in durs: + if dur_str == '': + dur_str = d + if dur_str <> d: + return '<%s>' % m.group (1) + + + dyns = [''] + def sub_dyn_end (m): + dyns.append (' -\!') + return m.group(2) + + str = re.sub (r'(\\!)\s*([a-z]+)', sub_dyn_end, str) + + slur_strs = [''] + def sub_slurs(m): + if '-)' not in slur_strs: + slur_strs.append ( '-)') + return m.group(1) + def sub_p_slurs(m): + if '-\)' not in slur_strs: + slur_strs.append ( '-\)') + return m.group(1) + str = re.sub (r"\)[ ]*([a-z]+)", sub_slurs, str) + str = re.sub (r"\\\)[ ]*([a-z]+)", sub_p_slurs, str) + def sub_begin_slurs(m): + if '-(' not in slur_strs: + slur_strs.append ( '-(') + return m.group(1) + str = re.sub (r"([a-z]+[,'!?0-9 ]*)\(", sub_begin_slurs, str) + def sub_begin_p_slurs(m): + if '-\(' not in slur_strs: + slur_strs.append ( '-\(') + return m.group(1) + + str = re.sub (r"([a-z]+[,'!?0-9 ]*)\\\(", sub_begin_p_slurs, str) + + def sub_dyns (m): + s = m.group(0) + if s == '@STARTCRESC@': + slur_strs.append ("-\\<") + elif s == '@STARTDECRESC@': + slur_strs.append ("-\\>") + elif s == r'-?\\!': + slur_strs.append ('-\\!') + return '' + + str = re.sub (r'@STARTCRESC@', sub_dyns, str) + str = re.sub (r'-?\\!', sub_dyns, str) + + def sub_articulations (m): + a = m.group(1) + if a not in slur_strs: + slur_strs.append (a) + return '' + + str = re.sub (r"([_^-]\@ACCENT\@)", sub_articulations, str) + str = re.sub (r"([_^-]\\[a-z]+)", sub_articulations, str) + str = re.sub (r"([_^-][>_.+|^-])", sub_articulations, str) + + pslur_strs = [''] + def sub_pslurs(m): + slur_strs.append ( ' -\\)') + return m.group(1) + str = re.sub (r"\\\)[ ]*([a-z]+)", sub_pslurs, str) + + suffix = string.join (slur_strs, '') + string.join (pslur_strs, '') \ + + string.join (dyns, '') + + return '@STARTCHORD@%s@ENDCHORD@%s%s' % (str , dur_str, suffix) + + + + +simend = '}' +simstart = "\n\\simultaneous {" +chordstart = '<' +chordend = '>' + +old_syntax = 1 + +if old_syntax: + simend = '>' + simstart = "<" + chordstart = '<<' + chordend = '>>' + + + +def sub_chords (str): + str= re.sub (r'\\<', '@STARTCRESC@', str) + str= re.sub (r'\\>', '@STARTDECRESC@', str) + str= re.sub (r'([_^-])>', r'\1@ACCENT@', str) + str = re.sub ('<([^<>{}]+)>', sub_chord, str) + + str = re.sub ('<([^?])', r'%s\1' % simstart, str) + str = re.sub ('>([^?])', r'%s\1' % simend, str) + str= re.sub ('@STARTCRESC@', r'\\<', str) + str= re.sub ('@STARTDECRESC@', r'\\>' ,str) + str= re.sub ('@STARTCHORD@', chordstart, str) + str= re.sub ('@ENDCHORD@', chordend, str) + str= re.sub (r'@ACCENT@', '>', str) + return str + + +print sub_chords (open (sys.argv[1]).read()) diff --git a/input/les-nereides.ly b/input/les-nereides.ly index cfe88880a2..a63109f0f9 100644 --- a/input/les-nereides.ly +++ b/input/les-nereides.ly @@ -1,4 +1,4 @@ -\version "1.7.3" +\version "1.7.4" \header { composer = "ARTHUR GRAY" @@ -10,22 +10,13 @@ description = "Nastiest piece of competition at http://www.orphee.com/comparison/study.html, see http://www.orphee.com/comparison/gray.pdf" } -#(ly:set-point-and-click! 'line-column) -#(set! point-and-click line-column-location) - +#(ly:set-point-and-click 'line-column) #(define (make-text-checker text) (lambda (elt) (equal? text (ly:get-grob-property elt 'text)))) -global = \notes{ - \partial 2 - \key a \major - \skip 2 - \skip 1*2 - \skip 1 - \bar "||" -} treble = \context Voice=treble \notes\relative c''{ +\key a \major % Broken? \property Voice.NoteColumn \override #'horizontal-shift = #0 \outputproperty #(make-type-checker 'text-interface) @@ -34,9 +25,9 @@ treble = \context Voice=treble \notes\relative c''{ %2 \property Voice.Stem \revert #'direction \property Voice.Stem \override #'direction = #1 - r4 r2 + r4 r2 %3 - r4 r8. + r4 r8. % Urg, this lifts us up to staff context \translator Staff=bass @@ -85,7 +76,7 @@ treble = \context Voice=treble \notes\relative c''{ % currently, this can't be (small) italic, because in the paperblock % we set italic_magnifictation to get large italics. - cis''''4^"m.g."\arpeggio #(ly:export (make-span-event 'TextSpanEvent START)) ( + cis''''4^"m.g."-\arpeggio #(ly:export (make-span-event 'TextSpanEvent START)) ( \property Voice.Stem \revert #'direction @@ -104,7 +95,10 @@ treble = \context Voice=treble \notes\relative c''{ cis'4()bis r8 )e^" "^1^4^5 r| - r )e r| + r )e r| + + \bar "||" + } trebleTwo = \context Voice=trebleTwo \notes\relative c''{ @@ -114,7 +108,7 @@ trebleTwo = \context Voice=trebleTwo \notes\relative c''{ s4 \property Voice.Stem \revert #'direction \property Voice.Stem \override #'direction = #-1 - + \property Voice.NoteColumn \override #'force-hshift = #-0.2 @@ -132,6 +126,9 @@ trebleTwo = \context Voice=trebleTwo \notes\relative c''{ bass = \context Voice=bass \notes\relative c{ % Allow ugly slurs + \partial 2 + \key a \major + \property Voice.Slur \override #'beautiful = #5.0 \property Voice.Slur \override #'attachment-offset = #'((0 . 3) . (0 . -4)) \property Voice.Stem \revert #'direction @@ -147,7 +144,7 @@ bass = \context Voice=bass \notes\relative c{ \property Voice.Stem \revert #'direction \property Voice.Stem \override #'direction = #-1 \property Voice.Slur \override #'attachment = #'(stem . stem) - <)a''4\arpeggio eis cis> + <)a''4-\arpeggio eis cis> %\stemBoth \property Voice.Slur \revert #'attachment % Huh, urg? Implicit \context Staff lifts us up to Staff context??? @@ -171,7 +168,7 @@ bass = \context Voice=bass \notes\relative c{ \property Voice.Stem \revert #'length \property Voice.Stem \revert #'direction \property Voice.Stem \override #'direction = #-1 - <)a'\arpeggio fis cis> + <)a'-\arpeggio fis cis> % Huh, urg? Implicit \context Staff lifts us up to Staff context??? \translator Staff=bass % Get back @@ -189,7 +186,7 @@ bass = \context Voice=bass \notes\relative c{ \property Voice.Stem \override #'direction = #0 < %urg: staff-change: ! on dis - + % { s8. \clef bass} > @@ -258,52 +255,48 @@ middleDynamics = \context Dynamics=middle \notes{ lowerDynamics = \context Dynamics=lower \notes{ s2 %2 - s2\sustainDown s8. s16\sustainUp s4 + s2-\sustainDown s8. s16-\sustainUp s4 %3 - s2\sustainDown s8. s16\sustainUp s4 + s2-\sustainDown s8. s16-\sustainUp s4 %3 - s4\sustainDown s16 - s32 s s\sustainUp s - s32\sustainDown s s s + s4-\sustainDown s16 + s32 s s-\sustainUp s + s32-\sustainDown s s s s8 \property Dynamics.pedalSustainStrings = #'("Ped." "*Ped." "") - s4 s16. s32\sustainUp + s4 s16. s32--\sustainUp %5 - s8\sustainDown s s + s8-\sustainDown s s \property Dynamics.pedalSustainStrings = #'("Ped." "-P" "*") - s s\sustainUp\sustainDown s s - s\sustainUp + s s-\sustainUp-\sustainDown s s + s-\sustainUp %6 \property Dynamics.pedalSustainStrings = #'("Ped." "*Ped." "") - s8\sustainDown s s + s8-\sustainDown s s \property Dynamics.pedalSustainStrings = #'("Ped." "-P" "*") - s s\sustainUp\sustainDown s s - s\sustainUp + s s-\sustainUp-\sustainDown s s + s-\sustainUp } \score{ \context PianoStaff < \context Staff=treble < - \global \treble \trebleTwo > \context Dynamics=middle < - \global \middleDynamics > \context Staff=bass < \clef bass - \global \bass \bassTwo > \context Dynamics=lower < - \global \lowerDynamics > > diff --git a/input/mutopia/F.Schubert/standchen.ly b/input/mutopia/F.Schubert/standchen.ly index 38d990c90a..75539d4c18 100644 --- a/input/mutopia/F.Schubert/standchen.ly +++ b/input/mutopia/F.Schubert/standchen.ly @@ -152,20 +152,14 @@ trebleVerseOne = \notes\relative c{ r8 | r8 | <)f8 d> - % manual beam override bug - %\times 2/3 { < [f( d> <)d b] > } | \times 2/3 < { [ f( es )d ] } { d c b } > | %10 | r8 | r8 | r8 | - % manual beam override bug - % r8 < [ es g bes> r8 < { [ es g es g ] } { g bes g bes } { bes es bes es } > <{ es'( ) d4.() f8}{ c' | bes4. as8 } > - % manual beam override bug - % \times 2/3 { < [f( as> <)d f] > } | \times 2/3 < { [ f( es )d ] } { as' g f } > | %16 | diff --git a/ly/spanners-init.ly b/ly/spanners-init.ly index 166108f4ad..4d022cc0d7 100644 --- a/ly/spanners-init.ly +++ b/ly/spanners-init.ly @@ -49,8 +49,8 @@ endcresc = \spanevent \stop "crescendo" %} % better name sustainstart/stop? -sustainUp = #(make-span-event 'SustainPedalEvent STOP) -sustainDown = #(make-span-event 'SustainPedalEvent START) +sustainUp = #(make-span-event 'SustainEvent STOP) +sustainDown = #(make-span-event 'SustainEvent START) unaCorda = #(make-span-event 'UnaCordaEvent START) treCorde = #(make-span-event 'UnaCordaEvent STOP) diff --git a/scm/music-types.scm b/scm/music-types.scm index 5f4a5e9968..e4830dc527 100644 --- a/scm/music-types.scm +++ b/scm/music-types.scm @@ -421,7 +421,7 @@ is an articulation (such as @code{-.}, @code{->}, @code{\\tenuto}, (internal-class-name . "Event") (types . (general-music event)) )) - (SustainPedalEvent + (SustainEvent . ( (description . "") (internal-class-name . "Event") diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py index 0543fbf05d..00b50c3add 100644 --- a/scripts/convert-ly.py +++ b/scripts/convert-ly.py @@ -1079,6 +1079,22 @@ if 1: str = re.sub (r'<<', '< <', str) str = re.sub (r'>>', '> >', str) + kws = ['arpeggio', + 'sustainDown', + 'sustainUp', + 'f', + 'p', + 'pp', + 'ppp', + 'fp', + 'ff', + 'mf', + 'mp', + 'sfz', + ] + + origstr = string.join (kws, '|') + str = re.sub (r'([^-])\\(%s)\b' % origstr, r'\1-\\\2', str) return str conversions.append (((1,7,4), conv, '<< >> -> < < > >')) -- 2.39.2