User:Crantila/FSC/Typesetting/LilyPond Counterpoint

Working on a Counterpoint Exercise
Scenario: You're in Counterpoint class, and you've been asked to submit a very clean copy of your next assignment. Since you don't want to pay $450,000 for a commercially-available engraving solution and a fruity computer to use it, you decide that LilyPond is the solution for you.

Set Up the Score

 * 1) Open Frescobaldi into a blank document
 * 2) Use the 'LilyPond > Setup New Score' dialogue
 * 3) Set the title and composer (and any other field) on the 'Titles and Headers' tab
 * 4) You need a two staves, so you go to 'Parts' then 'Keyboard' then 'Piano'
 * 5) You need to label the intervals between the notes, so you choose 'Special' then 'Figured Bass' (we'll put it in the right spot later
 * 6) You go to the 'Score settings' tab
 * 7) since you've already played through this example, uncheck "Create MIDI output" and save processing time
 * 8) your example is in F Major
 * 9) You want only whole notes, with no barlines; choose a 4/4 time signature, since we'll change this later
 * 10) Press 'Try' to get a preview of the score setup - the notes are demonstrative and will not be there
 * 11) If the setup looks like you want it, then press 'OK' to generate the template

Inputting the Parts

 * 1) Look over the template.  It's not important to understand what any of this means, but it's good if you can figure it out.
 * 2) The piano's upper staff will contain the notes between the { and } following the " right = \relative c'' " portion
 * 3) The piano's lower ... left
 * 4) The figured bass will say what you put in figBass
 * 5) start with the piano's upper part.  Input "f1 g a f d e f c a f g f" (explain)
 * 6) Check that it's right.  Preview by press the "LilyPond" button on the toolbar
 * 7) The exercise starts too high, and it ends too low.  Change the starting pitch by " right = \relative c' "
 * 8) Preview again; of course, it still ends too low (these simple exercises usually start and end on the same pitch).
 * 9) Put a ' right after the c so that it goes to the upper C
 * 10) Preview again, and this time it's right.
 * 11) Now, enter the notes that you've written for the piano's lower staff: "f1 e d c bes c bes f d bes e f"
 * 12) Preview the output again, and see that it starts too high, but ends on the right pitch.
 * 13) Fix the start-too-high by changing to " left = \relative c { "
 * 14) Preview again, and decide where to fix the other change (NB: I end up with "f1 e d c bes c bes f' d bes e f"
 * 15) Enter the interval number between the top and bottom between the { and } preceded by " figBass = \figuremode "
 * 16) You have to put each interval between < > brackets.  The note-length of the figure's duration goes after the >, so I end up with "<1>1 <3> <5> <4> <3> <3> <5> <5> <5> <5> <3> <1>"
 * 17) Now you realize that there are some signficant errors in your work.  The top staff is the cantus, and cannot change.  You have to correct the lower staff.
 * 18) I've ended up with a lower part that is "f1 e d a bes c d e f d c f", which gives figures that are "<1>1 <3> <5> <6> <3> <3> <3> <6> <3> <3> <5> <1>"

Formatting the Score
I do this last, so that my primary focus is the note-wise content, and formatting is only a secondary concern. LilyPond is particularly good at handling this sort of outlook.

Move the Figured Bass
Normally, figured bass parts are below the staves. This example is using the figured-bass feature of LilyPond to do something else, so we're going to move the figured bass so that it's where it needs to be.
 * 1) the \score{ } section contains everything in the score; notice that the figured bass has the identifier \bassFiguresPart; remove this
 * 2) scroll up to where it says "bassFiguresPart = ... " and comment it with %
 * 3) scroll up to where it says "pianoPart = ... " and enter the "\new FiguredBass \figBass" line that you just commented out, on a line between the "right" and "left" staves
 * 4) now erase the part that you commented in (2) (or leave it there)
 * 5) Preview the file, and see that the figures now appear between the piano staves

Take away the word "Piano" at the start of the staves

 * 1) Find the part that begins "pianoPart = ... " and erase the "instrumentName ... " line (or comment it)
 * 2) Preview the file, and see that it no longer says, "Piano"

Make Some Elements Transparent
This involves some more advanced tweaking. Explain this sort of command.

Every layout object has a "stencil" property. By default, this is set to whatever function draws the object. If you set that property to #f, which means "false", then the drawing function is not called, and the object will not appear on the score.

Every layout object also has a "transparent" property. By default, this is set to #f ("false"). Setting it to #t ("true") will make the object transparent.

You can use "\once \override ..." or \revert ..." too


 * 1) Find the "global" section
 * 2) After \key and \time, put " \override Score.BarLine #'stencil = ##f "
 * 3) Preview the file, and see that this doesn't work quite as intended.
 * 4) It so happens that, while measure lines within a staff are handled by Staff.BarLine, measure lines between staves are handled by Staff.SpanBar; so you'll need to set its 'transparent symbol to #t also
 * 5) But there's still no measure-line at the end! You want a barline at the end, so pick one of the staves (right, left, figBass - it doesn't matter in this case) and use the \revert command (don't know if I should put this in, but: "\revert Score.BarLine #'transparent and \revert Score.SpanBar #'transparent")
 * 6) But even this isn't quite right.  You want a double-barline at the end.  So, put the cursor after the \revert lines, and then from the menu, 'LilyPond > Bar Lines > Ending Bar Line' .  It knows what you want, remembers the symbol for you, so you don't have to!


 * explain in there the difference between a Staff.* and Score.* override
 * Unlike with some other elements, if you simply remove the "\time 4/4" indicator, it will still print the default 4/4 time signature.
 * This example is musically simple, but it includes some advanced concepts, and importantly helps to get over a couple of common (and understandable) fears, especially for beginners, and especially for musically-simple things like this