From 6f032b9d5fb40583bf40e2f783013f79a75f2e40 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Mon, 9 Nov 1998 18:35:10 +0100 Subject: [PATCH] patch::: 1.1.3.jcn3: murp pl 3.jcn3 - mup-to-ly.py: version 0.0 - init/test/stars-and-stripes.ly (from star.mup) pl 3.jcn2 - bf: font switch --- Generated by janneke@gnu.org using package-diff 0.62, >From = lilypond-1.1.3.jcn2, To = lilypond-1.1.3.jcn3 usage cd lilypond-source-dir; patch -E -p1 < lilypond-1.1.3.jcn3.diff Patches do not contain automatically generated files or (urg) empty directories, i.e., you should rerun autoconf, configure and possibly make outdirs. --state 1.1.3.jcn2 1.1.3.jcn3 ++state --- NEWS | 14 ++- VERSION | 2 +- init/lily.scm | 4 + input/test/GNUmakefile | 2 +- input/test/stars-and-stripes.ly | 94 +++++++++++++++++++ ps/lilyponddefs.ps | 5 + scripts/mup-to-ly.py | 158 ++++++++++++++++++++++++++++++++ 7 files changed, 276 insertions(+), 3 deletions(-) create mode 100644 input/test/stars-and-stripes.ly create mode 100644 scripts/mup-to-ly.py diff --git a/NEWS b/NEWS index 0595cce22e..63e2440d75 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,16 @@ -pl 3.tca1 +--- ../lilypond-1.1.3.jcn2/NEWS Mon Nov 9 18:19:50 1998 +++ b/NEWS Mon Nov 9 18:07:04 1998 +@@ -1,3 +1,10 @@ +pl 3.jcn3 + - mup-to-ly.py: version 0.0 + - init/test/stars-and-stripes.ly (from star.mup) + +pl 3.jcn2 + - bf: font switch + + pl 2.jcn2 + + pl 2.uu1pl 3.tca1 - accordion symbols in mf/feta-accordion.mf and init/accordion-defs.ly. - small changes to mudela-book and Documentation/man/mudela-book.yo diff --git a/VERSION b/VERSION index 37b932fed7..fb1f46ff09 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=1 PATCH_LEVEL=3 -MY_PATCH_LEVEL=jcn2 +MY_PATCH_LEVEL=jcn3 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/init/lily.scm b/init/lily.scm index 2a4207c60c..a052588815 100644 --- a/init/lily.scm +++ b/init/lily.scm @@ -384,6 +384,10 @@ (start-line-tex) "\\hbox{%\n") +(define + (startbar o h) + ((invoke-output o "invoke-dim1") "startbar" h)) + (define (startrepeat o h) ((invoke-output o "invoke-dim1") "startrepeat" h)) diff --git a/input/test/GNUmakefile b/input/test/GNUmakefile index 74fec0e68d..5af2ecfc95 100644 --- a/input/test/GNUmakefile +++ b/input/test/GNUmakefile @@ -1,7 +1,7 @@ # input/test/Makefile depth = ../.. -examples=font20 hara-kiri grace mark denneboom +examples=font20 hara-kiri grace mark denneboom stars-and-stripes LOCALSTEPMAKE_TEMPLATES=mutopia include $(depth)/make/stepmake.make diff --git a/input/test/stars-and-stripes.ly b/input/test/stars-and-stripes.ly new file mode 100644 index 0000000000..794419800e --- /dev/null +++ b/input/test/stars-and-stripes.ly @@ -0,0 +1,94 @@ +%{ +Converted from star.mup with the aid of mup-to-ly.py +%} +\header{ +title="The Star Spangled Banner"; +subtitle="(The United States National Anthem)"; +poet="Text: Francis Scott Key"; +composer="Tune: J. S. Smith"; +arranger="Arr: William J. Krauss"; +} + +$staff1_voice_1 = \notes { + [a8.()fis16] d4 fis4 a4 d'2 [fis'8. e'16] d'4 fis4 gis4 a2 [a8 a8] fis'4. e'8 + d'4 cis'2 [b8. cis'16] d'4 d'4 a4 fis4 d4 [a8. fis16] fis4 d4 [fis'8. + fis'16] fis'4 g'4 a'4 a'2 [g'8 fis'8] e'4 fis'4 g'4 g'2 g'4 fis'4. e'8 d'4 + cis'2 [b8. cis'16] d'4 fis4 gis4 a2 a4 d'4 d'4 [d'8()cis'8] b4 b4 b4 e'4 [g'8 +()fis'8] [e'8()d'8] d'4~cis'4 [a8. a16] d'4.~e'8 [fis'8 g'8] a'2 [d'8 e'8] + fis'4. g'8 e'4 d'2 s4 } + +$staff1_voice_2 = \notes { + [a8.()fis16] a,4 d4 e4 d4~fis4 [fis8. fis16] fis4 d4 d4 cis2 [e8 e8] a4. a8 + a4 a2 [a8. a16] a4 a4 a4 fis4 d4 [a8. fis16] fis4 d4 r4 a4 a4 d'4 d'2 + [a8 a8] cis'4 cis'4 cis'4 cis'2 a4 a4. a8 a4 a2 [a8. a16] d4 d4 d4 + cis2 e4 fis4 e4 d4 d4 d4 dis4 g4 [g8()dis8] e4 e2 [e8. e16] d4.~a8 [a8 a8] + a2 [g8 g8] a4. a8 g4 fis2 s4 } + +$staff2_voice_1 = \notes { + r4 fis4 a4 a4 b2 [cis'8. cis'16] b4 b4 b4 a2 [cis'8 cis'8] d'4. cis'8 + d'4 e'2 [e'8. e'16] d'4 d'4 a4 fis4 d4 r4 fis4 d4 r4 d4 e4 fis4 fis'2 + [e'8 d'8] e'4 e'4 e'4 e'2 cis'4 d'4. cis'8 d'4 e'2 [e'8. e'16] a4 a4 + e4 e2 cis'4 a4 a4 a4 g4 g4 b4 b4 b4 b4 a2 [cis'8. cis'16] a4.~cis'8 + [d'8 d'8] d'2 [d'8 d'8] d'4. d'8 cis'4 a2 s4 } + +$staff2_voice_2 = \notes { + r4 d4 d4 cis4 b,2 [ais,8. ais,16] b,4 b,4 e4 a,2 [a8 a8] d4. e8 [fis8 g8] + a2 [g8. g16] fis4 fis4 a4 fis4 d4 r4 fis4 d4 r4 d4 d4 d4 d2 [d8 d8] a4 + a4 a4 a2 a,4 d4. e8 [fis8 g8] a2 [g8. g16] fis4 d4 e4 a,2 a4 d4 e4 fis4 + g4 g4 fis4 e4 [e8()fis8] [g8()gis8] a2 [g8. g16] fis4.~a,8 [d8 e8] fis2 [b8 b8] + a4. a8 a,4 d2 s4 } + +$text1 = \lyrics{ + Oh say. can you see, by the dawn's ear- ly light What_so proud- ly we hailed, + At the twi- light's last gleam- ing. Whose broad +} + +$text2 = \lyrics{ + _ stripes and bright stars, through the per- il- ous fight, O'er the ram- parts + we watched, were so gal- lant- ly _ _ _ +} + +$text3 = \lyrics{ + stream- ing. And the rock- ets' red glare, the bombs burst- ing in air, gave + proof through the night that our flag was still there, _ Oh say, does that + star- span- gled ban- ner yet wave, _ O'er the land _ of_the free and_the + home of the brave. +} + +global = \notes { + \time 3/4; + \key D; + \partial 4; + \skip 4; + \bar "|:"; + \skip 2.*8; + \bar ":|"; + \skip 2.*16; + \skip 2.; + \bar "|."; + } + +\score{ + \type GrandStaff < + < + \type Staff=staffA < + \global + \notes \transpose c'' {\voiceone \$staff1_voice_1 } + \notes \transpose c'' {\voicetwo \$staff1_voice_2 } + > + \type Lyrics = middle < + \lyrics \$text1 + \lyrics { \$text2 \$text3 } + > + \type Staff=staffB < + \global + \clef bass; + {\voiceone \$staff2_voice_1 } + {\voicetwo \$staff2_voice_2 } + > + > + > + \paper{ + \include "bar-numbering.ly" + } +} diff --git a/ps/lilyponddefs.ps b/ps/lilyponddefs.ps index b5386d2818..862bc2031b 100644 --- a/ps/lilyponddefs.ps +++ b/ps/lilyponddefs.ps @@ -126,6 +126,11 @@ thickbar } bind def +/startbar +{ + thickbar +} bind def + /startrepeat { thickbar diff --git a/scripts/mup-to-ly.py b/scripts/mup-to-ly.py new file mode 100644 index 0000000000..1a32f66882 --- /dev/null +++ b/scripts/mup-to-ly.py @@ -0,0 +1,158 @@ +#!/usr/bin/python +#!@PYTHON@ + +# mup-to-ly.py -- +# +# source file of the GNU LilyPond music typesetter +# +# (c) 1998 Jan Nieuwenhuizen + +name = 'mup-to-ly' +version = '0.1' + +import os +import sys + +import getopt +from string import * +import regex +import regsub +import time + +def program_id (): + return name + ' version ' + version; + +def identify (): + sys.stdout.write (program_id () + '\n') + +def help (): + sys.stdout.write ("Usage: %s [options] [files]\n" + "Convert mup to ly\n\n" + + "Options:\n" + + " -h, --help print this help\n" + % (program_name) + ) + sys.exit (0) + +identify () +(options, files) = getopt.getopt ( + sys.argv[1:], 'hp:', ['help', 'package']) +for opt in options: + o = opt[0] + a = opt[1] + if o== '--help' or o == '-h': + help () + elif o == '-p' or o == '--package': + topdir = a + else: + print o + raise getopt.error + +def gulp_file (f): + sys.stderr.write ('[%s' % f) + try: + i = open (f) + i.seek (0, 2) + n = i.tell () + i.seek (0,0) + except: + sys.stderr.write ('can\'t open file %s\n ' % f) + return '' + s = i.read (n) + sys.stderr.write (']') + if len (s) <= 0: + sys.stderr.write ('gulped empty file: %s\n'% f) + return s + +def line_to_ly (s): + notes = "" + o = 0 + i = regex.search (";", s) + last_name = "c" + last_duration = "4" + while i >= 0: + note = s[o:o+i] + o = o + i + i = regex.search (";", s[o+1:]) + if i >= 0 : + o = o + 1 + name = regsub.gsub ("[0-9<>\.&]*", "", note) + duration = regsub.gsub ("[a-z+<>#+&\-]*", "", note) + duration = regsub.gsub (" ", "", duration) + if name: + last_name = name + else: + name = last_name + if duration: + last_duration = duration + else: + duration = last_duration + name = regsub.sub ("#", "is", name) + name = regsub.sub ("+", "'", name) + name = regsub.sub ("-", ",", name) + name = regsub.sub ("ms", "s1", name) + notes = notes + " %s%s" % (name, duration) + return notes + +def get_voice (staff, s, staffs): + voice = len (staffs[staff-1]) + 1 + tag = "^%d [0-9-]*%d[0-9-]*:" % (staff, voice) + notes = "" + o = 0 + i = regex.search (tag, s) + while i >= 0: + o = o + i + n = regex.search ("$", s[o:]) + line = s[o:o+n] + line = regsub.sub (tag, "", line) + line = line_to_ly (line) + notes = notes + line + i = regex.search (tag, s[o+n:]) + if i >= 0: + i = i + n + if notes != "": + sys.stderr.write ('%d ' % voice) + staffs[staff-1].append (notes) + return notes != "" + +def get_staff (s, staffs): + staff=len (staffs) + i=1 + sys.stderr.write ('Staff %d ( ' % staff) + while i: + i = get_voice (staff, s, staffs) + if not i: + sys.stderr.write (')\n') + staffs.append ([]) + staff = staff + 1 + sys.stderr.write ('Staff %d ( ' % staff) + i = get_voice (staff, s, staffs) + if not i: + del staffs[staff-1] + return 0 + +staffs=[[]] +mup=files[0] +ly = os.path.basename (os.path.splitext (mup)[0]) + ".ly" +s = gulp_file (mup) +sys.stderr.write ('\n') +i=1 +while i: + i=get_staff (s, staffs) +sys.stderr.write ('\n') +sys.stderr.write ('Ly output to: %s...' % ly) +lyfile = open (ly, "w") +for i in range (len (staffs)): + for v in range (len (staffs[i])): + lyfile.write ("$staff%d_voice_%d = \\notes {\n %s\n}\n\n" % (i+1, v+1, staffs[i][v])) +lyfile.write ("\\score{\n") +lyfile.write ("\\notes <\n") +for i in range (len (staffs)): + lyfile.write ("\\type Staff=staff%s <\n" % chr(ord('A')+i)) + for v in range (len (staffs[i])): + lyfile.write ("{ \\$staff%d_voice_%d } " % (i+1, v+1)) + lyfile.write ("\n>\n") +lyfile.write (">\n") +lyfile.write ("\n}") +lyfile.close () +sys.stderr.write ('\n') -- 2.39.2