From 958e09cf4d02f9c69ae604490ba1ad294c72d564 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 21:50:42 +0000 Subject: [PATCH] lilypond-1.1.50 --- Documentation/faq.yo | 52 ++++----- Documentation/mail.yo | 2 +- Documentation/man/lilypond.yo | 3 +- Documentation/tex/engraving.bib | 12 --- Documentation/tex/mudela-book-doc.doc | 1 + Documentation/topinfo.yo | 7 ++ lily/paper-outputter.cc | 73 ++++++++++++- mutopia/E.Satie/gnossienne-4.ly | 145 ++++++++++++++------------ scripts/abc-2-ly.py | 81 +++++++++++--- 9 files changed, 251 insertions(+), 125 deletions(-) diff --git a/Documentation/faq.yo b/Documentation/faq.yo index a878886610..f20726e49b 100644 --- a/Documentation/faq.yo +++ b/Documentation/faq.yo @@ -14,8 +14,8 @@ Note: relative paths are meant to be relative to the source directory sect(Installing) -question(If I install the .exe file on my DOS/windows 3.11 machine, it -doesn't work.) +COMMENT(look out: can't have line breaks in subsect() macro) +question(If I install the .exe file on my DOS/windows 3.11 machine, it doesn't work) The DOS port is done with the cygnus gnu/windows32 port of the GNU utils. It does em(not) work with windows 3.x; you need Windows-NT (95/98?). This @@ -206,9 +206,8 @@ question(How do I change the TeX layout?) See file(lilyponddefs.tex), it has some comments. Or use file(ly2dvi). -question(How do I place lyrics under em(each) of the staves in a -score, as choral music. I can work out how to put lyrics for each line -all under the top line, or at the bottom but not between!) +COMMENT(look out: can't have line breaks in subsect() macro) +question(How do I place lyrics under em(each) of the staves in a score, as choral music. I can work out how to put lyrics for each line all under the top line, or at the bottom but not between!) You change the order lyrics and staves. You have to name all staves (lyric and melodic), otherwise they will end up in the same @@ -251,15 +250,14 @@ See file(input/test/bar-scripts.ly). sect(Development) -question(Could you implement feature XXXX? It is really easy, just extend -the syntax to allow YYYY!) +COMMENT(look out: can't have line breaks in subsect() macro) +question(Could you implement feature XXXX? It is really easy, just extend the syntax to allow YYYY!) If it is reasonable, I'll add XXXX to the TODO list. In general finding a cute syntax (such as YYYY) isn't very hard. The complicated issue how to adapt the internals to do XXXX. The parser is really a simple front end to the complicated internals. - question(Can I join in on LilyPond development? How do I do this?) LilyPond development is open for anyone who wants to join. We try @@ -288,14 +286,21 @@ easier or quicker to use than mudela. But for composing a graphical environment probably is indispensable. In any case email(Derek Wyatt)(wyatt@scar.utoronto.edu) is working on -GTK based editor, but that is still in an embryonal stage (see -lurl(http://harmonia.scar.utoronto.ca). There is also a GUI package -RoseGarden that could be extended to output mudela. +GTK based editor, but that effort practically died. (see +lurl(http://harmonia.scar.utoronto.ca). + +Matthew Hiller is working on extending Midiscore to handle mudela. +lurl(http://zoo.cs.yale.edu/~meh25/MISClily/MISClily-0.0.3.tar.gz) + + +There is also a GUI package RoseGarden that could be extended to +output mudela. If you want to work on this, please send e-mail to the mailing list email(gnu-music-discuss@gnu.org). + question(I want to implement XXXX! How should I do this?) Your best bet of getting us to include code, is to present it as a @@ -352,8 +357,8 @@ question(Why GPL?) Yes. -question(Your make system does not adhere to GNU coding standards, could you -please fix it?) +COMMENT(look out: can't have line breaks in subsect() macro) +question(Your make system does not adhere to GNU coding standards, could you please fix it?) No. We have evaluated the standard GNU combination for compiling programs (autoconf, automake, libtool) and found to be inadequate in @@ -380,24 +385,22 @@ having to support other compilers saves us a em(lot) of trouble. sect(Running) -question(I use dvilj4, and there are lots of warning messages for the -printing) +question(I use dvilj4, and there are lots of warning messages for the printing) You should use dvips and ghostscript to print the code(dvi) output: the slurs and beams are PS code(\special) commands. -question(My symbols are all messed up after I upgraded, I get the -wrong symbols and dvi-checksum errors!) +COMMENT(look out: can't have line breaks in subsect() macro) +question(My symbols are all messed up after I upgraded, I get the wrong symbols and dvi-checksum errors!) We obviously mucked with the fonts in the upgrade. Remove em(all) previous fonts, including the file(.pk) and file(.tfm) fonts in file(/var/lib/texmf). A script automating this has been included, see file(buildscripts/clean-fonts.sh). -question(all the pk and tfm -fonts are created in the directory where the mudela file is, not in -"/var/spool/texmf" where I think they should be.) +COMMENT(look out: can't have line breaks in subsect() macro) +question(all the pk and tfm fonts are created in the directory where the mudela file is, not in "/var/spool/texmf" where I think they should be.) Mats Bengtsson writes: @@ -470,8 +473,8 @@ verb( The bf(-M) option was added to LilyPond because processing the \paper block is so slow. -question(A lot of musical stuff doesn't make it to the MIDI file, eg. -dynamics, articulation, etc.) +COMMENT(look out: can't have line breaks in subsect() macro) +question(A lot of musical stuff doesn't make it to the MIDI file, eg. dynamics, articulation, etc.) The MIDI output was originally put in as a proof that MIDI could be done, and as a method of proof"reading" the input. The MIDI support @@ -480,8 +483,8 @@ is by no means finished. Patches appreciated. sect(Copyright) -question(How does copyright for sheet music work? Can I enter and -spread my newly bought Bach urtext?) +COMMENT(look out: can't have line breaks in subsect() macro) +question(How does copyright for sheet music work? Can I enter and spread my newly bought Bach urtext?) Silas S. Brown : @@ -586,4 +589,3 @@ They may lag several versions behind the latest version. question(But i want a native DOS/Windows-NT/95 port) Reconsider. Try Linux. It's fun! - diff --git a/Documentation/mail.yo b/Documentation/mail.yo index c3d4e894a9..c11d059563 100644 --- a/Documentation/mail.yo +++ b/Documentation/mail.yo @@ -35,7 +35,7 @@ dit(gnu-music-discuss@gnu.org,) mail with subject "subscribe" to email(gnu-music-discuss-request@gnu.org) This list is archived at - lurl(http://www.mail-archive.org/gnu-music-discuss@gnu.org) + lurl(http://www.mail-archive.com/gnu-music-discuss@gnu.org) ) Announces of new versions will be sent to info-gnu-music and diff --git a/Documentation/man/lilypond.yo b/Documentation/man/lilypond.yo index d680277e43..6c5bcce306 100644 --- a/Documentation/man/lilypond.yo +++ b/Documentation/man/lilypond.yo @@ -116,7 +116,7 @@ dit(file(init.ly)) The initialisation file with symbol tables etc. It includes files from the directory file(PREFIX/share/lilypond/ly/). (file(PREFIX) typically is file(/usr/local) -) +)) manspagesection(environment) @@ -198,4 +198,3 @@ it()nemail(Jan Nieuwenhuizen)(janneke@gnu.org) Please consult the documentation file file(AUTHORS) for more detailed information, and small contributions. - diff --git a/Documentation/tex/engraving.bib b/Documentation/tex/engraving.bib index 7552b11c18..ab4099acce 100644 --- a/Documentation/tex/engraving.bib +++ b/Documentation/tex/engraving.bib @@ -39,18 +39,6 @@ } -@Book{banter, - author = {Harald Banter}, - title = {Akkord Lexikon}, - publisher = {Schott's S\"ohne}, - year = {1987}, - isbn = {ISBN 3-7957-2095-8}, - note = {Comprehensive overview of commonly used - chords. Suggests (and uses) a unification for all different kinds - of chord names.}, - address = {Mainz, Germany}, -} - @Book {read78, note = {Sound (boring) review of the various hairy rhythmic notations used by avant-garde composers HWN}, diff --git a/Documentation/tex/mudela-book-doc.doc b/Documentation/tex/mudela-book-doc.doc index b905979a1b..95a439f6d7 100644 --- a/Documentation/tex/mudela-book-doc.doc +++ b/Documentation/tex/mudela-book-doc.doc @@ -9,6 +9,7 @@ %\sloppy \def\postMudelaExample{\setlength{\parindent}{3.25ex}} \title{Mudela-book tutorial} +\author{TCA} \begin{document} \maketitle %\printparam diff --git a/Documentation/topinfo.yo b/Documentation/topinfo.yo index 88f16caa22..9e0980fcae 100644 --- a/Documentation/topinfo.yo +++ b/Documentation/topinfo.yo @@ -21,6 +21,7 @@ redef(htmlbodyopt)(2)() COMMENT(redef(includefile)(1)(INCLUDEFILE(man/ARG1))) includefile(programs.yo) +nodeprefix() redef(article)(3)(nodeprefix()chapter(ARG1)nodeprefix(Tutorial )) COMMENT(yodl2texinfo should be able to cope now, although ugly...) redef(article)(3)(chapter(ARG1)) @@ -39,9 +40,15 @@ redef(article)(3)(nodeprefix()chapter(ARG1)nodeprefix(Mutopia )) COMMENT(yodl2texinfo should be able to cope now, although ugly...) redef(article)(3)(chapter(ARG1)) +COMMENT( + +dropped? --jcn + redef(includefile)(1)(INCLUDEFILE(ARG1)) includefile(mutopia.yo) +) + nchapter(Concept Index) COMMENT( urg makeindex()) printindex() diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index 96ba69012f..d22f151e1c 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -26,8 +26,12 @@ #include "lily-version.hh" #include "atom.hh" +// urg +static SCM port = 0; + Paper_outputter::Paper_outputter (Paper_stream *s) { + port = 0; outstream_l_ = s; output_header (); } @@ -36,6 +40,16 @@ Paper_outputter::~Paper_outputter () { SCM scm = gh_list (ly_symbol ("end-output"), SCM_UNDEFINED); output_scheme (scm); + + if (String (output_global_ch) == "scm") + { +#if 1 + scm_display (gh_str02scm (")))\n"), port); + scm_fflush (port); +#else + *outstream_l_->os << ")"; +#endif + } } void @@ -47,7 +61,7 @@ Paper_outputter::output_header () // gh_eval_str ("(set! security-paranoia #t)"); } String s = String ("(eval (") + output_global_ch + "-scm 'all-definitions))"; - gh_eval_str (s.ch_C()); + gh_eval_str (s.ch_C ()); String creator; if (no_timestamps_global_b) @@ -158,7 +172,11 @@ Paper_outputter::output_scheme (SCM scm) { if (String (output_global_ch) == "scm") { - static SCM port = 0; +#if 1 + /* + we'd rather use C++ i/o iso Guile's, but how? + and: they can't be mixed (or synchronised) easily? + */ // urg if (!port) @@ -169,13 +187,58 @@ Paper_outputter::output_scheme (SCM scm) fd = of->rdbuf()->fd(); FILE *file = fdopen (fd, "a"); port = scm_standard_stream_to_port (file, "a", ""); - scm_display (gh_str02scm ("(load 'lily.scm)\n"), port); + scm_display (gh_str02scm ( + "(primitive-load-path 'lily.scm)\n" + "(eval (tex-scm 'all-definitions))\n" + ";(eval (ps-scm 'all-definitions))\n" + "(display (map (lambda (x) (string-append (eval x) \"%\\n\")) '(\n" + ), port); } - scm_display (gh_str02scm ("("), port); scm_write (scm, port); - scm_display (gh_str02scm (")\n"),port); + // duh + scm_display (gh_str02scm ("\n"), port); scm_fflush (port); +#else + static bool first = true; + if (first) + { + *outstream_l_->os << "" + "(primitive-load-path 'lily.scm)\n" + "(eval (tex-scm 'all-definitions))\n" + ";(eval (ps-scm 'all-definitions))\n" + "(display (map (lambda (x) (string-append (eval x) \"\\n\")) '(\n" + ; + } + + /* + why doesn't this work? + + ERROR: In procedure gh_scm2newstr: + ERROR: Wrong type argument in position 3: + (header "GNU LilyPond 1.1.49.jcn1" ", at Tue Jun 22 20:58:17 1999") + + or: + + ERROR: In procedure symbol->string: + ERROR: Wrong type argument in position 1: + (header "GNU LilyPond 1.1.49.jcn2" ", at Wed Jun 23 18:42:14 1999") + + eg, two ways to print '(foo bar)' + + SCM scm = gh_list (ly_symbol ("foo"), gh_str2scm ("bar"), SCM_UNDEFINED); + scm_write (scm, port); + puts (gh_xxx2newstr (scm, 0)); + */ + + char* p; + //p = gh_scm2newstr (scm, 0); + //p = gh_symbol2newstr (scm, 0); + //p = gh_scm2newstr (scm_symbol_to_string (scm), 0); + //p = gh_symbol2newstr (scm_symbol_to_string (scm), 0); + //*outstream_l_->os << p << endl; + *outstream_l_->os << symbol_to_string (scm) << endl; +#endif } else { diff --git a/mutopia/E.Satie/gnossienne-4.ly b/mutopia/E.Satie/gnossienne-4.ly index fc2f0b7a1e..e1bd1a22e7 100644 --- a/mutopia/E.Satie/gnossienne-4.ly +++ b/mutopia/E.Satie/gnossienne-4.ly @@ -9,10 +9,10 @@ } %{ - Tested Features: cross staff beams and slurs, grace notes, no bars + Tested Features: cross staff auto beams and slurs, grace notes, no bars %} -\version "1.0.21"; +\version "1.0.20"; \include "nederlands.ly" @@ -24,101 +24,112 @@ global = \notes { \bar ".|"; } +x = \context Voice=x \notes { + % no beams in grace notes + \property Voice.beamAuto = "0" +} + upper = \context Staff=treble \notes\relative c''{ \clef violin; \stemup \context Voice=one r2 r r r2 r r - r4 [a'8--(\< a--] [a-- a-- c-- \!b--] [a--\> gis f \!e] + r4 a'8--(\< a-- a-- a-- c-- \!b-- a--\> gis f \!e % grace hack - < { [es8 )c] } \context Voice=x { \stemup s8*1/2 \tiny b8*1/2 ~ } > r4 r2 r + < { es8 )c } \context Voice=x { \stemup s8*1/2 \tiny b8*1/2 ~ } > r4 r2 r r2 r r - r4 [a'8--(\< a--] [a-- a-- c-- \!b--] [a--\> gis f \!e] - < { [es8 )c] } \context Voice=x { \stemup s8*1/2 \tiny b8*1/2 ~ } > r4 r2 r - r4 [g16( a bes a] [g a bes a g a bes a] [g a bes a g fis es fis] - )d4 \tiny fis8*1/2 ~ \normalsize gis4*3/4 ~ gis8 r r4 r2 - r4 [g16( a bes a] [g a bes a g a bes a] [g a bes a g fis es fis] - )d4 \tiny fis8*1/2 ~ \normalsize gis4*3/4 ~ gis8 r r4 r2 - \tiny a8*1/2 ~ \normalsize f4*3/4 ~ f8 r r2 r - r2 r4 [a8( b][c d c b] \tiny b8*1/2 ~ \normalsize - < { [e8*1/2 )g,8] } \context Voice=x { \stemup s8*1/4 \tiny a8*1/2 ~ } > r4 r2 r - r2 r4 [a8( b][c d c b] [a b c d][c b a b][c d c b] - \tiny b8*1/2 ~ \normalsize - < { [e8*1/2 )g,8] } \context Voice=x { \stemup s8*1/4 \tiny a8*1/2 ~ } > r4 r2 r - a2( \tiny e'8*1/2 ~ \normalsize f4*3/4 ~ )f8 r r2 + r4 a'8--(\< a-- a-- a-- c-- \!b-- a--\> gis f \!e + < { es8 )c } \context Voice=x { \stemup s8*1/2 \tiny b8*1/2 ~ } > r4 r2 r + r4 g16( a bes a g a bes a g a bes a g a bes a g fis es fis + % urg, what a syntax + )d4 \tiny fis8 ( *1/2 \normalsize ) gis4*3/4 ~ gis8 r r4 r2 + r4 g16( a bes a g a bes a g a bes a g a bes a g fis es fis + )d4 \tiny fis8(*1/2 \normalsize )gis4*3/4 ~ gis8 r r4 r2 + \tiny a8(*1/2 \normalsize )f4*3/4 ~ f8 r r2 r + r2 r4 a8( b c d c b \tiny b8(*1/2 \normalsize + < { )e8*1/2 )g,8 } \context Voice=x { \stemup s8*1/4 \tiny a8*1/2 ~ } > r4 r2 r + r2 r4 a8( b c d c b a b c d c b a b c d c b + \tiny b8(*1/2 \normalsize + < { )e8*1/2 )g,8 } \context Voice=x { \stemup s8*1/4 \tiny a8*1/2 ~ } > r4 r2 r + a2( \tiny e'8(*1/2 \normalsize )f4*3/4 ~ )f8 r r2 r2 r r fis,4( \tiny dis8*1/2 \normalsize <)cis4*3/4 ais> r2 r - \tiny b'8*1/2 ~ \normalsize - < { [a8*1/2 a8] } \context Voice=x { \stemup s8*1/4 \tiny b8*1/2 ~ } > r4 r2 r - r4 [a'8--(\< a--] [a-- a-- c-- \!b--] [a--\> gis f \!e] - < { [es8 )c] } \context Voice=x { \stemup s8*1/2 \tiny b8*1/2 ~ } > r4 r2 r - d,4( \tiny fis8*1/2 ~ \normalsize gis4*3/4 ~ )gis8 r r4 r2 + \tiny b'8(*1/2 \normalsize + < { )a8*1/2 a8 } \context Voice=x { \stemup s8*1/4 \tiny b8*1/2 ~ } > r4 r2 r + r4 a'8--(\< a-- a-- a-- c-- \!b-- a--\> gis f \!e + < { es8 )c } \context Voice=x { \stemup s8*1/2 \tiny b8*1/2 ~ } > r4 r2 r + d,4( \tiny fis8(*1/2 \normalsize )gis4*3/4 ~ )gis8 r r4 r2 f4 ~ f8 r r2 r - [f'8( g a b][a g f g][a b a g] - \tiny f8*1/2 ~ \normalsize - < { [g8*1/2 )e8] } \context Voice=x { \stemup s8*1/4 \tiny d8*1/2 ~ } > r4 r2 r - [f8( g a b][a g f g][a b a g] - \tiny f8*1/2 ~ \normalsize - < { [g8*1/2 )e8] } \context Voice=x { \stemup s8*1/4 \tiny d8*1/2 ~ } > r4 r2 r - a,2( \tiny e'8*1/2 ~ \normalsize f4*3/4 ~ )f8 r r2 + f'8( g a b a g f g a b a g + \tiny f8(*1/2 \normalsize + < { )g8*1/2 )e8 } \context Voice=x { \stemup s8*1/4 \tiny d8*1/2 ~ } > r4 r2 r + f8( g a b a g f g a b a g + \tiny f8(*1/2 \normalsize + < { )g8*1/2 )e8 } \context Voice=x { \stemup s8*1/4 \tiny d8*1/2 ~ } > r4 r2 r + a,2( \tiny e'8(*1/2 \normalsize )f4*3/4 ~ )f8 r r2 r2 r r fis,4( \tiny dis8*1/2 \normalsize <)cis4*3/4 ais> r2 r ~ } basloopje = \notes\relative c{ - d,8( a' d f a d f d a f d )a +% \property Voice.beamAutoEnd = "1/2" +% d,8( a' d f a d f d a f d )a + d,8( a' d f a \translator Staff=treble d f d \translator Staff=bass a f d )a } +%{ bassbeam = \notes{ [s2] [s8 \translator Staff=treble s s s] [\translator Staff=bass s2] % [s2] [s2] [s2] } +%} + lower = \context Voice=two \notes \relative c{ \stemdown \property Staff.slurVerticalDirection = 1 % snapnie, hoevaak relative c heeft ze nodig? - < \notes\relative c \basloopje \bassbeam > - < \notes\relative c \basloopje \bassbeam > - < \notes\relative c \basloopje \bassbeam > - < \transpose bes \notes\relative c{ \basloopje } \bassbeam > - < \transpose bes \notes\relative c{ \basloopje } \bassbeam > - < \notes\relative c \basloopje \bassbeam > - < \transpose bes \notes\relative c{ \basloopje } \bassbeam > - < \transpose bes \notes\relative c{ \basloopje } \bassbeam > - < \transpose a \notes\relative c{ \basloopje } \bassbeam > - < \transpose bes \notes\relative c{ \basloopje } \bassbeam > - < \transpose a \notes\relative c{ \basloopje } \bassbeam > - < \notes\relative c \basloopje \bassbeam > - < \notes\relative c \basloopje \bassbeam > + \notes\relative c \basloopje + \notes\relative c \basloopje + \notes\relative c \basloopje + \transpose bes \notes\relative c{ \basloopje } + \transpose bes \notes\relative c{ \basloopje } + \notes\relative c \basloopje + \transpose bes \notes\relative c{ \basloopje } + \transpose bes \notes\relative c{ \basloopje } + \transpose a \notes\relative c{ \basloopje } + \transpose bes \notes\relative c{ \basloopje } + \transpose a \notes\relative c{ \basloopje } + \notes\relative c \basloopje + \notes\relative c \basloopje % huh? d' - < \transpose d' \notes\relative c{ \basloopje } \bassbeam > - < \notes\relative c \basloopje \bassbeam > - < \notes\relative c \basloopje \bassbeam > - < \transpose d' \notes\relative c{ \basloopje } \bassbeam > - < \notes\relative c \basloopje \bassbeam > - < \notes\relative c \basloopje \bassbeam > - < \transpose e' \notes\relative c{ \basloopje } \bassbeam > - < \notes\relative c \basloopje \bassbeam > - < \notes\relative c \basloopje \bassbeam > - < \transpose bes \notes\relative c{ \basloopje } \bassbeam > - < \transpose a \notes\relative c{ \basloopje } \bassbeam > - < \notes\relative c \basloopje \bassbeam > - < \notes\relative c \basloopje \bassbeam > - < \transpose d' \notes\relative c{ \basloopje } \bassbeam > - < \notes\relative c \basloopje \bassbeam > - < \transpose d' \notes\relative c{ \basloopje } \bassbeam > - < \notes\relative c \basloopje \bassbeam > - < \notes\relative c \basloopje \bassbeam > - < \transpose e' \notes\relative c{ \basloopje } \bassbeam > + \transpose d' \notes\relative c{ \basloopje } + \notes\relative c \basloopje + \notes\relative c \basloopje + \transpose d' \notes\relative c{ \basloopje } + \notes\relative c \basloopje + \notes\relative c \basloopje + \transpose e' \notes\relative c{ \basloopje } + \notes\relative c \basloopje + \notes\relative c \basloopje + \transpose bes \notes\relative c{ \basloopje } + \transpose a \notes\relative c{ \basloopje } + \notes\relative c \basloopje + \notes\relative c \basloopje + \transpose d' \notes\relative c{ \basloopje } + \notes\relative c \basloopje + \transpose d' \notes\relative c{ \basloopje } + \notes\relative c \basloopje + \notes\relative c \basloopje + \transpose e' \notes\relative c{ \basloopje } < e1 b' e> ~ < e b' e> } \score { - \context GrandStaff < + \context PianoStaff < \context Staff = treble < \global \upper @@ -138,11 +149,9 @@ lower = \context Voice=two \notes \relative c{ % no slur damping slur_slope_damping = 100.0; - \translator{ \OrchestralScoreContext } - \translator{ - \GrandStaffContext - minVerticalAlign = 3.0*\staffheight; - maxVerticalAlign = 3.0*\staffheight; + \translator{ + \VoiceContext + beamAutoEnd = "1/2"; } \translator{ \StaffContext diff --git a/scripts/abc-2-ly.py b/scripts/abc-2-ly.py index b6827083f3..c3b28363ae 100644 --- a/scripts/abc-2-ly.py +++ b/scripts/abc-2-ly.py @@ -5,6 +5,7 @@ # ... # # (not finished.) +# ABC standard v1.6: http://www.gre.ac.uk/~c.walshaw/abc2mtex/abc.txt # program_name = 'abc-to-ly' @@ -14,7 +15,11 @@ import getopt import sys import re import string -import mpz +try: + import mpz +except: + sys.stderr.write ("This script needs Python 1.5.1\n") + sys.exit (1) header = {} @@ -51,7 +56,7 @@ def dump_header (hdr): print '\\header {' for k in hdr.keys (): print '%s = "%s";\n'% (k,hdr[k]) - print '};' + print '}' def set_default_length (s): m = re.search ('1/([0-9]+)', s) @@ -175,6 +180,7 @@ def compute_key (k): tup_lookup = { '3' : '2/3', '4' : '4/3', + '5' : '4/5', '6' : '4/6', } @@ -196,12 +202,19 @@ def try_parse_group_end (str, state): print '}' return str +def header_append (key, a): + s = '' + if header.has_key (key): + s = header[key] + "\n" + header [key ] = s + a + def try_parse_header_line (ln): m = re.match ('^(.): *(.*)$', ln) if m: g =m.group (1) a = m.group (2) + a = re.sub ('"', '\\"', a) if g == 'T': header['title'] = a if g == 'M': @@ -216,11 +229,10 @@ def try_parse_header_line (ln): header ['origin'] = a if g == 'X': header ['crossRefNumber'] = a - if g == 'A': header ['area'] = a if g == 'H': - header ['history'] = a + header_append ('history', a) if g == 'B': header ['book'] = a if g == 'S': @@ -244,6 +256,7 @@ def pitch_to_mudela_name (name, acc): return chr (name + ord('c')) + s * acc def octave_to_mudela_quotes (o): + o = o + 2 s ='' if o < 0: o = -o @@ -385,7 +398,7 @@ def try_parse_guitar_chord (str): if str: str = str[1:] - print "guitar chord: %s\n" % gc + sys.stderr.write ("warning: ignoring guitar chord: %s\n" % gc) return str @@ -399,6 +412,14 @@ def try_parse_escape (str): return str +# +# |] thin-thick double bar line +# || thin-thin double bar line +# [| thick-thin double bar line +# :| left repeat +# |: right repeat +# :: left-right repeat +# def try_parse_bar (str): if str and str[0] == '|': @@ -409,9 +430,28 @@ def try_parse_bar (str): bs = '|.' if str[0] == '|': bs = '||' - + if str[0] == '|:': + sys.stderr.write ("warning: repeat kludge\n") + bs = '|:' if bs: print '\\bar "%s";' % bs + str = str[1:] + + if str and str[:2] == '[|': + sys.stderr.write ("warning: thick-thin bar kludge\n") + print '\\bar "||";' + str = str[2:] + + if str and str[:2] == ':|': + sys.stderr.write ("warning: repeat kludge\n") + print '\\bar ":|:";' + str = str[2:] + + if str and str[:2] == '::': + sys.stderr.write ("warning: repeat kludge\n") + print '\\bar ":|:";' + str = str[2:] + return str @@ -426,6 +466,19 @@ def try_parse_chord_delims (str): return str +# urg, hairy to compute grace note hack using \times{} +def try_parse_grace_delims (str): + if str and str[0] == '{': + str = str[1:] + sys.stderr.write ("warning: expanding grace notes\n") + print '\\tiny ' + + if str and str[0] == '}': + str = str[1:] + print '\\normalsize ' + + return str + # Try nibbling characters off until the line doesn't change. def try_parse_body_line (ln, state): prev_ln = '' @@ -438,13 +491,11 @@ def try_parse_body_line (ln, state): ln = try_parse_guitar_chord (ln) ln = try_parse_tuplet_begin (ln, state) ln = try_parse_group_end (ln, state) + ln = try_parse_grace_delims (ln) ln = junk_space (ln) if ln: - print 'Huh? Don\'t understand `%s\'' % ln - - - + sys.stderr.write ("Huh? Don't understand `%s'\n" % ln) @@ -468,7 +519,7 @@ def parse_file (fn): def identify(): - print '%s from LilyPond %s' % (program_name, version) + sys.stderr.write ("%s from LilyPond %s\n" % (program_name, version)) def help (): print r""" @@ -499,7 +550,13 @@ for f in files: if f == '-': f = '' + print ("\\score{") + print (" <") + print (" \\context Staff=one \\notes {") parse_file (f) + print (" }") + print (" >") dump_header (header) - print global_voice_stuff, 1 + print "%%%s" % global_voice_stuff, 1 + print ("}") -- 2.39.5