+2002-11-03 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ * scripts/convert-ly.py: more uniformization substitutions.
+
+ * buildscripts/new-chords.py (sub_chords): new file.
+
2002-11-03 Jan Nieuwenhuizen <janneke@gnu.org>
* mf/GNUmakefile: Bugfix: Use actual fontname (.AFM FontName) for
--- /dev/null
+
+# 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())
-\version "1.7.3"
+\version "1.7.4"
\header {
composer = "ARTHUR GRAY"
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)
%2
\property Voice.Stem \revert #'direction
\property Voice.Stem \override #'direction = #1
- r4 <cis\arpeggio eis a cis> r2
+ r4 <cis-\arpeggio eis a cis> r2
%3
- r4 <cis\arpeggio fis a cis> r8.
+ r4 <cis-\arpeggio fis a cis> r8.
% Urg, this lifts us up to staff context
\translator Staff=bass
% 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
cis'4()bis
r8
<a'8( a,> <gis gis,> <fis fis,> <gis gis,> <fis fis,> )e^" "^1^4^5 r|
- r<a8( a,> <gis gis,> <fis fis,> <gis gis,> <fis fis,> )e r|
+ r <a8( a,> <gis gis,> <fis fis,> <gis gis,> <fis fis,> )e r|
+
+ \bar "||"
+
}
trebleTwo = \context Voice=trebleTwo \notes\relative c''{
s4
\property Voice.Stem \revert #'direction
\property Voice.Stem \override #'direction = #-1
- <cis'4\arpeggio a fis dis>
+ <cis'4-\arpeggio a fis dis>
\property Voice.NoteColumn \override #'force-hshift = #-0.2
<e,2 gis, e d!>
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
\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???
\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
\property Voice.Stem \override #'direction = #0
<
%urg: staff-change: ! on dis
- <cis''\arpeggio a fis dis!>
+ <cis''-\arpeggio a fis dis!>
% { s8. \clef bass}
>
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
>
>
r8 <f g b> <g b d> <f g b> <g b d> <f g b> |
r8 <es g c> <g c es> <es g c> <g c es> <es g c> |
<g''4.( b,> <)f8 d>
- % manual beam override bug
- %\times 2/3 { < [f( d> <es c> <)d b] > } |
\times 2/3 < { [ f( es )d ] } { d c b } > |
%10
<c2. es> |
r8 <g, c> <c es> <g c> <c es> <g c> |
r8 <f c'> <c' d> <f, c'> <c' d> <f, c'> |
r8 <f as bes> <as bes d> <f as bes> <as bes d> <f as bes> |
- % manual beam override bug
- % r8 < [ es g bes> <g bes es> <es g bes> <g bes es ] >
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> <es g> <)d f] > } |
\times 2/3 < { [ f( es )d ] } { as' g f } > |
%16
<es2. g> |
%}
% 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)
(internal-class-name . "Event")
(types . (general-music event))
))
- (SustainPedalEvent
+ (SustainEvent
. (
(description . "")
(internal-class-name . "Event")
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, '<< >> -> < < > >'))