lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lilypond syntax


From: David Rogers
Subject: Re: Lilypond syntax
Date: Sun, 29 Jul 2012 02:33:29 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

Tim McNamara <address@hidden> writes:

Some weeks back there was some discussion of the Lilypond syntax, I made some suggestions and was asked to write up a sample .ly file with the ideas I had in mind. Basically my notion was to separate content (notes and chords) from form (number of bars, repeats, codas, rehearsal marks, etc.) in how things are coded into .ly files. I've been playing around with that some and here is a sample .ly file with some of those ideas. They may be terrible ideas, they may be impractical, they might require a total rewrite of Lilypond to implement, etc. I think like a musician, not a programmer, after all. To me the form is the container of the music and it makes sense to specify the form first and then place the music within it. Others may see this very differently. The file is four bars of "Interplay" by Bill Evans with four parts.


Hi Tim

Thanks for doing this work.

I think I like some of the concepts you have here - just some added questions and ideas.



\version "2.17.1" \paper { #(set-paper-size "letter") indent = 0.0 ragged-last = ##f } \header { title = "Interplay" subtitle = "" composer = "Bill Evans" meter = "Medium Blues" copyright = "Copyright TRO 1963, 1956 Folkways Music Publishers, Inc" } % The idea is to separate musical content from the structure of the form of % the song, thinking of the structure as a container for the music expressions. % This is the first four bars of "Interplay" by Bill Evans \form { \number-of-bars = 4 % should barchecking be the default behavior? \bars-per-line = 4 % default would be to let Lilypond calculate this \StaffGroup { \number-of-voices = 5 { % voices rendered in numeric order \Voice.1 = "harmony" \Voice.2 = "trumpet" \set Staff.instrumentName = #"T" \Voice.3 = "alto" \set Staff.instrumentName = #"A" \Voice.4 = "guitar" \set Staff.instrumentName = #"G" \Voice.5 = "bass" \set Staff.instrumentName = #"B" } \print-full-score = ##t \print-separate-scores = ##f } \time 4/4

What about situations where different voices have different time signatures? It's not seen every day, but even Bach did it.

\bar "|:" = 1 \bar ":|" = 4 }


My main comment here is about the notation of repeats. Instead of the users dictating which signs to print, I think it would make more sense for us to dictate which sections of the music to repeat and how many times, and let Lilypond fill in the appropriate signs in the appropriate places. Composers can sometimes be neglectful regarding which sign ought to go where. However, they don't usually forget if it's the verse or the chorus that needs repeating. :) This is the same logic by which we type e'2 instead of typing "treble clef 4th space white-in-the-middle-with-a-stem" - Lilypond's usual "expectation" is for the user to provide the musical meaning, and for Lilypond to provide the signs. (I would even go further on my little "logic kick", and replace \bar "|." with \endPiece, \bar "|:" with \beginRepeat (or with \beginRepeat542x if playing multiple times), replace \bar "||" with \endSection, and so on.)




Here's a fake syntax for nested repeat, and nested repeat with 1st and 2nd endings; my default is to not repeat more than once, but the 4x tacked onto one command means play four times. The NestedZero and NestedOne are showing how many levels of repeats deep we currently are, so that the nesting doesn't get mixed up. When writing short simple pieces this would be easy enough for a person to keep track of - but in something with a lot of pages and/or a more complicated structure, maybe the user would get mixed up about which level of nesting they're at - so maybe this little idea is no good anyway. (Note: I guess NestedZero should be a default, just to save typing.)

___________________________________________________


a4 a a a e'1 f4 f e d e1 \beginRepeatedSectionNestedZero a4 c b2 c4 d e2 \beginRepeatedSectionNestedOne4x e2 d c1 \endRepeatedSectionNestedOne a4 a e'2 f4 e d2 c1 b a \endRepeatedSectionNestedZero

a4 a a a e'1 f4 f e d e1 \beginRepeatedSectionNestedZero a4 c b2 c4 d e2 \beginRepeatedSectionNestedOne4x e2 d c1 \endRepeatedSectionNestedOne a4 a e'2 f4 e d2 c1 b \1stEndingNestedZero e1 \2ndEndingNestedZero a1 \endRepeatedSectionNestedZero e'1 e a~a \endPiece
___________________________________________________


In general, I think it's looking like pretty hard work finding enough things to abstract out of the music and put into a \form block.

How often is a pre-printed form for a particular piece superior, for the pencil-pushing composer, to some blank staff paper? I can see convenience in keeping blank scores for some strictly limited forms, such as 12-bar blues - but who really needs a template for 12-bar blues? [answering my own question - perhaps a student who's learning it]. And at the other end of the size spectrum, on a symphony or opera or something, who would go to the work of making a fill-in template for something that's probably going to have a unique form, and is likely to be subject to the composer's changing his mind anyway?



harmony = \chordmode { % 1 f1:min6 bes1:min6 f1:min6 f1:7.5+.9- } trumpet = \transpose bes c' \relative c' { \clef treble \key aes \major % 1 f4. c'8 r8 aes4\staccato f8 bes8 c8~ \times 2/3 { c8 g8 ees8 } f4 r8 aes8 g8 f8 bes8 aes8 des8 c8 aes8 f8 des8 f8 \times 2/3 { g8 ees8 f8 } r4 f'4~\accent } alto = \transpose ees c' \relative c' { \clef treble \key aes \major % 1 f4. c'8 r8 aes4\staccato f8 bes8 c8~ \times 2/3 { c8 g8 ees8 } f4 r8 aes8 g8 f8 bes8 aes8 des8 c8 aes8 f8 des8 f8 \times 2/3 { g8 ees8 f8 } r4 f'4~\accent } guitar = \relative c' { \clef treble \key aes \major % 1 aes'2 bes2 c2 des2 ees4 des4 c4 bes4 aes4 ges4 f4 ees4 } Bass = \relative c' { \clef bass \key aes \major % 1 f,2 ges2 aes2 bes2 c4 bes4 aes4 ges4 f4 ees4 des4 c4 } % The \score block is understood from the \form block rather than invoked specifically; % I suppose that I am really renaming the \score block and using it differently. % The form could be printed without any musical content being specified, for users % wishing to print the form, write music in by hand and then enter into Lilypond. % I am not sure about the best way to do \repeat volta however- it seems like it should % be in the \form block but that may be even harder to do from the naive user viewpoint % than the way it is currently done. Part of the problem is that I don't understand % how \repeat is dealt with in \midi, since I have never used it. % By default \bar "|:" would be placed at the beginning of the bar specified and % \bar ":|" would go at the end of the bar specified, as would \bar "||" \bar ":|:" % and \bar "|." Also \bar "|||" could be specified, it would place a \bar "||" at % the end of that line and the start of the next line.

The :| and |: are often needed in the middle of a bar. Not sure how that would work... and not convinced that a lot of people would use the feature of printing the form of a piece with no notes, just because I don't see how much value it provides over blank staff paper, compared to how much work the template takes to make.


% It seems like Lilypond should be able to be smart enough to understand that something % like c1^"D.C. al Coda" is a written text instruction without needing \markup; % likewise \mark \markup seems inelegant and even redundant.

In a way, I agree with you. But mainly I think this should be a command instead of a markup - that a D.C. should be part of the logic of Lilypond's repeat system and that the user should be supplying the musical plan rather than the string of text to print.

So I would create:
c1 \dacapoalfine

or:

c1 \dalsegnoalfine

both of which would require a \fine

and one of which would require a
\segno

inserted after some other notes somewhere in the piece, or else fail with an error - but which would handle all the repeat signs and markups automatically.


Same type of thing for \coda, obviously.


% Not sure what to do with \midi, putting it in the \form block isn't perfectly % logical. It should probably go at the end.

What about changing the beginning of the file, like this:

[this is fake syntax]
\outputs {
        \paper { ...

        }

        \midi { ...

        }
}


Though I guess an \outputs block is superfluous and one could just put the 
paper and midi one after the other without adding useless words.

% Not sure how to handle printing scores for each voice in their own PDF files; 
also
% \print = "create PDF file" since printing to paper is handled outside of 
Lilypond.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]