From 9243f52cba297477d965db36fcedb8e0612d68a4 Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 27 Mar 2002 00:15:35 +0000 Subject: [PATCH] lilypond-1.3.84 --- buildscripts/musedata2ly.py | 210 ---------------------------------- buildscripts/pmx2ly.py | 217 ------------------------------------ input/test/multistanza.ly | 147 ------------------------ 3 files changed, 574 deletions(-) delete mode 100644 buildscripts/musedata2ly.py delete mode 100644 buildscripts/pmx2ly.py delete mode 100644 input/test/multistanza.ly diff --git a/buildscripts/musedata2ly.py b/buildscripts/musedata2ly.py deleted file mode 100644 index 1bbd165db6..0000000000 --- a/buildscripts/musedata2ly.py +++ /dev/null @@ -1,210 +0,0 @@ -#!@PYTHON@ - -# musedata = musedata.stanford.edu -# musedata = COBOL for musicians. -# todo: rewrite this. - -import re -import sys -import string - -f = open (sys.argv[1]) -lines =f.readlines() - -def chomp (x): - return re.sub ('[\r\n \t]+$','', x) - -lines = map (chomp, lines) - -default_header_dict = { - 'tagline' :'automatically converted from Musedata', - 'copyright' : 'all rights reserved -- free for noncommercial use' - } - -# Jezus, wat een ranzig formaat. (2am) -def parse_header (lines): - d = default_header_dict - enter = string.split (lines[3], ' ') - d['enteredby'] = string.join (enter[1:]) - d['enteredon'] = enter[0] - d['opus'] = lines[4] - d['source'] = lines[5] - d['title'] = lines[6] - d['subtitle'] = lines[7] - d['instrument']= lines[8] - d['musedatamisc'] =lines[9] - d['musedatagroups'] =lines[10] - d['musedatagroupnumber']=lines[11] - - return d - -clef_dict = { -04: 'treble', -13 : 'alto', -22: 'bass', - -} - -def get_clef(s): - return '\\clef "%s";\n' % clef_dict [string.atoi (s)] - -def get_mudela_notename (p, ac): - if p > 5: - p = p - 7 - s = chr (p + ord ('c')) - infix = 'i' - if ac < 0: - infix = 'e' - ac = -ac - - while ac: - s = s + infix + 's' - ac = ac - 1 - return s - -def get_key (s): - i = string.atoi (s) - return '' - -def get_timesig (s): - return '\\time %s;\n' % s - - -divisions = 4 -def get_divisions_per_quarter (s): - divisions = string.atoi (s) - return '' - -def get_directive (s): - return '%% %s\n' % s - -def get_transposing (s): - return '' - -def get_num_instruments (s): - return '' - -attr_dict = { - 'C' : get_clef, - 'K' : get_key , - 'T' : get_timesig, - 'Q' : get_divisions_per_quarter, - 'D' : get_directive, - 'X' : get_transposing, - 'I': get_num_instruments, - } - -def parse_musical_attributes (l): - s = '' - l = l[1:] - atts = re.split('[ \t]+', l) - for a in atts: - if not a: - continue - m = re.search ('(.):(.*)', a) - if m == None: - print 'Huh, unknown attr `%s\'' % a - continue - - s = s + attr_dict[m.group(1)](m.group (2)) - return s - - -def get_mudela_pitch (n, a, o): - c = '\'' - if o < 1: - c = ',' - o = 1 - o - - return get_mudela_notename (n,a) + '%s' % c * o - -def dump_header (h, out): - out.write ('\\header {\n') - for tup in h.items (): - out.write ('\t%s = \"%s\";\n' % tup) - out.write ('}\n') - -header_dict = parse_header (lines[0:12]) -dump_header (header_dict, sys.stdout) - - -lines = lines [12:] - - -def parse_line_comment (l): - return re.sub ('@' , '%' , l) - -def parse_note_line (l): - pitch = ((ord (l[0]) -ord('A')) + 5) % 7 - acc = 0 - l= l[1:] - while l[0] == 'f': - l= l[1:] - acc = acc - 1 - while l[0] == '#': - l= l[1:] - acc = acc + 1 - while l[0] in ' \t': - l= l[1:] - - oct = 0 - if l[0] in '0123456789': - oct = string.atoi (l[0]) - 4 - l= l[1:] - - while l[0] in ' \t': - l= l[1:] - - - print get_mudela_pitch (pitch,acc,oct), parse_duration(l[:2]) - l = l[2:] - - - - -def parse_duration (l): - s = '' - while l[0] in '0123456789': - s = s + l[0] - l= l[1:] - print l - num = string.atoi (s) - den = 4 * divisions - - current_dots = 0 - try_dots = [3, 2, 1] - for d in try_dots: - f = 1 << d - multiplier = (2*f-1) - if num % multiplier == 0 and den % f == 0: - num = num / multiplier - den = den / f - current_dots = current_dots + d - - if num <> 1: - sys.stderr.write ('huh. Durations left') - return '%s%s' % (den, '.' * current_dots) - -comment_switch = 0 -for l in lines: - if l[0] == '&': - comment_switch = not comment_switch - if comment_switch: - l= l[1:] - print '%{' - else: - print '%}' - - if comment_switch: - print l - continue - - if 0: - pass - elif l[0] == '$': - print parse_musical_attributes (l) - elif l[0] == '@': - parse_line_comment (l) - - elif l[0] in 'ABCDEFG': - parse_note_line (l) diff --git a/buildscripts/pmx2ly.py b/buildscripts/pmx2ly.py deleted file mode 100644 index 2f9155005e..0000000000 --- a/buildscripts/pmx2ly.py +++ /dev/null @@ -1,217 +0,0 @@ -#!@PYTHON@ - -# (urg! wat een pokkeformaat (pokkenformaat?)) - -import string -import sys -import re - -fn = sys.argv[1] - -ls = open (fn).readlines () -def stripcomment (l): - return re.sub ('[ \t]*%.*$\n', '', l) - -def stripwhite (l): - return re.sub ('[ \n\t]+', ' ', l) - -def stripeols (l): - return re.sub ('^ ', '', re.sub (' $', '', l)) - -ls = map (stripcomment, ls) -ls = map (stripwhite, ls) -ls = map (stripeols, ls) - - -ls = filter (lambda x: x <> '', ls) - -opening = ls[0] -ls = ls[1:] - - -opening = map (string.atoi, re.split ('[\t ]+', opening)) - -(no_staffs, no_instruments, timesig_num,timesig_den, ptimesig_num, - ptimesig_den, pickup_beats,keysig_number) = tuple (opening) - - -opening = ls[0] -ls = ls[1:] - -# ignore this. -# opening = map (string.atoi, re.split ('[\t ]+', opening)) -# (no_pages,no_systems, musicsize, fracindent) = tuple (opening) - -instruments = [] -while len (instruments) < no_instruments: - instruments.append (ls[0]) - ls = ls[1:] - -class Staff: - def __init__ (self): - self.voices = ([],[]) - self.clef = None - self.instrument = 0 -l = ls[0] -ls = ls[1:] - -staffs = map (lambda x: Staff (), range(0, no_staffs)) -staff_idx = 0 - -for s in staffs: - s.clef = l[0] - l = l[1:] - -# dump path -ls = ls[1:] - -# dump more ? -ls = ls[2:] - -actab = {-2: 'eses', -1: 'es', 0 : '', 1: 'is', 2:'isis'} - -def pitch_to_lily_string (tup): - (o,n,a) = tup - - nm = chr((n + 2) % 7 + ord ('a')) - nm = nm + actab[a] - if o > 0: - nm = nm + "'" * o - elif o < 0: - nm = nm + "," * -o - return nm - -class Chord: - def __init__ (self): - self.pitches = [] - self.dots = 0 - self.basic_duration = 0 - - def dump (self): - str = '' - - for p in self.pitches: - if str: - str = str + ' ' - str = str + pitch_to_lily_string (p) - - if len (self.pitches) > 1: - str = '<%s>' % str - elif len (self.pitches) == 0: - str = 'r' - - - sd = '' - if self.basic_duration == 0.5: - sd = '\\breve' - else: - sd = '%d' % self.basic_duration - - str = str + sd + '.' * self.dots - return str - - -input_left = string.join (ls, ' ') - - -input_left = re.sub ('[ \t\n]+', ' ', input_left) - -SPACE=' \t\n' -DIGITS ='0123456789' -basicdur_table = { - 9: 0.5, - 0: 0 , - 2: 2 , - 4: 4 , - 8: 8 , - 1: 16, - 3: 32, - 6: 64 - } - -class Parser: - def __init__ (self): - self.chords = [] - self.forced_duration = None - self.last_octave = 4 - - def parse_note (self, str): - ch = Chord () - - name = None - if str[0] <> 'r': - name = (ord (str[0]) - ord('a') + 5) % 7 - str = str[1:] - - forced_duration = 0 - alteration = 0 - dots = 0 - oct = None - durdigit = None - multibar = 0 - while str[0] in 'dsfmnul0123456789.,': - c = str[0] - str = str[1:] - if c == 'f': - alteration = alteration -1 - elif c == 'n': - alteration = 0 - elif c == 'm': - multibar = 1 - elif c == 's': - alteration = alteration +1 - elif c == 'd': - dots = dots + 1 - elif c in DIGITS and durdigit == None: - durdigit = string.atoi (c) - elif c in DIGITS: - oct = string.atoi (c) - 4 - elif c == '.': - dots = dots+ 1 - forced_duration = 2 - elif c == ',': - forced_duration = 2 - - - if durdigit: - ch.basic_duration = basicdur_table[durdigit] - self.last_basic_duration = ch.basic_duration - else: - ch.basic_duration = self.last_basic_duration - - if name: - if oct: - self.last_octave =oct - else: - oct = self.last_octave - - if name: - ch.pitches.append ((oct, name, alteration)) - - ch.dots = dots - - - if forced_duration: - self.forced_duration = ch.basic_duration / forced_duration - - - self.chords.append (ch) - while str[0] in SPACE: - str = str [1:] - return str - - -parser = Parser() -while input_left: - while input_left[0] in 'abcdefgr': - input_left = parser.parse_note (input_left) - print input_left[0] - - sys.stderr.write ("\nHuh? Unknown directive %s" %input_left[0:1]) - input_left = input_left[1:] - - - -for c in parser.chords: - print c.dump () - diff --git a/input/test/multistanza.ly b/input/test/multistanza.ly deleted file mode 100644 index 71f0a50f8f..0000000000 --- a/input/test/multistanza.ly +++ /dev/null @@ -1,147 +0,0 @@ -% Tests a number of features: -% * Lyric_phrasing_engraver -% * Stanza_number_engraver -% * Automatic melismata on beamed notes - -\version "1.3.59"; -\include "english.ly" - -\header{ - title = "Crowned with Honour"; - composer = "Oliver Holden (1765-1844)"; - poet = "Thomas Kelly (1769-1855)"; -} - -allup = \notes{ - \property Voice.verticalDirection = \up - \property Voice.slurVerticalDirection = \up - \property Voice.tieVerticalDirection = \up - \property Voice.dynamicDirection = \up - \autoBeamOff -} -alldown = \notes{ - \property Voice.verticalDirection = \down - \property Voice.slurVerticalDirection = \down - \property Voice.tieVerticalDirection = \down - \property Voice.dynamicDirection = \down - \autoBeamOff -} - -Global = \notes{ - \key g \major; - \time 4/4; - \partial 4; -} - -Soprano = \notes \relative c' { - \allup - d4 | g g b b a g a b a g b a g( a )g % modified to test melisma align right - - [a8 b] | b4 % modified to test melisma align left - a g b [d16 d c8] [b a] b4 % modified to test beam melisma -% a4 | b a g b [d8 \melisma c] \melismaEnd [b \melisma a] \melismaEnd b4 - - d d2 d e d4( cs8 ~ )cs d2. - - b4 | d b g b [a8 g] [a b] a4 -% b4 | d b g b [a8 \melisma g] \melismaEnd [a \melisma b] \melismaEnd a4 - - g d'2 c b4.( c8 )a4 a g2. -} -Alto = \notes \relative c'{ - \alldown - d4 | d d g g fs g fs g fs e g fs d2. - d4 | g d b g' [b8 a] [g fs] g4 fs g2 a g fs4( e8 )g fs2. - d4 | g g d g [fs8 e] [fs g] fs4 g f2 e d4.( d8 )d4 fs4 d2. -} -Tenor = \notes \relative c{ - \allup - d4 | b' b d d c b c d c b d c b2. - a4 | b a g b [d8 c] [b a] b4 a b2 c b a a2. - g4 | b d b d [c8 b] [c d] c4 b g2 g g4.( a8 [fs )a] c4 b2. -} -Bass = \notes \relative c{ - \alldown - d4 | g g g g d d d g d e d d g,2. - d'4 | g d b g' [b8 a] [g fs] g4 d g2 fs e a d,2. - g4 | g g g g d d d e b2 c d2. d4 g,2. -} - -TheLyrics = \lyrics < - { - \context LyricVoice = "Soprano-1" - \property LyricVoice .stanza = "1:" - \property LyricVoice .stz = "(1)" - The4 head that once was crowned with thorns - Is crowned with glo -- ry now; - A roy -- al di -- a -- dem a -- dorns - The might -- y Vic -- tor's brow. - A roy -- al di -- a -- dem a -- dorns - The might -- y Vic -- tor's brow. - } - { - \context LyricVoice = "Soprano-2" - \property LyricVoice .stanza = "2:" - \property LyricVoice .stz = "(2)" - The4 high -- est place that heav'n af -- fords - Is His by sov -- 'reign right; - The King of kings, the Lord of lords, - He reigns in glo -- ry bright, - The King of kings, the Lord of lords, - He reigns in glo -- ry bright. - } - { - \context LyricVoice = "Soprano-3" - \property LyricVoice .stanza = "3:" - \property LyricVoice .stz = "(3)" - The joy of all who dwell a -- bove, - The joy of saints be -- low, - To4 whom He man -- i -- fests His love, - And grants His name to know, - To4 whom He man -- i -- fests His love, - And grants His name to4 know. - } -> - - -\score{ - \context ChoirStaff - \notes - < - \property Score.barNumberScriptPadding = #10.0 - \context Staff = "treblestaff"{ - < - \context Voice = "Soprano" { } - \context Voice = "Alto" { } - > - } - \context Lyrics = mainlyrics { } - \context Staff = "treblestaff"{ - < - \Global - \addlyrics { \context Voice = "Soprano" \Soprano } - { \context Lyrics = mainlyrics \TheLyrics } - \context Voice = "Alto" \Alto - > - \bar "|."; - } - \context Staff = "bassstaff"{ - \clef "bass"; - < - \context Voice = "Tenor" { \Tenor } - \context Voice = "Bass" { \Bass } - > - \bar "|."; - } - > - - \paper { - \translator{ - \VoiceContext - automaticMelismata = ##t; - noAutoBeaming = ##t; - \remove "Auto_beam_engraver"; - } - - } -} -- 2.39.2