From 925f4ac3cf01ad7b1233514223ffb899f03899d1 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 27 Jul 1999 14:22:01 +0200 Subject: [PATCH] release: 1.1.68 --- Documentation/man/abc2ly.yo | 4 +- Documentation/man/convert-mudela.yo | 2 +- Documentation/man/ly2dvi.yo | 10 +- Documentation/man/midi2ly.yo | 2 +- Documentation/man/mudela-book.yo | 2 +- Documentation/man/out/abc2ly.1 | 4 +- Documentation/man/out/convert-mudela.1 | 2 +- Documentation/man/out/ly2dvi.1 | 6 +- Documentation/man/out/midi2ly.1 | 2 +- Documentation/man/out/mudela-book.1 | 2 +- Documentation/tex/reference-manual.yo | 40 +- Documentation/tex/tutorial.yo | 1470 ++++-------------------- NEWS | 17 +- VERSION | 2 +- input/GNUmakefile | 4 +- input/abc-raff.ly | 41 + input/bugs/barline.ly | 37 + input/star-spangled-banner.ly | 8 +- input/tutorial/GNUmakefile | 6 + input/tutorial/flowing.ly | 38 + input/{ => tutorial}/menuet.ly | 0 lily/auto-beam-engraver.cc | 4 +- lily/chord.cc | 28 +- lily/parser.yy | 10 +- ly/engraver.ly | 2 - ly/performer.ly | 14 + make/out/lilypond.lsm | 8 +- make/out/lilypond.spec | 4 +- scripts/abc2ly.py | 156 +-- scripts/convert-mudela.py | 14 +- scripts/mup2ly.py | 2 +- tex/mudela-book.tex | 2 +- 32 files changed, 577 insertions(+), 1366 deletions(-) create mode 100644 input/abc-raff.ly create mode 100644 input/bugs/barline.ly create mode 100644 input/tutorial/GNUmakefile create mode 100644 input/tutorial/flowing.ly rename input/{ => tutorial}/menuet.ly (100%) diff --git a/Documentation/man/abc2ly.yo b/Documentation/man/abc2ly.yo index d79ecee996..1896aae47c 100644 --- a/Documentation/man/abc2ly.yo +++ b/Documentation/man/abc2ly.yo @@ -5,7 +5,7 @@ COMMENT( ) manpage(LilyPond) (1) - (1998) + (1999) (abc2ly) (The LilyPond package) @@ -22,7 +22,7 @@ music typesetting package. manpagessynopsis() - abc2ly [options] midi-file + abc2ly [options] abc-file manpageoptions() diff --git a/Documentation/man/convert-mudela.yo b/Documentation/man/convert-mudela.yo index ea6cbe9b31..3a1a0a8d29 100644 --- a/Documentation/man/convert-mudela.yo +++ b/Documentation/man/convert-mudela.yo @@ -6,7 +6,7 @@ COMMENT(urg ) manpage(convert-mudela) (1) - (1998) + (1999) (The LilyPond package) (convert-mudela) diff --git a/Documentation/man/ly2dvi.yo b/Documentation/man/ly2dvi.yo index e3a6a1798a..d23853bf55 100644 --- a/Documentation/man/ly2dvi.yo +++ b/Documentation/man/ly2dvi.yo @@ -1,13 +1,13 @@ mailto(daboys@austin.rr.com) manpage(LilyPond) (1) - (1998) + (1999) (The LilyPond package) - (Ly2dvi32) + (Ly2dvi) -metalC(Automatically generated by yodl(1) from ly2dvi32.yo.) +metalC(Automatically generated by yodl(1) from ly2dvi.yo.) -manpagename(Ly2dvi32)(Python utility to convert mudela to DVI) +manpagename(Ly2dvi)(Python utility to convert mudela to DVI) manpagedescription() ly2dvi is a Python script which creates input file for LaTeX, @@ -24,7 +24,7 @@ Arne Fagertun name file(ly2dvi). manpagesynopsis() - ly2dvi32 [options] inputfile[.ly] [....] + ly2dvi [options] inputfile[.ly] [....] manpageoptions() diff --git a/Documentation/man/midi2ly.yo b/Documentation/man/midi2ly.yo index d774c6cb1d..f1faad93ed 100644 --- a/Documentation/man/midi2ly.yo +++ b/Documentation/man/midi2ly.yo @@ -5,7 +5,7 @@ COMMENT( ) manpage(LilyPond) (1) - (1998) + (1999) (midi2ly) (The LilyPond package) diff --git a/Documentation/man/mudela-book.yo b/Documentation/man/mudela-book.yo index fbdd3787a1..ea788681d1 100644 --- a/Documentation/man/mudela-book.yo +++ b/Documentation/man/mudela-book.yo @@ -5,7 +5,7 @@ COMMENT( ) manpage(LilyPond) (1) - (1998) + (1999) (The LilyPond package) (mudela-book) diff --git a/Documentation/man/out/abc2ly.1 b/Documentation/man/out/abc2ly.1 index 717d4efe06..bcab6edfed 100644 --- a/Documentation/man/out/abc2ly.1 +++ b/Documentation/man/out/abc2ly.1 @@ -1,4 +1,4 @@ -.TH "LilyPond" "1" "1998" "abc2ly" "The LilyPond package" +.TH "LilyPond" "1" "1999" "abc2ly" "The LilyPond package" .PP .PP .SH "NAME" @@ -13,7 +13,7 @@ music typesetting package\&. .PP manpagessynopsis() .PP -abc2ly [options] midi-file +abc2ly [options] abc-file .PP .SH "OPTIONS" .PP diff --git a/Documentation/man/out/convert-mudela.1 b/Documentation/man/out/convert-mudela.1 index 13616a7bc4..b31443bd84 100644 --- a/Documentation/man/out/convert-mudela.1 +++ b/Documentation/man/out/convert-mudela.1 @@ -1,4 +1,4 @@ -.TH "convert-mudela" "1" "1998" "The LilyPond package" "convert-mudela" +.TH "convert-mudela" "1" "1999" "The LilyPond package" "convert-mudela" .PP .PP .SH "NAME" diff --git a/Documentation/man/out/ly2dvi.1 b/Documentation/man/out/ly2dvi.1 index 8ef4efaf72..c090160395 100644 --- a/Documentation/man/out/ly2dvi.1 +++ b/Documentation/man/out/ly2dvi.1 @@ -1,8 +1,8 @@ -.TH "LilyPond" "1" "1998" "The LilyPond package" "Ly2dvi32" +.TH "LilyPond" "1" "1999" "The LilyPond package" "Ly2dvi" .PP .PP .SH "NAME" -Ly2dvi32 \- Python utility to convert mudela to DVI +Ly2dvi \- Python utility to convert mudela to DVI .PP .SH "DESCRIPTION" ly2dvi is a Python script which creates input file for LaTeX, @@ -19,7 +19,7 @@ Arne Fagertun name \fBly2dvi\fP\&. .PP .SH "SYNOPSIS" .PP -ly2dvi32 [options] inputfile[\&.ly] [\&.\&.\&.\&.] +ly2dvi [options] inputfile[\&.ly] [\&.\&.\&.\&.] .PP .SH "OPTIONS" .PP diff --git a/Documentation/man/out/midi2ly.1 b/Documentation/man/out/midi2ly.1 index 2f8f942910..60eeb630e2 100644 --- a/Documentation/man/out/midi2ly.1 +++ b/Documentation/man/out/midi2ly.1 @@ -1,4 +1,4 @@ -.TH "LilyPond" "1" "1998" "midi2ly" "The LilyPond package" +.TH "LilyPond" "1" "1999" "midi2ly" "The LilyPond package" .PP .PP .SH "NAME" diff --git a/Documentation/man/out/mudela-book.1 b/Documentation/man/out/mudela-book.1 index 0d9e0524d5..508ca98ebb 100644 --- a/Documentation/man/out/mudela-book.1 +++ b/Documentation/man/out/mudela-book.1 @@ -1,4 +1,4 @@ -.TH "LilyPond" "1" "1998" "The LilyPond package" "mudela-book" +.TH "LilyPond" "1" "1999" "The LilyPond package" "mudela-book" .PP .PP .SH "NAME" diff --git a/Documentation/tex/reference-manual.yo b/Documentation/tex/reference-manual.yo index 9c07521e0e..3f5f964824 100644 --- a/Documentation/tex/reference-manual.yo +++ b/Documentation/tex/reference-manual.yo @@ -206,7 +206,7 @@ up in a chord modifier table (containg code(maj), code(dim) etc.) Since combinations of numbers and dots are used for indicating durations, you can not enter real numbers in this mode. Dashes and -carets are used to indicate chord additions and substractions, so +carets are used to indicate chord additions and subtractions, so scripts can not be entered in chord mode. dit(Lyric mode) cindex(mode!lyric) Lyrics mode is introduced by the keyword @@ -539,10 +539,28 @@ cis' d' e' cis' c'? d' e' c'! ) cindex(duration) -Durations are entered as their reciprocal values -mudela(fragment,verbatim,center)( -a'1 a'2 a'4 a a'8 a a'16 a'32 a'64 +Durations are entered as their reciprocal values. For notes longer +than a whole note, use identifiers. +verb( + c'\longa c'\breve + c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64 c'2. c'8. c'16 ) +mudela()( +\score { + \notes \relative c'' { + a\longa a\breve + a1 a2 a4 a8 a16 a32 a64 a64 a2. a8. a16 + } + \paper { + loose_column_distance = 2.5 * \interline; + linewidth = -1.0; + \translator { \type "Score_engraver"; + \name "Score"; + \consists "Note_heads_engraver"; + \consists "Stem_engraver"; + \consists "Rhythmic_column_engraver"; + }}}) + mudela(fragment,verbatim,center)( r1 r2 r4 r8 r16 r32 ) @@ -687,7 +705,7 @@ per minute. code(\partial)keyindex(partial)var( duration)code(;) This creates an incomplete measure at the start of the music, eg. code(\partial 8*2;) creates a -starting measure lasting two eighth notes.cindex(anacrouse)cindex(upstep) +starting measure lasting two eighth notes.cindex(anacrusis)cindex(upstep) code(|)cindex(|)cindex(barcheck) @@ -1406,18 +1424,18 @@ name to give the chord. By default, LilyPond will not try to identify chord inversions: mudela(fragment,verbatim,center)( < - \context ChordNames { - \notes{ < e' g' c'' > } } - \context Staff \notes{ c' } + \context ChordNameVoice { + \notes{ < e'1 g' c'' > } } + \context Thread \notes{ < e'1 g' c'' > } >) If you want inversions to be recognized, you must set the property indexandcode(Score.chordInversion): mudela(fragment,verbatim,center)( < \property Score.chordInversion = 1 - \context ChordNames { - \notes{ < e' g' c'' > } } - \context Staff \notes{ c' } + \context ChordNameVoice { + \notes{ < e'1 g' c'' > } } + \context Thread \notes{ < e'1 g' c'' > } >) diff --git a/Documentation/tex/tutorial.yo b/Documentation/tex/tutorial.yo index c764814d9a..f17b5b58a7 100644 --- a/Documentation/tex/tutorial.yo +++ b/Documentation/tex/tutorial.yo @@ -21,13 +21,6 @@ COMMENT( with help of (among others) * Jan Nieuwenhuizen - - * Lambert Meertens, - - * Adrian Mariano - - * Mats Bengtsson - ) htmlbodyopt(bgcolor)(white) @@ -72,10 +65,14 @@ You have to give that specification using a em(language). This document is a gentle introduction to that language, which is called Mudela, an abbreviation for Music Definition Language. -We will demonstrate Mudela by presenting examples of input along with -resulting output. We will use English terms for notation, so if you -are not familiar with those, you should consult the glossary that is -distributed with LilyPond. +This tutorial will demonstrate how to use Mudela by presenting +examples of input along with resulting output. We will use English +terms for notation, so if you are not familiar with those, you should +consult the glossary that is distributed with LilyPond. + +The examples discussed are included in the distribution, in the +subdirectory file(input/tutorial/). It is recommended that you +experiment with input yourself, to get a feel for how LilyPond behaves. sect(The first tune) label(sec:firsttune) @@ -89,15 +86,15 @@ mudela(verbatim)(% lines preceded by a percent are comments. \score { \notes \relative c'' { - \key g; - \time 3/4; - - \repeat "volta" 2 { - d4 g,8 a b c d4 g, g | - e'4 c8 d e fis g4 g, g | - c4 d8()c b a( )b4 c8 b a g | - a4 [b8 a] [g fis] g2. | - } + \key g; + \time 3/4; + + \repeat "volta" 2 { + d4 g,8 a b c d4 g, g | + e'4 c8 d e fis g4 g, g | + c4 d8()c b a( )b4 c8 b a g | + a4 [b8 a] [g fis] g2. | + } b'4 g8 a b g a4 d,8 e fis d | @@ -113,12 +110,11 @@ mudela(verbatim)(% lines preceded by a percent are comments. } }) -You can try to enter and save this text with a text editor. It is also -included with in the package as file(input/menuet.ly). Compile it +Enter it (or copy it, the filename is file(menuet.ly)), and compile it with LilyPond and view the output. Details of this procedure may vary from system to system. To create the output, one would issue -code(ly2dvi menuet). file(ly2dvi) is a program that does the -job of calling LilyPond and TeX() and adjusting page margins. +code(ly2dvi menuet). file(ly2dvi) is a program that does the job of +calling LilyPond and TeX() and adjusting page margins. If all goes well, this will create the file file(menuet.dvi). To view this output, issue the command code(xdvi menuet). @@ -271,7 +267,7 @@ the notes.COMMENT( )A duration with augmentation dot is notated with the duration number followed by a period.COMMENT( )verb( - } + } ) COMMENT( ) This ends the sequential music to be repeated. LilyPond will typset @@ -317,7 +313,7 @@ Here the music ends. COMMENT( )verb(\paper { - linewidth = 10.0\cm; + linewidth = 14.0\cm; })COMMENT( )This specifies a conversion from music to notation output. Most of @@ -347,1288 +343,292 @@ symbols and their placement is em(generated) from a high-level musical description. In other words, LilyPond would be best described by `music compiler' or `music to notation compiler'. -The most interesting part of the input is the music -itself, in this case the sequence of notes. We will therefore focus -on music for now. Consequently, when we mean COMMENT( -)verb(\score { - \notes { MUSIC } - \paper { } -})COMMENT( - -) we will leave out the the repetitive details for now and only print -code(MUSIC). - -sect(When you know the notes to nop(print)ellipsis()) +sect(Lyrics and chords) -The basic building block of music is the note. Here comes the full -explanation A note is made of a pitch and a duration. The pitch of -the central C is written as code(c'). This is in line with -musicological notation; there this pitch is transcribed as -nop(c)sups(1) or c'. A quarter-note duration is written as code(4). -So, to print a quarter note whose pitch is central C, you enter the -following code(c'4). +In this section we show how to typeset a song of (unknown +origin).footnote(The author would welcome information about the origin +of this song.) -subsect(Duration) +verb(\header { + title = "The river is flowing"; + composer = "Traditonal (?)"; +} +\include "paper16.ly" +melody = \notes \relative c' { + \partial 8; + g8 | + c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g | + c4 c8 d [es () d] c4 | d4 es8 d c4. + \bar "|."; +} -The duration of a note is specified as a number: a whole note is -denoted by 1, a half note by 2, a quarter by 4, and so on. If you -want to augment a duration with a dot, simply affix a period to the -number. You can also print notes longer than a whole. You do this by -using identifiers (code(\breve) and code(\longa)): -Here are some random notes to show how it works. +text = \lyrics { + The ri -- ver is flo- __ wing, flo -- wing and gro -- wing, the + ri -- ver is flo -- wing down to the sea. +} -verb( - c'\longa c'\breve - c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64 c'2. c'8. c'16 -) +accompaniment =\chords { + r8 + c2-3- f-3-.7 d-min es4 c8-min r8 + c2-min f-min7 g-7^3.5 c-min } -COMMENT( \score { - \notes { - c'\longa c'\breve - c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64 c'2. c'8. c'16 - } - \paper { - linewidth = -1.0; - \translator { \type "Score_engraver"; - \name "Score"; - \consists "Note_heads_engraver"; - \consists "Stem_engraver"; - \consists "Rhythmic_column_engraver"; - }}} - -) - -subsect(Basic pitches) - -The pitch code(c') consists of two parts: one part for the note name, -and one for the octave. The letter specifies which note name to use: -note names simply are the letters code(a) to code(g). The number of -apostrophes specifies the octave to use: the C below central C is denoted by -code(c).footnote(By convention, the A above central C at concert -pitch is the tone that is used to tune instruments. Its frequency is -about 440 Hz.) Octaves can be added and substracted by adding quotes -(code(')) and adding commas (code(,)). -mudela(fragment,verbatim,center)( - c,,4 c, c c' c'' c''' d'4 e'4 f'4 g'4 -) - - -subsect(Alterations) - -The names `a' to `g' for entering pitches are convenient: th7ey are -short, pronounceable and they resemble the words for pitches in normal -musical vocabulary. - -Enter flats and sharps. In English there is no standard terse word -for C sharp or C flat. For this reason, mudela uses a different, -non-English convention for entering altered pitches: a note is made -sharp by adding the suffix `--is' to its name, and flat by adding the -suffix `--es'. For a double sharp another `--is' suffix is added, for -flats another `--es' nop(suffix.)footnote(Variations on this -convention are used in a number of germanic languages, notably Dutch, -German, Swedish, and Norwegian.) The names for the alterations of C -are given in bind(Table)ref(notename-tab). - -latexcommand(\begin{table}[h]) - center( - table(2)(ll)( - row(cell(English)cell(LilyPond)) - rowline() - row(cell(c double flat)cell(ceses)) - row(cell(c flat)cell(ces)) - row(cell(c natural)cell(c)) - row(cell(c sharp)cell(cis)) - row(cell(c double sharp)cell(cisis)) - ) - ) - latexcommand(\caption{Default note names}) - label(notename-tab) -latexcommand(\end{table}) - -Throughout this document we will continue to use these names.footnote( - Mudela defaults to Dutch notenames. To make (Dutch) pronunciation - easier, the a-flat and e-flat are contracted to code(as) and - code(es). Similarly, the a double flat and e double flat are - contracted to code(ases) and code(eses). For consistency, the Dutch - names also include code(aes), code(aeses), code(ees) and - code(eeses)) - -If you are not comfortable with these names, you can make your own. -Note names for different languages are included with the example -initialisation files, among others English (C sharp is abbreviated to -code(cs)), Italian, Swedish and Norwegian. If you want to use these -names, issue code(\include "LANGUAGE.ly") where you could substitute -code(italiano), code(deutsch) etc. for LANGUAGE. You should include -these files at toplevel, i.e., before opening a code(\score) block. - - - - - -sect(Chords) - -You can also use LilyPond to typeset chords. You do this by -expressing in mudela simultaneous music, i.e., notes that are to be -played concurrently. - -subsect(Where the chords have no names) - -In Mudela you can form simultaneous music by entering -code(\simultaneous {)var(stuff)code( }). A D-major chord is expressed -as COMMENT( - -)verb( -\simultaneous { d'8 fis'8 a'8 d''8 } -)mudela(fragment,verbatim,center)( - \context Voice \simultaneous { d'8 fis'8 a'8 d''8 } -) - -Simultaneous music are often used, so they an abbreviated form: -You can enter code(\simultaneous {)var(stuff)code( }) as -code(< )var(stuff)code( >). - -Chords can be entered in the music in the same places that notes can. -As an example we give a snippet of ``Twinkle Twinkle Little Star'' in -chords. We've aligned the chords in the input on their starting beat -to help you reading it. This layout does not influence the -typesetting result in any way. - -mudela(verbatim, fragment)( - \relative c' { - \time 2/4; - c4 c - - - - } -) - -There is one thing to note, in sequences of chords, the (relative) -pitch of a is taken with reference to the first note of the previous -chord. - -You can nest simultaneous and sequential music in any way you want, -e.g., COMMENT( - -)mudela(verbatim,fragment,center)( - < { g''4 g''4 } - { c'8 c' } > -)COMMENT( + \simultaneous { +% \accompaniment + \context ChordNames \accompaniment + + \addlyrics + \context Staff = mel + { \property Staff.noAutoBeaming = "1" + \property Staff.automaticMelismas = "1" + \melody } + \context Lyrics \text + } + \midi { } + \paper { linewidth = 10.0\cm; } +}) -) -As you can see, LilyPond has difficulty typesetting this -elegantly. To adequately solve this, you have to persuade LilyPond to -make separate stems for both sequential music lists. This is a topic -that is covered in bind(Section)ref(sec:polyphonic). +The result would look this.footnote(The titling and font size shown +may differ, since the titling in this document is not generated by +file(ly2dvi)) -subsect(Chords with names) +center(bf(The river is flowing) -In the previous section we have been talking more about `stacked notes' -rather than `chords'. -If you need to enter a lot of chords that have proper names, you can use -the code(\chords) mode as an alternative: -COMMENT( -)mudela(verbatim,fragment,center)( - \chords\transpose c''{ c1 d e } -) -COMMENT( URG? - \chords\relative c''{ c1 d e } +var(Traditonal (?)) ) -subsect(Names with chords) - -A more common problem is the typesetting of chord names. LilyPond has -a special kind of staff for this, the code(ChordNames) staff. -The code(ChordNames) staff accepts music like a normal staff, -but typesets only the name of each chord: -COMMENT( - -)mudela(verbatim,center)( -\score{ - \context ChordNames { - \chords - { c1 d-min e-maj5+.9 } - \notes\relative c - { } - } - \paper{ - linewidth=-1.0; - } +mudela()(\header { + title = "The river is flowing"; + composer = "Traditonal (?)"; +} +\include "paper16.ly" +melody = \notes \relative c' { + \partial 8; + g8 | + c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g | + c4 c8 d [es () d] c4 | d4 es8 d c4. + \bar "|."; } -) Because the ChordNames staff accepts normal music, it can be transposed, -and you may enter it any way you like, either as chords or as notes. - -sect(Adding nuances: articulation and dynamics) - -Articulation is entered by writing a dash and the name of the -desired articulation mark. You have to add a backslash in front of -the name to distinguish it from the name of a note. COMMENT( - -)mudela(fragment,verbatim)( - c''4-\staccato - c''4-\tenuto )COMMENT( - -)Typing a lot of staccato notes in this syntax will get tedious very -quickly. However, there are handy abbreviations for a few -articulations. They are shown in the following example: COMMENT( - -)mudela()( -\score{ \notes { - \property Voice.textStyle = typewriter - c''4-._"c-." s4 - c''4--_"c-{}-" s4 - c''4-+_"c-+" s4 - c''4-|_"c-|" s4 - c''4->_"c->" s4 - c''4-^_"c-\\^{ }" s4 - } -% \paper { linewidth = 12.\cm; } -})COMMENT( - -)Text and digits for fingering can be entered in the same manner: add a -dash and the text or digit to be printed: -COMMENT( - -)mudela(fragment,verbatim)(c''4-1 g''4-5 c''-"Sul tasto" ) - -Dynamic markings are another way to add a nuance to a note. They are -entered by adding the name for the dynamic sign after the note. COMMENT( - -)mudela(verbatim,fragment)( - c4-\ff c4-\fp c4 c4-\ppp c4 c4-\sfz -)COMMENT( - -) - -sect(Bridging the notes: beams, slurs and ties) - -A lot of symbols in notation have variable shape;they run from one -note to another. In LilyPond terminology, such a symbol is called a -em(spanner). To print a spanner, you have to attach a marker to the -note that begins it and to the one that ends it. These are the -spanners that are entered like this: - -description( -dit(Slur) - The slur has the opening parenthesis as -start marker is. The stopping marker is the closing parenthesis. -For example: -mudela(fragment,center,verbatim)( c'4( )c'4 ) - -You can nest nop(slurs,)footnote(This is -inconsistent when compared to the syntax for articulation hints. This -will be fixed some time, we hope.) and you can connect a note with a -slur on both the left and the right side: - -mudela(fragment,verbatim,center)( - c'4(( )c''4 )c'4( )g'4 -) - -dit(Beam) - -The starting marker for the beam is the opening bracket, the ending -marker is the closing bracket. The brackets have to be em(around) the -beamed notes. LilyPond has code that guesses what the pattern should -look like, so that you don't have to specify the beaming for -complicated patterns. COMMENT( - -)mudela(fragment,verbatim)( -[c'8 c'] [c'16 c' c' c'] [c'16. c'32 c' c'16.] -) - -The brackets themselves have no duration, so they are grammatically -equivalent to the barcheck. - -dit(Tie) LilyPond's tie is entered as a tilde, `code(~)', in analogy - with TeX()'s tie (which ties together words with a space), The tie is - similar to the slur: it looks like a slur, but a slur connects whole - chords, whereas the tie connects note heads. - -The following example demonstrates the use of ties: -mudela(fragment,verbatim,center)( - c''1 ~ c''4 - ~ -) - -Since the tie is thought to be inbetween the notes, it has no -duration, and is grammatically equivalent to the barcheck. - -dit(Hairpins) -Crescendi and decrescendi can be printed in hairpin style. The -starting marker for the crescendo is code(\<), and for the decrescendo -code(\>). Both have code(\!) as the ending marker. -mudela(fragment, verbatim)( - \relative c'' { c4 \< \! c4 \> \! c2 - < c1 - { s4 \< \! s4 \> \! s2 } > } -) -This example shows a trick: by attaching the markings to space rests -that run parallel to the whole note, you can have dynamic markings -within a note. - -) - -It is your job to make sure that each spanner that you start, also -ends. If it doesn't, then Bad Things are likely to happen. If you end -spanners that are not started, LilyPond will warn you about invalid -ending markers. - -sect(Commands) -label(sec:commands) - -Music notation constructs with no duration, like clefs and key -signatures, can be entered by inserting various -commands between the music. The general form of these commands is -COMMENT( - -)center(code(\keyword argument argument ... ;))COMMENT( - -)These are the commands that are currently supported in alfabetic order: -description( -dit(code(\bar) var(bartype)) - This command makes LilyPond print special bar - lines and repeat symbols. You can also use it to allow line breaks - when entering cadenzas. The argument var(bartype) is a string that - describes what kind of bar line to print. -COMMENT( - -)mudela(fragment,verbatim)( - \bar "|:"; c'4 \bar ":|:"; c'4 \bar ":|"; c'4 \bar "||"; - c'4 \bar "empty"; c'4 \bar "|."; -)COMMENT( - -)The command `code(\bar "empty")' does not create any visible bar - line, but it tells LilyPond to allow a linebreak at that position. - The `code(\bar)' command prints the specified symbol where you enter - it. If you give a `code(\bar)' command at the end of a measure then - the specified symbol replaces the automatic bar line. - - The code(\bar) command does not affect metric structure. - -dit(code(\cadenza) var(togglevalue)) This command toggles the -automatic printing of barlines. `code(\cadenza 1)' turns off the -automatically generated bar lines. They are switched on again with -`code(\cadenza 0)'. Then a bar line is printed, and LilyPond will act -as if you are again at the start of a measure. - - -This is useful when typesetting music without a meter (such as an ad - libitum cadenza). - -dit(code(\clef) var(clefname)) This command sets the current clef for notation, - i.e., a clef symbol is printed and the notes following this command - are shifted vertically. The argument is a string, the name of the - new clef. The default clef is the treble clef. - mudela(fragment,verbatim)( - \clef "bass"; c'4 - \clef "treble"; c'4 - \clef "alto"; c'4 - ) - -dit(code(\key) var(pitch) var(type)) This command changes the current - key signature. The key signature is printed at the start of every - line. The var(type) argument is an integer. Useful values are - available as the predefined identifiers code(\major) and - code(\minor). Omitting the second argument gives major keys. The - key of C-minor can be specified as `code(\key es)' or - `code(\key c \minor)'. - -dit(code(\keysignature) var(pitchlist)) - -This command changes the current key signature. Unlike the -`code(\key)' command, this command can produce arbitrary key -signatures, which can be useful for unconventional keys or modes. The -key signature is given in the form of a list of notes. The notes will -be printed in the key signature in the order that they appear on the -list. For example, the key of C-minor can be specified as -`code(\keysignature bes es as)'. The command `code(\keysignature fis -es bis)' provides a more exotic example. - - -dit(code(\time) var(numerator)code(/)var(denominator)) - This command changes the current time signature. - The default value for this time signature is common time (4/4). - -dit(code(\partial) var(duration)) - This command allows you to make - upsteps at the start of a piece. - The var(duration) argument has the same form as the duration of a - note. - -The `code(\partial)' command cannot be used to generate partial -measures in the middle of the music. -Example: - mudela(fragment,verbatim)( - \time 4/4; - \partial 4; - [d'8 dis'] e' c''4 e'8 c''4 - ) -) - -The commands described above do not give music that you could hear, -but within the language, they are "Music": they are grammatically -equivalent to notes, so they can appear in the same places as notes. - -sect(Notation context) - - -There are different ways to print multiple parts: as chords on a -single staff, as voices on a single staff, or in multiple staffs. The -concept of staff is not something musical. But what is it then? - - -The most simplistic explanation is: a staff is a graphic peculiarity -of the notation system. In other words, a staff is a picture of five -lines on which one can print note heads. We will call this view on -the concept of staff `staff symbol' from now on. - -But -there is more to a staff than the symbol. A staff -contains---besides a staff symbol--- more components: -COMMENT( - -)itemize( -it()A staff can have a key signature (printed at the left) -it()A staff can have a time signature (printed at the left) -it()A staff has bar lines -it()A staff has a clef (printed at the left) -) COMMENT( -) -To explain what a staff really is, we'll try to print music without -these components. Without those, it is still -possible to print music: -mudela()(\score{ -\notes \relative c' { \time 2/4; g'4 c,4 a'4 f4 e c d2 } -\paper { - linewidth = -1.; - \translator { - \StaffContext - \remove "Time_signature_engraver"; - \remove "Bar_engraver"; - \remove "Staff_symbol_engraver"; - \remove "Clef_engraver"; - \remove "Key_engraver"; - } - } -})COMMENT( +text = \lyrics { + The ri -- ver is flo- __ wing, flo -- wing and gro -- wing, the + ri -- ver is flo -- wing down to the sea. +} -) As you can see, you can still make out the general form of the -melody and the rhythm that is to be played, but the notation is -difficult to read. Moreover, the musical information is not complete. -The stress pattern in the notes can't be deduced from this output. -For this, we need a time signature: +accompaniment =\chords { + r8 + c2-3- f-3-.7 d-min es4 c8-min r8 + c2-min f-min7 g-7^3.5 c-min } -mudela()( -\score { - \notes \relative c' { \time 2/4; g'4 c,4 a'4 f4 e c d2 } - \paper{ - linewidth = -1.; -\translator{ - \StaffContext - \remove "Bar_engraver"; - \remove "Staff_symbol_engraver"; - \remove "Clef_engraver"; - \remove "Key_engraver"; - }} - }) COMMENT( - -)Technically speaking you can find out where the strong and weak beats are, but -it is difficult to find them quickly. Bar lines help you in finding -the location of the notes within the measure: -mudela()( \score { - \notes \relative c' { \time 2/4; g'4 c,4 a'4 f4 e c d2 } - \paper{ - linewidth = -1.; -\translator{ - \StaffContext - \remove "Staff_symbol_engraver"; - \remove "Clef_engraver"; - \remove "Key_engraver";} - } - } -) - -We can remedy part of the difficulties with reading pitches by adding a staff -symbol: - -mudela()(\score{ - \notes\relative c' { \time 2/4; g'4 c,4 -a'4 f4 e c d2 } \paper { - linewidth = -1.; - \translator { - \StaffContext - - \remove "Clef_engraver"; - \remove "Key_engraver"; - } - } -})COMMENT( - -) -This makes the output decidedly easier to read, but you still don't -know what the pitches of the notes above are. So this is still not -enough. But suppose you see the following notation: -mudela()(\score { - \notes \relative c' {\clef alto; \time 2/4; g'4 c,4 a'4 f4 e c d2 } - \paper { - linewidth = -1.; - } -})COMMENT( - -) Now you know the pitch of the notes: you look at the start of the line -and see a clef, and with this clef, you can determine the notated pitches. -You have found the em(context) in which the notation is to be -interpreted! - -So the context determines the relationship between a piece of music -and its notation: you, the reader, use context to deduce music from -notation. Because LilyPond writes notation, context works the -other way around for LilyPond: with context a piece of music can be -converted to notation. - -We see that a staff forms context, and that context is needed to -convert between notation and music. In LilyPond we turn around this -reasoning: LilyPond has a notion of notation context, and the staff is -an example of a notation context. In fact, the arguments of the -code(\context) command (Staff, GrandStaff) were all names of different -contexts. A notation context is a conversion between music and -notation. - -A score can contain many staffs and a staff can contain many voices. -This suggests that notation contexts are objects that can contain -other notation contexts. - -The following is a list in alfabetic order of the contexts that are -supported by LilyPond. Each notation context is characterised by its -name, the notation elements it creates, and the contexts that it can -contain. description( - - -dit(GrandStaff) A code(GrandStaff) context contains code(Staff) - contexts, and it adds a brace to the output at the - nop(left.)footnote(The GrandStaff is limited, LilyPond can not do - cross staff beaming and slurring.) - - A code(GrandStaff) context can contain code(Staff)s. Typically, it - will contain two code(Staff)s, one treble staff, and one bass - staff. The bar lines of the contained staffs are connected - vertically. - -dit(Lyrics) The code(Lyrics) context deals with - typesetting lyrics. This topic will be covered in - bind(Section)ref(tutorial:lyrics). - -dit(Score) The code(Score) context is the toplevel context: no context - can contain a code(Score) context. The code(Score) context handles - the administration of time signatures. It also makes sure that - items such as clefs, time signatures, and key-signatures are aligned - in columns across staffs. - - The code(Score) can contain code(Staff), code(StaffGroup), - code(Lyrics), code(GrandStaff) and code(RhythmicStaff) contexts. - -dit(RhythmicStaff) The code(RhythmicStaff) context is like the staff, - but much simpler: the notes are printed on one line, and pitches are - ignored. code(RhythmicStaff) can contain code(Voice) - contexts. - - -dit(Staff) The code(Staff) context handles clefs, bar lines, keys, - accidentals. A code(Staff) context can contain code(Voice) - contexts. - -dit(StaffGroup) A code(StaffGroup) context contains - code(Staff) or code(Lyrics) contexts, and prints a bracket at the - left. The bar lines in the participating staffs are connected. - - -dit(Voice) The code(Voice) context is a context that corresponds to a - voice on a staff. This context handles the conversion of noteheads, - dynamic signs, stems, beams, super- and subscripts, slurs, ties and rests - -COMMENT(do ChoireStaff) -) - - -If you are familiar with structured documents, you might see the -analogy of a context with a stylesheet: a stylesheet is neither -presentation nor information, but a recipe em(how) a specific piece of -information should be presented. Contrary to stylesheet, in music -notation the elements provided by context are essential to -understanding what is notated. - -The notions of ``current clef'' and ``current position within the -measure'' are all properties of notation contexts. Commands like -code(\clef) and code(\cadenza) change these properties, and this -explains why they are fundamentally different from musical expressions -like notes and rests. - -A notation context is not a primitive element of LilyPond: in -bind(Section)ref(tutorial:engravers) it will be explained how you can -form your own notation contexts. - -sect(Nested music: multiple staffs) -label(tutorial:more-staffs) - -Now we explain how to typeset music that runs in multiple staffs. -Consider the following---unrealistic---example: - -mudela(fragment)( - \context GrandStaff -) - -In this example the music consists of two notes. The above would -sound the same if it were written as a single chord on a single staff, -i.e., COMMENT( - -)mudela(fragment)( - -)COMMENT( - -) The Mudela construct for multiple staffs reflects the similarity -between the two examples: to get multiple staffs in Mudela you enter a -chord, with an additional instruction to tell LilyPond that the chord -does not represent notes stacked together, but staffs stacked -together. - -If a piece of music is to be interpreted as a staff, then this can be -expressed with the code(\context) construct. The following input says -``the quarter note with pitch e should be put on a staff.'' - -verb( - \context Staff e'4 -)COMMENT( - -) The same can be done for the other note, i.e., + \simultaneous { +% \accompaniment + \context ChordNames \accompaniment + + \addlyrics + \context Staff = mel + { \property Staff.noAutoBeaming = "1" + \property Staff.automaticMelismas = "1" + \melody } + \context Lyrics \text + } + \midi { } + \paper { linewidth = 10.0\cm; } +}) -verb( - \context Staff g4 -) COMMENT( +Again, we will dissect the file line by line.COMMENT( -) If you want to stack these staffs, you must create a chord of both: +)verb(\header {)COMMENT( +)Information about the music you are about to typeset goes into a +code(\header) block. The information in this block is not used by +LilyPond, but it is included in the output. file(ly2dvi) uses this +information to print titles above the music. verb( - < \context Staff e'4 - \context Staff g4 - > -) + title = "The river is flowing"; + composer = "Traditonal (?)";)COMMENT( -This looks reasonable, but the effect of this input is not what you -might expect: -mudela(fragment)( - < \context Staff e'4 - \context Staff g4 - > -)COMMENT( +)the code(\header) contains block assignments. An assignment starts +with a string. (which is unquoted, in this case). Then comes the +equal sign `code(=)'. After the equal sign comes the expression you +want to store. In this case, you want to put in strings. The +information have to be quoted, because they contain spaces. The +assignment is finished with a semicolon.COMMENT( -) Since there are no names specified for the desired staffs, LilyPond -thinks your wishes are fullfilled by putting the code(g) on the same -staff as the code(e). The correct solution is to label both staffs -with different names, for example code(trebleStaff) and -code(bassStaff). This makes LilyPond distinguish between them, and -create two staffs: - -mudela(verbatim,fragment)( - < \context Staff = trebleStaff e'4 - \context Staff = bassStaff g4 - > -)COMMENT( - -) The names that you choose do not matter as long as they are -different. This is almost right, except for the brace at the left and -the clef of the second staff. If you want a brace, then you have to -tell LilyPond that the chord you formed is to be interpreted as a -so-called grand staff. This is also done with the code(\context) -command. The bass clef is made with a clef command: COMMENT( +)code(\include "paper16.ly")COMMENT( -) mudela(verbatim,fragment)( - \context GrandStaff < - \context Staff = treblestaff e'4 - \context Staff = bassstaff { \clef "bass"; g4 } - >)COMMENT( +)Smaller size for inclusion in a book.COMMENT( -) +)verb(melody = \notes \relative c' {)COMMENT( -sect(Polyphonic music (or: Notation context properties)) -label(sec:polyphonic) +)The structure of the file will be the same as the previous one, a +code(\score) block with music in it. To keep things readable, we will +give the different parts of music names, and use names to construct +music within the score block. -In the section on notation contexts we explained that a notation -context can have properties that influence the conversion from music -to notation. A simple example of such a property is the clef: the -type of a clef helps determines the vertical position of note heads in -a staff. Some of these properties can be modified by commands such as -code(\clef) and code(\time). But notation contexts can have other -properties, that are settable in -a generic fashion. We will demonstrate this feature by printing -multiple voices on a staff. +verb(\partial 8;) -Printing more than one voice on a staff is like printing multiple -staffs stacked together. This suggests that the template to follow is -this:COMMENT( +The piece starts an anacrusis of one eighth. COMMENT( -)verb( - \context Staff < - \context Voice = one ... - \context Voice = two ... - > -) COMMENT( - -) On the ellipsis there should be music going from left to right, in -other words, notes enclosed in braces. Let us try the following counterpoint:COMMENT( - -)mudela(fragment,verbatim)( -\context "Staff" < - \context "Voice" = "one" { r4 as'4 () as'4 g'4 } - \context "Voice" = "two" { g'2 f'4 e'4 } ->) - -As you can see the result is not perfect. The notes on the last -two beats look like plain chords and not like separate voices. What - happened was that the stems of the upper and lower voices were -printed on top of each other. - -To remedy this, engravers traditionally make the stems of the lower -voice point down, and the stems of the upper up, as shown in -bind(Figure)ref(tutorial:multi-voice-fig). - -Surely the direction of a single stem is a property of the stem as a -graphical object. But the fact that all of the stems in a voice point -in the same direction is not directly graphical. Since this is a -property shared by all the stems in the voice, this property is a -property of the context code(Voice). The context code(Voice) has an -attribute whose value is the direction to use for stems. You can -change it to `up' by issuing the following phrase: -verb( - \property "Voice"."verticalDirection" = "1" -) - -This command should be read as ``change the property called -code(verticalDirection) within the current code(Voice) context to the value -code(-1).'' For the property code(verticalDirection) the value code(1) means -`up', and code(-1) means `down'. So, the -proper way to code the polyphonic example is given in -bind(Figure)ref(tutorial:multi-voice-fig). - -latexcommand(\begin{figure}[h]) -mudela(fragment,verbatim,center)( - \context "Staff" < - \context "Voice" = "one" { - \property Voice.verticalDirection = "1" - r4 as'4 () as'4 g'4 } - \context "Voice" = "two" { - \property Voice.verticalDirection = "-1" - g'2 f'4 e'4 } - > -) - latexcommand(\caption{Multiple voices}) - label(tutorial:multi-voice-fig) -latexcommand(\end{figure}) - -As you can see, this property also controls the directions of slurs. - -Other properties can also be set, and they can be within different -contexts. In general, you can set a property by specifying -code(\property) var(contexttype)code(.)var(propertyname) code(=) -var(value). Both var(contexttype), var(propertyname) and var(value) -should be strings. - -The effect of a property is pretty much hardwired into the -implementation (and thus subject to change), so we will not deal with -all the possible properties in detail. Among other characteristics -that can be set are the layout of slurs and beams. The initialisation -file file(property.ly) and the reference manual contain explanations -of all properties. - -sect(Lyrics) -label(tutorial:lyrics) - -Since a lyrics can have durations like notes, we consider them to -be music too. Entering lyrics in mudela has two aspects. First, you -have to enter the text, i.e., the syllables along with their -durations. After this, you have to specify how to convert these to -graphics. - -Lyrics consist of syllables, which are strings together with -durations. For entering lyrics we have to instruct LilyPond that what -we enter are not note names but strings. This instruction is the -keyword code(\lyrics). After entering this keyword you can enter a -musical construct---sequential music, simultaneous music, code(\context) -entries, etc.--- but with syllables instead of pitches. For example: -COMMENT( - -)verb(\lyrics { 'got8 me on my knees4, Le-8 lie! })COMMENT( - -) Next comes the conversion to notation. LilyPond can't (yet) figure -out that lyrics need different treatment than notes. As a result, the -default conversion will try to put the text you entered as note heads -onto a staff, and this will fail. This default must be overridden -with a code(\context) keyword. Printing syllables of text in a line is -done by a context called code(Lyrics). You can select this context -with the code(\context) keyword. Here is a simple example with output: -COMMENT( - -)mudela(fragment,verbatim)( -\context Lyrics \lyrics { 'got8 me on my knees,4 Le-8 lie! })COMMENT( - -)The result is technically correct, but it needs a melody to make it -perfor0mable: COMMENT( - -)mudela(fragment,verbatim)( - < - \context Staff { - \property Voice.beamAuto = "0" % no beams in melody - c''8. c''16 bes'8. a'16 g'4 f'8 g'4. - } - \context Lyrics \lyrics { 'got8. me16 on8. my16 knees,4 Le-8 lie!4. } - > -) COMMENT( - -) The strings that makes up each syllable in the lyrics block are -passed along to TeX() verbatim, so if you are proficient with TeX() -you can do various nifty things. Keep in mind that a syllable -either starts with a letter (a character in the range `code(a)' to -`code(z)' or `code(A)' to `code(Z)'), or it is a string enclosed -double quotes. It ends with either a number for the duration, or a space. -These tricks are demonstrated in the following example: -COMMENT( - -urg -\context Lyrics \lyrics { 'got8 m\textbf{e}8 on8. m$\cal_Y$16 knees,4 Le-8 lie!4.} -\context Lyrics \lyrics { 'got8 m{\bf e}4 on8. m$\cal_Y$16 knees,4 Le-8 lie!4.} +)verb(c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g | +c4 c8 d [es () d] c4 | d4 es8 d c4. +\bar "|."; )COMMENT( -)mudela(fragment,verbatim)(< - \context Staff { - \property Voice.beamAuto = "0" % no beams in melody - c''8. c''16 bes'8. a'16 g'4 f'8 g'4. - } - \context Lyrics \lyrics { 'got8 me8 on8. m$\cal_Y$16 "3s,"4 Le-8 lie!4.} -> -)COMMENT( +)We use explicit beaming. Since this is a song, we turn automatic +beams off, and use explicit beaming where needed.COMMENT( +)verb(})COMMENT( -) COMMENT(Groen is de kleur van geluk. Dat geldt zeker voor Bj"ork) +)This ends the definition of code(melody). Note that there are no +semicolons after declarations at top level.COMMENT( -sect(Toplevel Mudela) +)verb(text = \lyrics {)COMMENT( -Back in bind(Section)ref(sec:firsttune) we said we would ignore -toplevel constructions (e.g., code(\score)) until a later moment. -Now we will look at these constructions. +)Another identifier assignment. This one is for the lyrics. +Lyrics are formed by syllables that have duration, and not by +notes. To make LilyPond parse words as syllables, switch it into +lyrics mode with code(\lyrics). The brace after code(\lyrics) again +is an abbreviation of code(\sequential {). COMMENT( +)code(The4 ri -- ver is flo- __ wing, flo -- wing and gro -- wing, the + ri- ver is flo- __ wing down to the sea. + })COMMENT( -Mudela allows you to name constructs of the language. This is done by -using an em(identifier). Generally you can define an -identifier by entering code(identifierName = ... ) where there can be -a variety of things on the ellipsis. +)The syllables themselves. They are separated by spaces. You can get +syllable extenders by entering code(__), and centered hyphens with +code(--). We enter the syllables as if they are all quarter notes in +length (hence the code(4)), and use a feature to align the syllables +to the music, which isn't all quarter notes. COMMENT( -Here is a (partial) list of what you can abbreviate with identifiers -at top-level. -itemize( -it()The code(\score) block -it()The code(\paper) block -it()The code(\midi) block (to be explained in - bind(Section)ref(tutorial:sound)) -it()Music (sequential music, simultaneous music etc.) -it()Durations -it()Strings -it()Translators (to be explained in bind(Section)ref(tutorial:engravers)) -it()Integers -it()Reals -) -) - -When you refer -to the abbreviated entity, you must precede code(identifierName) -with a backslash, i.e., code(\identifierName). For example: -mudela(verbatim)( - czerny = \notes { [c16 g e g] } - \score { - \notes \context GrandStaff < - { c''2 g''2 } - { \clef bass; \czerny \czerny \czerny \czerny} - > - \paper { - linewidth = -1.0; - } - } -) - -You can also see identifiers in action within the code(\paper) block: -the value code(-1.0) is assigned to code(linewidth). Within the -code(\paper) block, identifiers are not used as abbreviation only: -assigning to some identifiers can influence the output: in this case, -the music line is printed at natural width. - -Recall the properties of a context, that could be set with -code(\property). It is a very general mechanism to tune the output of -the music, that is neatly separated from the real music. -Unfortunately, it is not convenient to type or read, and the precise -effect of a setting property isn't always apparent from its -definition. To remedy this, we can use an identifier to capture the -meaning of a code(\property). - -mudela(verbatim)( -stemup = \property Voice.verticalDirection = "1" -stemdown = \property Voice.verticalDirection = "-1" -shift = \property Voice.hshift = "1" -\score { - \context "Staff" \notes < - \context "Voice" = "one" { \stemup r4 as'4 () as'4 g'4 } - \context "Voice" = "two" { \stemup \shift g'2 f'4 e'4 } - \context "Voice" = "three" { \stemdown [d'8 dis'] [d' cis'] [c' b] c'4 } > - \paper{ linewidth = -1.0\pt; } -}) - -Several abbreviations like code(\stemup) are defined in the standard -initialisation file file(property.ly). Setting or changing context -properties can have a similar effect as the commands that were -discussed in bind(Section)ref(sec:commands). Don't be fooled by the -similarity in appearance between a declared property-setting entry and -a real command like code(\clef) or code(\bar). Real commands are -hardcoded into the language and they have to be terminated by -semicolons. - -sect(Sound output) -label(tutorial:sound) - -You get output by combining music with definition a conversion to -output. LilyPond currently supports one other conversion besides -notation: the conversion from abstract music to sound. You can have -LilyPond play the music that you entered. The format that is used for -this output is MIDI. The result is not very pretty, but it is useful -for prooflistening your files: typing errors stand out when you -listen, especially if they involve accidentals. - -The only information that you need to enter is the -tempo (Unfortunately, at this time, this the only thing that can be -tuned.). The syntax for the tempo is code(\tempo )var(duration) = -var(beatsperminute);, for example: COMMENT( )verb( -\score { - ...music... - \midi { \tempo 4 = 76; } -}) COMMENT( - -) - -sect(Contexts revisited: engravers) -label(tutorial:engravers) - -[revise] - -As was promised, we will now take a dive into the more wizardrous parts -of LilyPond: redefining (notation) contexts. We previously explained -that a context -itemize( -it()has a name -it()is a conversion from music to notation, -it()can contain other contexts -it()handles specific notation constructs -) - -This characterization almost automatically explains what the definition of a -context should look like: -itemize( -it() It should define a name -it()It should be part of the ``notation output definition,'' i.e., the - code(\paper) block -it() - It should contain a specification of what other contexts may be contained - in the context we're defining. -it() - It should contain a list of the notation constructs to be - handled. -) - -LilyPond can create notation for a large number of symbols. This code -is split up into basic building blocks. Each building block is called -an em(engraver), and an engraver generally handles only one notation -construct: the code(Clef_engraver) takes care of the clefs, the -code(Time_signature_engraver) takes care of printing time signatures, -etc. - -A notation context is formed by a group of engravers. A special class -in LilyPond---the code(Engraver_group_engraver)---allows engravers to -cooperate in a group, thus forming a notation context. - -The following definition shows a simplified Staff context: COMMENT( - -)verb( -\translator -{ - \context "Engraver_group_engraver"; - \name Staff ; - - \consists "Bar_engraver"; - \consists "Clef_engraver"; - \consists "Key_engraver"; - \consists "Local_key_engraver"; - \consists "Time_signature_engraver"; - \consists "Staff_symbol_engraver"; - - defaultClef = treble; - - \accepts "Voice"; -}) COMMENT( - -) This context, named Staff, puts its graphic objects into a compound -object (a so-called ``Line group''). At Staff level, bars, clefs, -keys, accidentals, time signatures and the staff symbol are handled. -A staff can contain a Voice context. You can also preset properties -of contexts: for instance, the clef that is printed upon starting a -Staff, is the treble clef. - - - -As a practical example, we will show how to typeset polymetric music, -i.e., music where the meter can differ for each staff. The solution -is not very complicated: normally all timing information (time -signature, rhythmic grouping) is synchronised across each staff. This -is done by having only one administration for timing information: in -the default configuration there is only one code(Timing_engraver), in -the code(Score) context. - -All staffs use the information in code(Score) context's the -code(Timing_engraver) for generating bar lines and time signatures. -So, we can have different timing for every staff, by moving the -code(Timing_engraver) into the Staff context. - -You can also declare contexts, and reference them. This is useful in -combination with code(\remove "..."): code(\remove) does the opposite -of code(\consists). This example demonstrates how to move the -code(Timing_engraver) from code(Score) context into code(Staff) -context. - - -mudela(verbatim)( - \score { - \notes < - \context Staff = one { \time 2/4; c'4 c'4 c'4 c'4 c'4 c'4 } - \context Staff = two { \time 3/4; c'4 c'4 c'4 c'4 c'4 c'4 } - > - \paper { - linewidth = -1.; - \translator { - \ScoreContext - \remove "Timing_engraver"; - } - \translator { - \StaffContext - \consists "Timing_engraver"; - } - } -} -) - -The context definitions provided as a default are in the standard -initialisation file file(engraver.ly). - - -sect(Urtexts and context selection) -label(tutorial:urtext) - -In bind(Section)ref(tutorial:more-staffs), we have shown you how to -make multiple staffs, and explained that you have to label every staff -(or more precisely: different contexts), to make sure that new ones -are created when you need them. In this section, the real power of -this mechanism will be unveiled. +accompaniment =\chords { +)COMMENT( -By naming other contexts that you create, you can reference other -contexts than the current context from within the music. For example, -from within the music that you enter for staff code(One), one could -enter a small piece of music, and send it to staff code(Two), e.g., +)We'll put chords over the music. There is a special mode (analogous +to code(\lyrics) and code(\notes) mode) where you can give the names +of the chords you want, in stead of the notes comprising the chord. COMMENT( -) mudela(fragment,verbatim)( - < - \context Staff = one { c''4 \context Staff = two { c4 c4 } c''4 } - \context Staff = two { \clef bass; g,4 g,4 g,4 g,4 } - > -) - +)verb(r8)COMMENT( +)There is no accompaniment during the anacrusis.COMMENT( -The mechanism of context selection can be used to fabricate an -nop(Urtext)footnote(em(Urtext) is the German word for `original text'. -The Urtext edition of a piece of music, is an edition that reflects -the original writing of the composer. Such editions are useful for -musicologists, and performers that want to perform authentic -interpretations. However, for mere mortals, the Urtext can be -hard to read. It might not contain fingering and beaming, and -typically it is full of footnotes. Moreover, common interpretations -may have emerged---after the composer died. For this reason, the -music that can be had as Urtext usually is also available in enhanced -and edited editions. ) and an edited edition from em(one source). We -will use the first few bars of bind(J.)bind(S.)Bach's first Cello -suite to demonstrate this. The example makes heavy use of space -rests; here they are used as a placeholder to attach articulation -marks to. - -mudela(verbatim)( - bachMotive = \notes \relative c { g16 d' b' a b d, b' d, } - bach = \sequential { \clef bass; \time 4/4; \bachMotive \bachMotive \bar "|."; } - slursOne = \notes { s16( s s s s16 s s )s } - slursTwo = \notes { s16-. s s() s s16() s s ()s } - - \score{ - \context Staff { < - \context Voice = celloVoice { \bach} - \context Voice = celloVoice { \slursOne \slursOne } - > - < - \context Voice = celloVoice { \bach } - \context Voice = celloVoice { \slursTwo \slursTwo } - > - } - \paper { linewidth = -1.;} - } -) +)verb(c2-3- f-3-.7 +)A chords is started by a note that is the tonic of the chord. The +first one lasts a half note. An unadorned note creates a major +triad, while a minor triad is wanted. code(3-) modifies the third to +be small. code(7) modifies (adds) a seventh, which is small by default +to create the code(f a c es) chord. Multiple modifiers must be +separated by a dot. +COMMENT( -The slurs that you define should be put on the music that is defined -by the code(\bach) identifier. By labeling a code(Voice) context, and -directing both the articulation and the notes to that same code(Voice) -context, the articulation is put over the right notes. +)verb(d-min es4 c8-min r8)COMMENT( +)Some modifiers have predefined names, eg. code(min) is the same as +code(3-), so code(d-min) is a minor code(d) chord.COMMENT( -sect(Transposing) -label(tutorial:more-grammar) +)verb(c2-min f-min7 g-7^3.5 c-min })COMMENT( +)You may leave out the dot between a named modifier code(min) and a +normal modifier code(7). Tones from a chord are removed with chord +substractions. Substractions are started with a caret, and they are +also separated by dots. In this example, code(g-7^3.5) produces a +minor seventh. The brace ends the sequential music. COMMENT( -One of the things that you can do with music is em(transposing) it. -If you want to transpose a piece of music, then you should prefix it -with the keyword code(\transpose) along with the pitch (relative to -the central C, i.e., code(c')) for the transposition.footnote(the -code(\context Staff) is to make sure that no separate staffs are created -for the code(\scale) and code(\transpose cis' \scale) part.) +)verb(\score { + \simultaneous {)COMMENT( +)We put the music together in score block. Melody, lyrics and +accompaniment have to sound at the same time, so they should be +code(\simultaneous).COMMENT( -mudela(verbatim)( -scale = \notes \relative c' { [c8 d e f] } -\score { - \notes { - \context Staff { \scale \transpose cis' \scale } - } - \paper { linewidth = -1.0; } -}) +)verb( % \accompaniment)COMMENT( +)Chords mode generates notes grouped in code(\simultaneous) music. If +want to see the chords in normal notation, you can remove the comment +sign. The chords are then printed on a staff with noteheads. COMMENT( -sect(Staff switching) +)verb(\context ChordNames \accompaniment)COMMENT( -We have seen that contexts can be nested. This means that they form a -tree. It is possible to edit this tree: for example, a code(Voice) -context can be taken out of a code(Staff) context, and put into -another. This has the effect of the voice switching staffs (something -that often happens in keyboard music). The syntax for this operation -with these particular contexts is code(\translator Staff = newStaffName). +)Normally, the notes that you enter are transformed into noteheads. +The note heads alone make no sense, they need surrounding information: +a key signature, a clef, staff lines, etc. They need em(context). +This context also is a thing that has to be created. This is done by +code(\context). It takes two arguments. The first is the name of a +em(notation) or em(interpration context). The name is a string, it +can be quoted with code(") quotes). The second argument is the music +that should be interpreted in this context. -The effect is analogous to the first example in section -ref(tutorial:urtext), but with the code(\translator) construction it -is possible to split the real music and the commands that determine in -which staff the music is printed. For example: +By default, LilyPond will create a Staff context for you. If you +would remove the code(%) sign in the previous line, you see that +mechanism in action. For the previous line, we could have written +code(\context Staff \accompaniment), and get the same effect.COMMENT( -mudela(verbatim)( +)verb(\addlyrics)COMMENT( + +)The lyrics need to be aligned with the melody. This is done by +combining both with code(\addlyrics). code(\addlyrics) takes two +pieces of music (usually a melody and lyrics, in that order) and +aligns the lyrics syllables of the second piece under the notes of the +first piece. If you would reverse the order, the notes would be +aligned on the lyrics, which is not very useful. (Besides, it looks +silly).COMMENT( -% real music -aVoice = \context Voice = voiceA \notes { c''4 c4 c4 c''4 } -bVoice = \context Voice = voiceB \notes { g,4 g,4 g,4 g,4 } +)verb( \context Staff = mel {)COMMENT( -% staff switching stuff -switch = \context Voice = voiceA \notes { s4 \translator Staff = staffB s4 - s4 \translator Staff = staffA s4 } +)This is first piece of music. We instantiate a code(Staff) context +explicitly: should you chose to remove comment before the ``note +heads'' version of the accompaniment, the accompaniment will be on a +nameless staff. In that case, the melody has to be on a different +staff as the accompaniment. This is accomplished by giving the melody +staff a different name.COMMENT( -\score { - < - \context Staff = staffA < \aVoice \switch > - \context Staff = staffB < \bVoice \clef bass; > - > - \paper { linewidth = -1.; } -} -) +)verb({ \property Staff.noAutoBeaming = "1")COMMENT( -If you want to switch staffs you are in the middle of a slur or a -beam, the staffs should have a fixed distance. You do this by using the PianoStaff context. -mudela(verbatim,center)( -\score{ - \context PianoStaff < - \context Staff=one \notes{ s2 } - \context Staff=two \notes\relative c{ - \time 4/8; - \clef "bass"; - [c8( e \translator Staff=one g )c] - } - > - \paper { - linewidth=-1.0; - } -} -) +)An interpretation context has variables that tune its behavior. One +of the variables is code(noAutoBeaming). If set and non-zero (i.e., +true) LilyPond will not try to automatic beaming on the current +staff.COMMENT( -sect(Tuplets) +)verb( \property Staff.automaticMelismas = "1")COMMENT( -The notes in a triplet take 2/3 of their notated duration. The syntax -for triplet in LilyPond reflects this. To make a triplet, you enter -COMMENT( +)Similarly, we want do not want to put a lyric syllable when there is +a slur. This sets up the Staff context to signal slurs while +code(\addlyrics) is processed. COMMENT( -)mudela(verbatim,fragment,center)( - \times 2/3 { c''4 c''4 c''4 } -)COMMENT( +)verb( \melody })COMMENT( -) +)Finally, we put the melody on the current. Note that the +code(\property) directives and code(\melody) are grouped in sequential +music. So the property settings are done before the melody is +processed. COMMENT( -Of course, you can also use different ratios, and use beamed notes or -rests: -COMMENT( -)mudela(fragment)( - \context Voice \times 4/5 { [c''8 c''16 c''16] r8 [g'8 g'8] } -) +)verb( \context Lyrics \text)COMMENT( -If you make a tuplet of beamed notes, where the beam is as wide as -the bracket, the bracket is omitted. +)The second argument of code(\addlyrics) is the text. Text also +should land on a Staff, but on a context for syllables, +extenders, hyphens etc. This context is called Lyrics.COMMENT( -sect(Repeats) +)verb( })COMMENT( -A repeated piece of music can consist of two parts: one part to be -repeated, and optionally, a list of alternative endings: -COMMENT( +)This ends code(\simultaneous).COMMENT( -)mudela(verbatim,fragment,center)( - \relative c'{ - \time 2/4; - g' a - \repeat "volta" 2 { b c } - \alternative { - { d c } { d e } - } - f g - } -) The number code(repeat-count) defines how many times the piece should be -played. You may leave out the code(\alternative) part. There must not -be more alternative endings than the code(repeat-count). +)verb( \midi { })COMMENT( -A less intuitive form may be needed for lyrics, when there are -a couple alternatives, but nothing is repeated. The code(\repeat) command -must be present, but it may specify an empty music list: -COMMENT( +)This makes the music go to a MIDI file as well. MIDI is great for +checking music you enter. You listen to the MIDI file, if you hear +something weird, its probably a typing error. code(\midi) is a `output +definition', a declaration that specifies how to output music +analogous to code(\paper { }).COMMENT( -)mudela(verbatim,fragment,center)( - \context Lyrics \lyrics { - \repeat "fold" 2 { } - \alternative { - { Let's not sing - this twice } - { Rather sing - this in- stead } - } - } -) +)verb( \paper { linewidth = 10.0\cm; })COMMENT( +)We also want notation output.COMMENT( -sect(Grace notes) +)verb(})COMMENT( -sect(\rhythm) +)End the score block. diff --git a/NEWS b/NEWS index fd7f2aa6a1..4b64237a2e 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,18 @@ +pl 67.hwn1 + - tutorial updates + - \property beamAuto -> noAutoBeaming + +pl 67.uu1 + - abc2ly updates + +pl 67.jcn1 + - bfs: refman/parser subtract + - chord::find_additions_and_subtractions: termination assurance + - bf: refman: chord-inversion examples + + +******** + pl 66.hwn1 - bf: chord mode unsigned '-' -> unsigned CHORD_MINUS (1 SR conflict). - refman reedit. @@ -1894,7 +1909,7 @@ pl 17.jbr1 - scripts/ly2dvi.py: Modified search paths to match the new lilypond installation tree. - scripts/convert-mudela.py: Remove the an existing backup file - before renaming original. This is a WIN32 Python requirement. + before renaming original. This is a WINDOWS32 Python requirement. - Documentation/ntweb/index.html: Updated documentation to match new lilypond installation tree. - lily/main.cc: Fixed LILYPONDPREFIX search paths. diff --git a/VERSION b/VERSION index 29a7cbaab8..21a9f1cb6e 100644 --- a/VERSION +++ b/VERSION @@ -1,7 +1,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=1 -PATCH_LEVEL=67 +PATCH_LEVEL=68 MY_PATCH_LEVEL= # use the above to send patches: MY_PATCH_LEVEL is always empty for a diff --git a/input/GNUmakefile b/input/GNUmakefile index 8d34775dfe..4801cd5c13 100644 --- a/input/GNUmakefile +++ b/input/GNUmakefile @@ -2,9 +2,9 @@ depth = .. -SUBDIRS=test bugs +SUBDIRS=test bugs tutorial -examples=praeludium-fuga-E star-spangled-banner just-friends +examples=praeludium-fuga-E star-spangled-banner just-friends abc-raff flexamples= LOCALSTEPMAKE_TEMPLATES=mutopia diff --git a/input/abc-raff.ly b/input/abc-raff.ly new file mode 100644 index 0000000000..b6a857102f --- /dev/null +++ b/input/abc-raff.ly @@ -0,0 +1,41 @@ + +voicedefault = \notes { +\time 6/8; \key D; d''8 fis''8 fis''8 cis''8 e''8 e''8 | + d''8 e''8 fis''8 g''8 fis''8 e''8 | + d''8 fis''8 fis''8 cis''8 e''8 e''8 | + d''8 fis''8 e''8 d''8 b'8 a'8 | + d''8 fis''8 fis''8 cis''8 e''8 e''8 | + d''8 e''8 fis''8 g''8 fis''8 e''8 | + fis''8 a''8 fis''8 g''8 fis''8 e''8 \bar "|"; d''8 +fis''8 e''8 d''8 b'8 a'8 \bar ":|"; d''8 fis''8 e''8 +d''8 cis''8 b'8 \bar "||"; a'4. -\trill b'4. | + g''8 fis''8 e''8 fis''8 d''8 b'8 | + a'8 fis'8 a'8 b'4 cis''8 | + d''8 fis''8 e''8 d''8 cis''8 b'8 | + a'4. -\trill b'4. -\trill | + e''8 fis''8 e''8 e''8 fis''8 g''8 | + fis''8 a''8 fis''8 g''8 fis''8 e''8 \bar "|"; d''8 +fis''8 e''8 d''8 cis''8 b'8 \bar ":|"; d''8 fis''8 e''8 +d''8 b'8 a'8 \bar "||"; fis''8 a'8 a'8 e''8 a'8 a'8 +| + d''8 e''8 fis''8 g''8 fis''8 e''8 | + fis''8 a'8 a'8 e''8 a'8 a'8 | + d''8 fis''8 e''8 d''8 b'8 a'8 | + fis''8 a'8 a'8 e''8 a'8 a'8 | + d''8 e''8 fis''8 g''8 fis''8 e''8 | + fis''8 a''8 fis''8 g''8 fis''8 e''8 | + d''8 fis''8 e''8 d''8 b'8 a'8 \bar ":|"; +}\score{ + \notes < + + \context Staff="default" \$voicedefault + >\header { +composer = "Trad."; + +tagline = "Lily was here -- Directly converted from ABC"; + +title = "Paddy O'Rafferty"; +} +\paper {} +\midi {} +} \ No newline at end of file diff --git a/input/bugs/barline.ly b/input/bugs/barline.ly new file mode 100644 index 0000000000..ff14437a05 --- /dev/null +++ b/input/bugs/barline.ly @@ -0,0 +1,37 @@ +\header { + title = "The river is flowing"; + composer = "Traditonal (?)"; +} + +melody = \notes \relative c' { + \partial 8; + g8 | + c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g | + c4 c8 d [es () d] c4 | d4 es8 d c4. + \bar "|.";\clef bass; +} + +text = \lyrics { + The ri -- ver is flo -- wing, flo -- wing and gro -- wing, the + ri -- ver is flo -- wing down to the sea. +} + +accompaniment =\chords \sequential { + r8 + c2-min f-min 7 d-min es4 c8-min r8 + c2-min f-min 7 g c-min +} + +\score { + \simultaneous { + \context ChordNames \accompaniment + \addlyrics + \context Staff { + \property Voice.beamAuto = "0" + \property Staff.automaticMelismas = "1" + \melody } + \context LyricVoice \text + } + \paper { } + \midi { } +} diff --git a/input/star-spangled-banner.ly b/input/star-spangled-banner.ly index 4a08b2fe33..ca9a35eb08 100644 --- a/input/star-spangled-banner.ly +++ b/input/star-spangled-banner.ly @@ -16,7 +16,7 @@ http://www.Arkkra.com/doc/star.ps $staff1_voice_1 = \notes { a8.()fis16 - \repeat semi 2 { d4 fis4 a4 d'2 fis'8. e'16 d'4 fis4 gis4 a2 a8 a8 + \repeat volta 2 { 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 } \alternative { { 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 @@ -28,7 +28,7 @@ $staff1_voice_1 = \notes { $staff1_voice_2 = \notes { a8.()fis16 - \repeat semi 2 { a,4 d4 e4 d4 () fis4 fis8. fis16 fis4 d4 d4 cis2 + \repeat volta 2 { a,4 d4 e4 d4 () fis4 fis8. fis16 fis4 d4 d4 cis2 e8 e8 a4. a8 a4 a2 a8. a16 a4 a4 a4 } \alternative { { 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 @@ -38,7 +38,7 @@ $staff1_voice_2 = \notes { $staff2_voice_1 = \notes { r4 - \repeat semi 2 { fis4 a4 a4 b2 cis'8. cis'16 b4 b4 b4 a2 cis'8 cis'8 + \repeat volta 2 { 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 } \alternative { { 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 @@ -49,7 +49,7 @@ $staff2_voice_1 = \notes { $staff2_voice_2 = \notes { r4 - \repeat semi 2 { d4 d4 cis4 b,2 ais,8. ais,16 b,4 b,4 e4 a,2 a8 a8 + \repeat volta 2 { 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 } \alternative { { 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 diff --git a/input/tutorial/GNUmakefile b/input/tutorial/GNUmakefile new file mode 100644 index 0000000000..558771769c --- /dev/null +++ b/input/tutorial/GNUmakefile @@ -0,0 +1,6 @@ +depth = ../.. + +LOCALSTEPMAKE_TEMPLATES=mutopia +include $(depth)/make/stepmake.make + + diff --git a/input/tutorial/flowing.ly b/input/tutorial/flowing.ly new file mode 100644 index 0000000000..74339f3ceb --- /dev/null +++ b/input/tutorial/flowing.ly @@ -0,0 +1,38 @@ +\header { + title = "The river is flowing"; + composer = "Traditonal (?)"; +} +\include "paper16.ly" +melody = \notes \relative c' { + \partial 8; + g8 | + c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g | + c4 c8 d [es () d] c4 | d4 es8 d c4. + \bar "|."; +} + +text = \lyrics { + The ri -- ver is flo- __ wing, flo -- wing and gro -- wing, the + ri -- ver is flo -- wing down to the sea. +} + +accompaniment =\chords { + r8 + c2-3- f-3-.7 d-min es4 c8-min r8 + c2-min f-min7 g-7^3.5 c-min } + +\score { + \simultaneous { +% \accompaniment + \context ChordNames \accompaniment + + \addlyrics + \context Staff = mel + { \property Staff.noAutoBeaming = "1" + \property Staff.automaticMelismas = "1" + \melody } + \context Lyrics \text + } + \midi { } + \paper { linewidth = 10.0\cm; } +} diff --git a/input/menuet.ly b/input/tutorial/menuet.ly similarity index 100% rename from input/menuet.ly rename to input/tutorial/menuet.ly diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc index b9332ed78d..c6177c5f7a 100644 --- a/lily/auto-beam-engraver.cc +++ b/lily/auto-beam-engraver.cc @@ -160,8 +160,8 @@ Auto_beam_engraver::consider_end_and_begin (Moment test_mom) /* Allow already started autobeam to end */ - Scalar on = get_property ("beamAuto", 0); - if (!on.to_bool ()) + Scalar on = get_property ("noAutoBeaming", 0); + if (on.to_bool ()) return; if (begin_mom) diff --git a/lily/chord.cc b/lily/chord.cc index 7a42576502..e3475f3aa2 100644 --- a/lily/chord.cc +++ b/lily/chord.cc @@ -6,6 +6,12 @@ (c) 1999 Jan Nieuwenhuizen */ +/* + FIXME: + + A triad is a chord of three tones, and not an interval of a third. + */ + #include "chord.hh" #include "warn.hh" @@ -258,7 +264,7 @@ Chord::find_additions_and_subtractions(Array* add_arr_p, Array all_arr; all_arr.push (tonic); @@ -270,29 +276,37 @@ Chord::find_additions_and_subtractions(Array* add_arr_p, Arraypush (p); - j++; + (j < pitch_arr_.size ()) ? j++ : i++; } + /* + a triad is missing: chord subtraction + */ else { sub_arr_p->push (a); - i++; + (i < all_arr.size ()) ? i++ : j++; } } /* add highest addition, because it names chord + (1, 3 and) 5 not an addition: part of normal chord */ if (trap_i (tonic, pitch_arr_.top () > 5)) add_arr_p->push (pitch_arr_.top ()); diff --git a/lily/parser.yy b/lily/parser.yy index 7015597e16..682365234a 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -231,7 +231,7 @@ yylex (YYSTYPE *s, void * v_l) %type pitch_list %type chord -%type chord_additions chord_substractions chord_notes chord_step +%type chord_additions chord_subtractions chord_notes chord_step %type chord_note chord_inversion %type midi_block midi_body %type duration_length @@ -267,7 +267,7 @@ yylex (YYSTYPE *s, void * v_l) mudela: /* empty */ | mudela toplevel_expression {} - | mudela assignment { } + | mudela assignment { } | mudela error | mudela INVALID { THIS->error_level_i_ =1; @@ -1447,7 +1447,7 @@ simple_element: ; chord: - steno_tonic_pitch optional_notemode_duration chord_additions chord_substractions chord_inversion { + steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion { $$ = THIS->get_chord (*$1, $3, $4, $5, *$2); }; @@ -1470,7 +1470,7 @@ chord_notes: } ; -chord_substractions: +chord_subtractions: { $$ = new Array; } @@ -1498,7 +1498,7 @@ chord_step: $$ = new Array; $$->push (*$1); } - | CHORDMODIFIER_PITCH chord_note { + | CHORDMODIFIER_PITCH chord_note { /* Ugh. */ $$ = new Array; $$->push (*$1); $$->push (*$2); diff --git a/ly/engraver.ly b/ly/engraver.ly index 0e5e9d2cb1..fadc695390 100644 --- a/ly/engraver.ly +++ b/ly/engraver.ly @@ -92,7 +92,6 @@ VoiceContext = \translator { \consists "Dot_column_engraver"; \consists "Stem_engraver"; \consists "Beam_engraver"; - beamAuto = "1"; \consists "Auto_beam_engraver"; \include "auto-beam-settings.ly"; \consists "Chord_tremolo_engraver"; @@ -122,7 +121,6 @@ GraceContext=\translator { \consists "Local_key_engraver"; \consists "Stem_engraver"; \consists "Beam_engraver"; - beamAuto = "1"; \consists "Slur_engraver"; \consists "Auto_beam_engraver"; \include "auto-beam-settings.ly"; diff --git a/ly/performer.ly b/ly/performer.ly index f98ea244f5..44e3272c53 100644 --- a/ly/performer.ly +++ b/ly/performer.ly @@ -102,6 +102,19 @@ PianoStaffContext = \translator { \consists "Time_signature_performer"; \consists "Tempo_performer"; } + +\translator { + \type "Staff_performer"; + \accepts ChordNameVoice; + \name ChordNames; +} + +\translator { + \type Performer_group_performer; + \consists Note_performer; + \name ChordNameVoice; +} + \translator { \type Performer_group_performer; @@ -120,6 +133,7 @@ ScoreContext = \translator { \accepts Lyrics; \accepts StaffGroup; \accepts ChoirStaff; + \accepts ChordNames; \consists "Swallow_performer"; }; \translator { \ScoreContext } diff --git a/make/out/lilypond.lsm b/make/out/lilypond.lsm index caf324b529..1567150011 100644 --- a/make/out/lilypond.lsm +++ b/make/out/lilypond.lsm @@ -1,7 +1,7 @@ Begin3 Title: LilyPond -Version: 1.1.67 -Entered-date: 26JUL99 +Version: 1.1.68 +Entered-date: 27JUL99 Description: LilyPond is a music typesetter. It produces beautiful sheet music using a high level description file as input. LilyPond is part of @@ -13,8 +13,8 @@ Author: hanwen@cs.uu.nl (Han-Wen Nienhuys) janneke@gnu.org (Jan Nieuwenhuizen) Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys) Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert - 1000k lilypond-1.1.67.tar.gz + 1000k lilypond-1.1.68.tar.gz Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/ - 1000k lilypond-1.1.67.tar.gz + 1000k lilypond-1.1.68.tar.gz Copying-policy: GPL End diff --git a/make/out/lilypond.spec b/make/out/lilypond.spec index cfd75ac2d1..e6b035a10e 100644 --- a/make/out/lilypond.spec +++ b/make/out/lilypond.spec @@ -1,9 +1,9 @@ Name: lilypond -Version: 1.1.67 +Version: 1.1.68 Release: 1 Copyright: GPL Group: Applications/Publishing -Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.1.67.tar.gz +Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.1.68.tar.gz Summary: A program for printing sheet music. URL: http://www.cs.uu.nl/~hanwen/lilypond Packager: Han-Wen Nienhuys diff --git a/scripts/abc2ly.py b/scripts/abc2ly.py index d06608da23..bddb9116c7 100644 --- a/scripts/abc2ly.py +++ b/scripts/abc2ly.py @@ -41,7 +41,6 @@ def select_voice (name): # assert 0 # current_voice_idx >= 0 -global_voice_stuff = [] default_len = 8 global_key = [0] * 7 # UGH names = ["One", "Two", "Three"] @@ -70,12 +69,6 @@ class Rational: pass -def dump_global (outf): - outf.write ("\nglobal = \\notes{") - for i in global_voice_stuff: - outf.write (i); - outf.write ("\n}") - def dump_header (outf,hdr): outf.write ('\\header {') @@ -101,8 +94,8 @@ def dump_voices (outf): def dump_score (outf): outf.write (r"""\score{ - \notes< - \global""") + \notes < +""") ks = voice_idx_dict.keys (); ks.sort () @@ -126,6 +119,16 @@ def set_default_length (s): if m: __main__.default_len = string.atoi ( m.group (1)) +def set_default_len_from_time_sig (s): + m = re.search ('([0-9]+)/([0-9]+)', s) + if m: + n = string.atoi (m.group (1)) + d = string.atoi (m.group (2)) + if (n * 1.0 )/(d * 1.0) < 0.75: + default_len = 16 + else: + default_len = 8 + def gulp_file(f): try: i = open(f) @@ -247,7 +250,7 @@ tup_lookup = { '5' : '4/5', '6' : '4/6', '7' : '6/7', - '9': '8/9', + '9' : '8/9', } @@ -311,11 +314,13 @@ def try_parse_header_line (ln): if g == 'M': if a == 'C': a = '4/4' - global_voice_stuff.append ('\\time %s;' % a) +# global_voice_stuff.append ('\\time %s;' % a) + set_default_len_from_time_sig (a) + voices_append ('\\time %s;' % a) if g == 'K': __main__.global_key =compute_key (a)# ugh. + voices_append ('\\key %s;' % a) - global_voice_stuff.append ('\\key %s;' % a) if g == 'O': header ['origin'] = a if g == 'X': @@ -326,6 +331,8 @@ def try_parse_header_line (ln): header_append ('history', a) if g == 'B': header ['book'] = a + if g == 'C': + header ['composer'] = a if g == 'S': header ['subtitle'] = a if g == 'L': @@ -381,7 +388,7 @@ def duration_to_mudela_duration (multiply_tup, defaultlen, dots): base = 1 # (num / den) / defaultlen < 1/base - while base * multiply_tup[0] < defaultlen * multiply_tup[1]: + while base * multiply_tup[0] < multiply_tup[1]: base = base * 2 @@ -394,7 +401,9 @@ class Parser_state: self.next_den = 1 self.parsing_tuplet = 0 -# return (num,den,dots) + + +# return (str, num,den,dots) def parse_duration (str, parser_state): num = 0 den = parser_state.next_den @@ -405,7 +414,7 @@ def parse_duration (str, parser_state): num = 1 if str[0] == '/': - while str[0] == '/': + while str[:1] == '/': str= str[1:] d = 2 if str[0] in DIGITS: @@ -413,6 +422,8 @@ def parse_duration (str, parser_state): den = den * d + den = den * default_len + current_dots = parser_state.next_dots parser_state.next_dots = 0 while str[0] == '>': @@ -424,7 +435,17 @@ def parse_duration (str, parser_state): str = str [1:] den = den * 2 parser_state.next_dots = parser_state.next_dots + 1 - + + + + 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 return (str, num,den,current_dots) @@ -442,16 +463,20 @@ def try_parse_rest (str, parser_state): def try_parse_articulation (str, state): - if str and str[0] == '.': + if str[:1] =='.': state.next_articulation = state.next_articulation + '-.' str = str[1:] + + if str[:1] =='~': + state.next_articulation = state.next_articulation + '-\\trill' + str = str[1:] # s7m2 input doesnt care about spaces if re.match('[ \t]*\(', str): str = string.lstrip (str) slur_begin =0 - while str and str[0] == '(' and str[1] not in DIGITS: + while str[:1] =='(' and str[1] not in DIGITS: slur_begin = slur_begin + 1 state.next_articulation = state.next_articulation + '(' str = str[1:] @@ -505,7 +530,7 @@ def try_parse_note (str, parser_state): str = string.lstrip (str) slur_end =0 - while str and str[0] == ')': + while str[:1] ==')': slur_end = slur_end + 1 str = str[1:] @@ -535,7 +560,7 @@ def junk_space (str): def try_parse_guitar_chord (str, state): - if str and str[0] == '"': + if str[:1] =='"': str = str[1:] gc = '' while str and str[0] != '"': @@ -553,7 +578,7 @@ def try_parse_escape (str): return str str = str[1:] - if str and str[0] == 'K': + if str[:1] =='K': key_table = compute_key () return str @@ -565,75 +590,67 @@ def try_parse_escape (str): # :| left repeat # |: right repeat # :: left-right repeat -# +# |1 volta 1 +# |2 volta 2 +bar_dict = { +'|]' : '|.', +'||' : '||', +'[|' : '||', +':|' : ':|', +'|:' : '|:', +'::' : '::', +'|1' : '|', +'|2' : '|', +':|2' : ':|' +} + + +warn_about = ['|:', '::', ':|', '|1', ':|2', '|2'] def try_parse_bar (str,state): - if str and str[0] == '|': + bs = None + + # first try the longer one + for trylen in [3,2]: + if str[:trylen] and bar_dict.has_key (str[:trylen]): + s = str[:trylen] + bs = "\\bar \"%s\";" % bar_dict[s] + if s in warn_about: + sys.stderr.write('Warning kludging for barline `%s\'\n' % s) + str = str[trylen:] + break - if state.parsing_tuplet: - state.parsing_tuplet =0 - voices_append ('} ') - - bs = '' + if str[:1] == '|': + bs = '|\n' str = str[1:] - if str: - if str[0] == ']': - bs = '|.' - if str[0] == '|': - bs = '||' - if str[0] == '|:': - sys.stderr.write ("warning: repeat kludge\n") - bs = '|:' - if bs: - voices_append ('\\bar "%s";' % bs) - str = str[1:] - - if str and str[:2] == '[|': - if state.parsing_tuplet: - state.parsing_tuplet =0 - voices_append ('} ') - sys.stderr.write ("warning: thick-thin bar kludge\n") - voices_append ('\\bar "||";') - str = str[2:] - - if str and str[:2] == ':|': + + if bs <> None: if state.parsing_tuplet: state.parsing_tuplet =0 voices_append ('} ') - sys.stderr.write ("warning: repeat kludge\n") - voices_append ('\\bar ":|:";') - str = str[2:] - - if str and str[:2] == '::': - if state.parsing_tuplet: - state.parsing_tuplet =0 - voices_append ('} ') - - sys.stderr.write ("warning: repeat kludge\n") - voices_append ('\\bar ":|:";') - str = str[2:] + voices_append (bs) return str - + def try_parse_tie (str): - if str and str[0] == '-': + if str[:1] =='-': str = str[1:] voices_append (' ~ ') return str def try_parse_chord_delims (str): - if str and str[0] == '[': + if str[:1] =='[': str = str[1:] voices_append ('<') ch = '' - if str and str[0] == ']': + if str[:1] ==']': str = str[1:] ch = '>' end = 0 - while str and str[0] == ')': + while str[:1] ==')': end = end + 1 str = str[1:] @@ -643,11 +660,11 @@ def try_parse_chord_delims (str): return str def try_parse_grace_delims (str): - if str and str[0] == '{': + if str[:1] =='{': str = str[1:] voices_append ('\\grace { ') - if str and str[0] == '}': + if str[:1] =='}': str = str[1:] voices_append ('}') @@ -737,6 +754,7 @@ for opt in options: raise getopt.error +header['tagline'] = 'Lily was here %s -- Directly converted from ABC' % version for f in files: if f == '-': f = '' @@ -750,7 +768,7 @@ for f in files: outf = sys.stdout - dump_global (outf) +# dump_global (outf) dump_lyrics (outf) dump_voices (outf) dump_score (outf) diff --git a/scripts/convert-mudela.py b/scripts/convert-mudela.py index 97bd9af2c8..5a71a79c09 100644 --- a/scripts/convert-mudela.py +++ b/scripts/convert-mudela.py @@ -389,7 +389,7 @@ if 1: def conv(lines): newlines =[] for x in lines: - x = re.sub ('\\repeat +\"?semi\"?','\\repeat "volta"', x) + x = re.sub ('\\repeat *\"?semi\"?','\\repeat "volta"', x) newlines.append (x) return newlines @@ -397,6 +397,18 @@ if 1: 'semi -> volta') +if 1: + def conv(lines): + newlines =[] + for x in lines: + x = re.sub ('\"?beamAuto\"? *= *\"?0?\"?','noAutoBeaming = "1"', x) + newlines.append (x) + return newlines + + conversions.append ((1,1,67), conv, + 'beamAuto -> noAutoBeaming') + + ############################ diff --git a/scripts/mup2ly.py b/scripts/mup2ly.py index c9eb62d4b5..c1349377c5 100644 --- a/scripts/mup2ly.py +++ b/scripts/mup2ly.py @@ -8,7 +8,7 @@ # TODO: regex -> re. -name = 'mup-to-ly' +name = 'mup2ly' version = '0.1' import os diff --git a/tex/mudela-book.tex b/tex/mudela-book.tex index 2b13cf5be4..7350eb5d40 100644 --- a/tex/mudela-book.tex +++ b/tex/mudela-book.tex @@ -32,4 +32,4 @@ %\def\musixsixteendefs{} \def\nolilyfooter{} %urg: missing \begin{document}? -\def\noindent{} +%0ef\noindent{} -- 2.39.2