<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!-- header_tag --> <html lang="en"> <head> <title>Templates - LilyPond snippets</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="description" content="LilyPond snippets"> <meta name="generator" content="makeinfo 4.11"> <link title="Top" rel="start" href="index.html#Top"> <link rel="prev" href="MIDI.html#MIDI" title="MIDI"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } hr { border:0; height:1; color: #000000; background-color: #000000; } /* hr { border: none; height: 1px; color: #666666; background-color: #666666; } body { border-left: 1px solid #666666; border-right: 1px solid #666666; color: #332d28; margin-right: auto; margin-left: auto; width: 60em; list-style-type: square; font-family: Arial,Helvetica,sans-serif; padding-right: 1em; padding-left: 1em; } a { border-bottom: 1px dashed #344242; text-decoration: none; color: #344242; } a:link { text-decoration: none; } a:visited { border-bottom: 1px dashed #666666; color: #666666; } a:active { border-bottom: 1px solid #00cccc; color: #00cccc; } a:hover { border-bottom: 1px solid #1d7b85; color: #1d7b85; } blockquote { border: 1px solid #cccccc; padding: 3px; width: 40em; } .node { border-left: 1px solid #666666; margin: -0.5em 0px 1em; padding: 2px 1px 0px; font-style: italic; } .node a { border: none; text-decoration: underline; font-style: normal; font-weight: bold; } .verbatim { font-family: "Courier New",Courier,monospace; } .unnumberedsubsubsec { font-size: large; color: #1d7b85; } .subsubheading { font-size: large; color: #3b220d; } .contents { border: 1px dashed #339999; margin: 3px 2em; list-style-type: square; padding-right: 1em; width: 40em; background-color: #fcfff9; } .contents a { border-bottom: 1px dashed #423d34; text-decoration: none; color: #423d34; } .contents a:visited { border-bottom: 1px dashed #666666; color: #666666; } .contents a:active { border-bottom: 1px solid #f0d86d; color: #f0d86d; } .contents a:hover { border-bottom: 1px solid #3b220d; color: #3b220d; } .menu { border-left: 1px dashed #339999; margin: 3px 2em 1em; list-style-type: square; padding-left: 1.4em; width: 40em; } .unnumbered { } h2 { font-size: x-large; color: #1d7b85; } */ --></style> </head> <BODY BGCOLOR=WHITE TEXT=BLACK> <div class="node"> <p> <a name="Templates"></a> Previous: <a rel="previous" accesskey="p" href="MIDI.html#MIDI">MIDI</a>, Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a> <hr> </div> <h2 class="unnumbered">Templates</h2> <p><a name="ancient-notation-template----modern-transcription-of-gregorian-music.ly"></a> <h3 class="unnumberedsec">Ancient notation template – modern transcription of gregorian music</h3> <p>This example demonstrates how to do modern transcription of Gregorian music. Gregorian music has no measure, no stems; it uses only half and quarter note heads, and special marks, indicating rests of different length. <pre class="verbatim"> \include "gregorian-init.ly" chant = \relative c' { \set Score.timing = ##f f4 a2 \divisioMinima g4 b a2 f2 \divisioMaior g4( f) f( g) a2 \finalis } verba = \lyricmode { Lo -- rem ip -- sum do -- lor sit a -- met } \score { \new Staff << \new Voice = "melody" \chant \new Lyrics = "one" \lyricsto melody \verba >> \layout { \context { \Staff \remove "Time_signature_engraver" \remove "Bar_engraver" \override Stem #'transparent = ##t } \context { \Voice \override Stem #'length = #0 } \context { \Score barAlways = ##t } } } </pre> <p> <a href="../92/lily-0f9ec382.ly"> <img align="middle" border="0" src="../92/lily-0f9ec382.png" alt="[image of music]"> </a> </p> <p><a name="ancient-notation-template----modern-transcription-of-mensural-music.ly"></a> <h3 class="unnumberedsec">Ancient notation template – modern transcription of mensural music</h3> <p>When transcribing mensural music, an incipit at the beginning of the piece is useful to indicate the original key and tempo. While today musicians are used to bar lines in order to faster recognize rhythmic patterns, bar lines were not yet invented during the period of mensural music; in fact, the meter often changed after every few notes. As a compromise, bar lines are often printed between the staves rather than on the staves. <pre class="verbatim"> global = { \set Score.skipBars = ##t % incipit \once \override Score.SystemStartBracket #'transparent = ##t \override Score.SpacingSpanner #'spacing-increment = #1.0 % tight spacing \key f \major \time 2/2 \once \override Staff.TimeSignature #'style = #'neomensural \override Voice.NoteHead #'style = #'neomensural \override Voice.Rest #'style = #'neomensural \set Staff.printKeyCancellation = ##f \cadenzaOn % turn off bar lines \skip 1*10 \once \override Staff.BarLine #'transparent = ##f \bar "||" \skip 1*1 % need this extra \skip such that clef change comes % after bar line \bar "" % main \revert Score.SpacingSpanner #'spacing-increment % CHECK: no effect? \cadenzaOff % turn bar lines on again \once \override Staff.Clef #'full-size-change = ##t \set Staff.forceClef = ##t \key g \major \time 4/4 \override Voice.NoteHead #'style = #'default \override Voice.Rest #'style = #'default % FIXME: setting printKeyCancellation back to #t must not % occur in the first bar after the incipit. Dto. for forceClef. % Therefore, we need an extra \skip. \skip 1*1 \set Staff.printKeyCancellation = ##t \set Staff.forceClef = ##f \skip 1*7 % the actual music % let finis bar go through all staves \override Staff.BarLine #'transparent = ##f % finis bar \bar "|." } discantusNotes = { \transpose c' c'' { \set Staff.instrumentName = #"Discantus " % incipit \clef "neomensural-c1" c'1. s2 % two bars \skip 1*8 % eight bars \skip 1*1 % one bar % main \clef "treble" d'2. d'4 | b e' d'2 | c'4 e'4.( d'8 c' b | a4) b a2 | b4.( c'8 d'4) c'4 | \once \override NoteHead #'transparent = ##t c'1 | b\breve | } } discantusLyrics = \lyricmode { % incipit IV- % main Ju -- bi -- | la -- te De -- | o, om -- nis ter -- | ra, __ om- | "..." | -us. | } altusNotes = { \transpose c' c'' { \set Staff.instrumentName = #"Altus " % incipit \clef "neomensural-c3" r1 % one bar f1. s2 % two bars \skip 1*7 % seven bars \skip 1*1 % one bar % main \clef "treble" r2 g2. e4 fis g | % two bars a2 g4 e | fis g4.( fis16 e fis4) | g1 | \once \override NoteHead #'transparent = ##t g1 | g\breve | } } altusLyrics = \lyricmode { % incipit IV- % main Ju -- bi -- la -- te | % two bars De -- o, om -- | nis ter -- ra, | "..." | -us. | } tenorNotes = { \transpose c' c' { \set Staff.instrumentName = #"Tenor " % incipit \clef "neomensural-c4" r\longa % four bars r\breve % two bars r1 % one bar c'1. s2 % two bars \skip 1*1 % one bar \skip 1*1 % one bar % main \clef "treble_8" R1 | R1 | R1 | r2 d'2. d'4 b e' | % two bars \once \override NoteHead #'transparent = ##t e'1 | d'\breve | } } tenorLyrics = \lyricmode { % incipit IV- % main Ju -- bi -- la -- te | % two bars "..." | -us. | } bassusNotes = { \transpose c' c' { \set Staff.instrumentName = #"Bassus " % incipit \clef "bass" r\maxima % eight bars f1. s2 % two bars \skip 1*1 % one bar % main \clef "bass" R1 | R1 | R1 | R1 | g2. e4 | \once \override NoteHead #'transparent = ##t e1 | g\breve | } } bassusLyrics = \lyricmode { % incipit IV- % main Ju -- bi- | "..." | -us. | } \score { \new StaffGroup = choirStaff << \new Voice = "discantusNotes" << \global \discantusNotes >> \new Lyrics = "discantusLyrics" \lyricsto discantusNotes { \discantusLyrics } \new Voice = "altusNotes" << \global \altusNotes >> \new Lyrics = "altusLyrics" \lyricsto altusNotes { \altusLyrics } \new Voice = "tenorNotes" << \global \tenorNotes >> \new Lyrics = "tenorLyrics" \lyricsto tenorNotes { \tenorLyrics } \new Voice = "bassusNotes" << \global \bassusNotes >> \new Lyrics = "bassusLyrics" \lyricsto bassusNotes { \bassusLyrics } >> \layout { \context { \Score % no bars in staves \override BarLine #'transparent = ##t % incipit should not start with a start delimiter \remove "System_start_delimiter_engraver" } \context { \Voice % no slurs \override Slur #'transparent = ##t % Comment in the below "\remove" command to allow line % breaking also at those barlines where a note overlaps % into the next bar. The command is commented out in this % short example score, but especially for large scores, you % will typically yield better line breaking and thus improve % overall spacing if you comment in the following command. %\remove "Forbid_line_break_engraver" } } } </pre> <p> <a href="../a9/lily-f99b5fb1.ly"> <img align="middle" border="0" src="../a9/lily-f99b5fb1.png" alt="[image of music]"> </a> </p> <p><a name="jazz-combo-template.ly"></a> <h3 class="unnumberedsec">Jazz combo template</h3> <p>This is quite an advanced template, for a jazz ensemble. Note that all instruments are notated in <code>\key c \major</code>. This refers to the key in concert pitch; the key will be automatically transposed if the music is within a <code>\transpose</code> section. <pre class="verbatim"> \header { title = "Song" subtitle = "(tune)" composer = "Me" meter = "moderato" piece = "Swing" tagline = \markup { \column { "LilyPond example file by Amelie Zapf," "Berlin 07/07/2003" } } } %#(set-global-staff-size 16) \include "english.ly" %%%%%%%%%%%% Some macros %%%%%%%%%%%%%%%%%%% sl = { \override NoteHead #'style = #'slash \override Stem #'transparent = ##t } nsl = { \revert NoteHead #'style \revert Stem #'transparent } crOn = \override NoteHead #'style = #'cross crOff = \revert NoteHead #'style %% insert chord name style stuff here. jazzChords = { } %%%%%%%%%%%% Keys'n'thangs %%%%%%%%%%%%%%%%% global = { \time 4/4 } Key = { \key c \major } % ############ Horns ############ % ------ Trumpet ------ trpt = \transpose c d \relative c'' { \Key c1 | c | c | } trpHarmony = \transpose c' d { \jazzChords } trumpet = { \global \set Staff.instrumentName = #"Trumpet" \clef treble << \trpt >> } % ------ Alto Saxophone ------ alto = \transpose c a \relative c' { \Key c1 | c | c | } altoHarmony = \transpose c' a { \jazzChords } altoSax = { \global \set Staff.instrumentName = #"Alto Sax" \clef treble << \alto >> } % ------ Baritone Saxophone ------ bari = \transpose c a' \relative c { \Key c1 c1 \sl d4^"Solo" d d d \nsl } bariHarmony = \transpose c' a \chordmode { \jazzChords s1 s d2:maj e:m7 } bariSax = { \global \set Staff.instrumentName = #"Bari Sax" \clef treble << \bari >> } % ------ Trombone ------ tbone = \relative c { \Key c1 | c | c } tboneHarmony = \chordmode { \jazzChords } trombone = { \global \set Staff.instrumentName = #"Trombone" \clef bass << \tbone >> } % ############ Rhythm Section ############# % ------ Guitar ------ gtr = \relative c'' { \Key c1 \sl b4 b b b \nsl c1 } gtrHarmony = \chordmode { \jazzChords s1 c2:min7+ d2:maj9 } guitar = { \global \set Staff.instrumentName = #"Guitar" \clef treble << \gtr >> } %% ------ Piano ------ rhUpper = \relative c'' { \voiceOne \Key c1 | c | c } rhLower = \relative c' { \voiceTwo \Key e1 | e | e } lhUpper = \relative c' { \voiceOne \Key g1 | g | g } lhLower = \relative c { \voiceTwo \Key c1 | c | c } PianoRH = { \clef treble \global \set Staff.midiInstrument = #"acoustic grand" << \new Voice = "one" \rhUpper \new Voice = "two" \rhLower >> } PianoLH = { \clef bass \global \set Staff.midiInstrument = "acoustic grand" << \new Voice = "one" \lhUpper \new Voice = "two" \lhLower >> } piano = { << \set PianoStaff.instrumentName = #"Piano" \new Staff = "upper" \PianoRH \new Staff = "lower" \PianoLH >> } % ------ Bass Guitar ------ Bass = \relative c { \Key c1 | c | c } bass = { \global \set Staff.instrumentName = #"Bass" \clef bass << \Bass >> } % ------ Drums ------ up = \drummode { \voiceOne hh4 <hh sn> hh <hh sn> hh4 <hh sn> hh <hh sn> hh4 <hh sn> hh <hh sn> } down = \drummode { \voiceTwo bd4 s bd s bd4 s bd s bd4 s bd s } drumContents = { \global << \set DrumStaff.instrumentName = #"Drums" \new DrumVoice \up \new DrumVoice \down >> } %%%%%%%%% It All Goes Together Here %%%%%%%%%%%%%%%%%%%%%% \score { << \new StaffGroup = "horns" << \new Staff = "trumpet" \trumpet \new Staff = "altosax" \altoSax \new ChordNames = "barichords" \bariHarmony \new Staff = "barisax" \bariSax \new Staff = "trombone" \trombone >> \new StaffGroup = "rhythm" << \new ChordNames = "chords" \gtrHarmony \new Staff = "guitar" \guitar \new PianoStaff = "piano" \piano \new Staff = "bass" \bass \new DrumStaff \drumContents >> >> \layout { \context { \RemoveEmptyStaffContext } \context { \Score \override BarNumber #'padding = #3 \override RehearsalMark #'padding = #2 skipBars = ##t } } \midi { } } </pre> <p> <a href="../ea/lily-36b7ad93.ly"> <img align="middle" border="0" src="../ea/lily-36b7ad93.png" alt="[image of music]"> </a> </p> <p><a name="piano-template-simple.ly"></a> <h3 class="unnumberedsec">Piano template (simple)</h3> <p>Here is a simple piano staff with some notes. <pre class="verbatim"> upper = \relative c'' { \clef treble \key c \major \time 4/4 a4 b c d } lower = \relative c { \clef bass \key c \major \time 4/4 a2 c } \score { \new PianoStaff << \set PianoStaff.instrumentName = #"Piano " \new Staff = "upper" \upper \new Staff = "lower" \lower >> \layout { } \midi { } } </pre> <p> <a href="../33/lily-72cc9456.ly"> <img align="middle" border="0" src="../33/lily-72cc9456.png" alt="[image of music]"> </a> </p> <p><a name="piano-template-with-centered-dynamics.ly"></a> <h3 class="unnumberedsec">Piano template with centered dynamics</h3> <p>Many piano scores have the dynamics centered between the two staves. This requires a bit of tweaking to implement, but since the template is right here, you don't have to do the tweaking yourself. <pre class="verbatim"> upper = \relative c'' { \clef treble \key c \major \time 4/4 a4 b c d } lower = \relative c { \clef bass \key c \major \time 4/4 a2 c } dynamics = { s2\fff\> s4 s\!\pp } pedal = { s2\sustainOn s\sustainOff } \score { \new PianoStaff << \new Staff = "upper" \upper \new Dynamics = "dynamics" \dynamics \new Staff = "lower" << \clef bass \lower >> \new Dynamics = "pedal" \pedal >> \layout { \context { \type "Engraver_group" \name Dynamics % So that \cresc works, for example. \alias Voice \consists "Output_property_engraver" \override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 1) \override DynamicLineSpanner #'Y-offset = #0 pedalSustainStrings = #'("Ped." "*Ped." "*") pedalUnaCordaStrings = #'("una corda" "" "tre corde") \consists "Piano_pedal_engraver" \consists "Script_engraver" \consists "Dynamic_engraver" \consists "Text_engraver" \override TextScript #'font-size = #2 \override TextScript #'font-shape = #'italic \consists "Skip_event_swallow_translator" \consists "Axis_group_engraver" } \context { \PianoStaff \accepts Dynamics } } } \score { \new PianoStaff << \new Staff = "upper" << \upper \dynamics \pedal >> \new Staff = "lower" << \lower \dynamics \pedal >> >> \midi { } } </pre> <p> <a href="../81/lily-165c7953.ly"> <img align="middle" border="0" src="../81/lily-165c7953.png" alt="[image of music]"> </a> </p> <p><a name="piano-template-with-centered-lyrics.ly"></a> <h3 class="unnumberedsec">Piano template with centered lyrics</h3> <p>Instead of having a full staff for the melody and lyrics, lyrics can be centered between the staves of a piano staff. <pre class="verbatim"> upper = \relative c'' { \clef treble \key c \major \time 4/4 a4 b c d } lower = \relative c { \clef bass \key c \major \time 4/4 a2 c } text = \lyricmode { Aaa Bee Cee Dee } \score { \new GrandStaff << \new Staff = upper { \new Voice = "singer" \upper } \new Lyrics \lyricsto "singer" \text \new Staff = lower { \lower } >> \layout { \context { \GrandStaff \accepts "Lyrics" } \context { \Lyrics \consists "Bar_engraver" } } \midi { } } </pre> <p> <a href="../37/lily-c18abd8d.ly"> <img align="middle" border="0" src="../37/lily-c18abd8d.png" alt="[image of music]"> </a> </p> <p><a name="piano-template-with-melody-and-lyrics.ly"></a> <h3 class="unnumberedsec">Piano template with melody and lyrics</h3> <p>Here is a typical song format: one staff with the melody and lyrics, with piano accompaniment underneath. <pre class="verbatim"> melody = \relative c'' { \clef treble \key c \major \time 4/4 a b c d } text = \lyricmode { Aaa Bee Cee Dee } upper = \relative c'' { \clef treble \key c \major \time 4/4 a4 b c d } lower = \relative c { \clef bass \key c \major \time 4/4 a2 c } \score { << \new Voice = "mel" { \autoBeamOff \melody } \new Lyrics \lyricsto mel \text \new PianoStaff << \new Staff = "upper" \upper \new Staff = "lower" \lower >> >> \layout { \context { \RemoveEmptyStaffContext } } \midi { } } </pre> <p> <a href="../68/lily-e6876100.ly"> <img align="middle" border="0" src="../68/lily-e6876100.png" alt="[image of music]"> </a> </p> <p><a name="score-for-diatonic-accordion.ly"></a> <h3 class="unnumberedsec">Score for diatonic accordion</h3> <p>A template to write a score for a diatonic accordion. <p>- There is a horizontal staff indicating if the accordion must be pushed (thick line) or pulled (thin line) <p>- There is a small rhythmic staff with lyrics that describes the bass buttons to press. The bar lines are made from gridlines <p>- The tabulator staff for diatonic accordions shows the geographic position of the buttons and not (as for every other instrument) the pitch of the notes; the keys on the melody-side of the accordion are placed in three columns and about 12 rows <p>In the tabulator staff notation the outermost column is described with notes between lines, the innermost column is described with notes between lines and a cross as accidental, and the middle column is described with notes on a line, whereby the row in the middle is represented on the middle line in the staff. <p>Some words to transpose piano notes to the diatonic accordion: <p>1. Every diatonic accordion is built for some keys only (for example, for the keys of C major and F major), so it is important to transpose a piano melody to match one of these keys. Transpose the source code, not only the output because this code is required later on to translate it once more to the tabulator staff. This can be done with the command <code>displayLilyMusic</code>. <p>2. You have to alternate the push- and pull-direction of the accordion regularly. If the player has a too long part to pull the accordion gets broken. On the other hand, some harmonies are only available in one direction. Considering this, decide which parts of the melody are the push-parts and which the pull-parts. <p>3. For each pull- or push-part translate the piano notes to the according tabulature representation. <p>This snippet comes with a useful optional macro for the jEdit text editor. <pre class="verbatim"> verse = \lyricmode { Wie gross bist du! Wie gross bist du! } harmonies = \new ChordNames \chordmode { \germanChords \set chordChanges = ##t bes8 bes8 bes8 es2 f bes1 } NoStem = \override Stem #'transparent = ##t NoNoteHead = \override NoteHead #'transparent = ##t ZeroBeam = \override Beam #'positions = #'(0 . 0) staffTabLine = \new Staff \with { \remove "Time_signature_engraver" \remove "Clef_engraver" } { \override Staff.StaffSymbol #'line-positions = #'(0) % Shows one horizontal line. The vertical line (simulating a bar-line) is simulated with a gridline \set Staff.midiInstrument = #"choir aahs" \key c \major \relative c'' { % disable the following line to see the the noteheads while writing the song \NoNoteHead \override NoteHead #'no-ledgers = ##t % The beam between 8th-notes is used to draw the push-line %How to fast write the push-lines: % 1. write repeatedly 'c c c c c c c c |' for the whole length of the song % 2. uncomment the line \NoNoteHead % 3. compile % 4. Mark the positions on which push/pull changes. % In the score-picture click on the position the push- or pull-part starts % (on the noteHead, the cursor will change to a hand-icon). % The cursor in the source code will jump just at this position. % a) If a push-part starts there, replace the 'c' by an 'e[' % b) If a pull-part starts there, replace the 'c' by an 's' % 5. Switch into 'overwrite-mode' by pressing the 'ins' key. % 6. For the pull-parts overwrite the 'c' with 's' % 7. For every push-part replace the last 'c' with 'e]' % 8. Switch into 'insert-mode' again % 9. At last it should look lik e.g. (s s e[ c | c c c c c c c c | c c c c c c e] s s) % 10. re-enable the line \NoNoteHead \autoBeamOff \ZeroBeam s8 s s e[ c c c c c c e] | s s s s s } } %{ %} % Accordion melody in tabulator score % 1. Place a copy of the piano melody below % 2. Separate piano melody into pull- and push-parts according to the staffTabLine you've already made % 3. For each line: Double the line. Remark the 1st one (Keeps unchanged as reference) and then change the second line using the transformation paper % or the macros 'conv2diaton push.bsh' and 'conv2diaton pull.bsh' % Tips: % - In jEdit Search & Replace mark the Option 'Keep Dialog' AccordionTabTwoCBesDur = { % pull 1 %<f' bes'>8 <f' a'>8 <d' bes'>8 | <g'' a''>8 <g'' b''>8 <e'' a''>8 | % push 2 %<g' c''>4 <f' d''> <g' ees''> <f' a'> | <g'' a''>4 <d'' eisis''> <g'' bisis''> <d'' f''> | % pull 3 % <f' bes'>2 r8 } <g'' a''>2 r8 } AccordionTab= { \dynamicUp % 1. Place a copy of the piano melody above % 2. Separate piano melody into pull- and push-parts according to the staffTabLine you've already made % 3. For each line: Double the line. Remark the 1st one (Keeps unchanged as reference) and then % change the second line using the transformation paper % Tips: % - In jEdit Search & Replace mark the Option 'Keep Dialog' % - \AccordionTabTwoCBesDur } \layout { \context { \Staff \consists "Grid_point_engraver" gridInterval = #(ly:make-moment 4 4) % 4/4 - tact. How many beats per bar % The following line has to be adjusted O-F-T-E-N. \override GridPoint #'Y-extent = #'(-2 . -21) } \context { \ChoirStaff \remove "System_start_delimiter_engraver" } } staffVoice = \new Staff=astaffvoice { \time 4/4 \set Staff.instrumentName="Voice" \set Staff.midiInstrument="voice oohs" \key bes \major \partial 8*3 \clef treble { \context Voice = "melodyVoi" { <f' bes'>8 <f' a'>8 <d' bes'>8 | <g' c''>4 <f' d''> <g' es''> <f' a'> | <f' bes'>2 r8 } \bar "|." } } staffAccordionMel = \new Staff \with { \remove "Clef_engraver" } { #(set-accidental-style 'forget) %Set the accidentals (Vorzeichen) for each note, %do not remember them for the rest of the measure. \time 4/4 \set Staff.instrumentName="Accordion" \set Staff.midiInstrument="voice oohs" \key c \major \clef treble { \AccordionTab \bar "|." } } AltOn = #(define-music-function (parser location mag) (number?) #{ \override Stem #'length = #$(* 7.0 mag) \override NoteHead #'font-size = #$(inexact->exact (* (/ 6.0 (log 2.0)) (log mag))) #}) AltOff = { \revert Stem #'length \revert NoteHead #'font-size } BassRhytm = {s4 s8 | c2 c2 | c2 s8 } LyricBassRhythmI= \lyricmode { c b | c } staffBassRhytm = \new Staff=staffbass \with { \remove "Clef_engraver" } { % This is not a RhythmicStaff because it must be possible to append lyrics. \override Score.GridLine #'extra-offset = #'( 13.0 . 0.0 ) % x.y \override Staff.StaffSymbol #'line-positions = #'( 0 ) % Shows one horizontal line. The vertical line (simulating a bar-line) is simulated by a grid % Search for 'grid' in this page to find all related functions \time 4/4 { \context Voice = "VoiceBassRhytm" \stemDown \AltOn #0.6 \relative c'' { \BassRhytm } \AltOff \bar "|." } } \new Score \with { \consists "Grid_line_span_engraver" %The vertical line (simulating a bar-line) in the staffBassRhytm is a gridline } \new ChoirStaff << \harmonies \staffVoice \context Lyrics = "lmelodyVoi" \with {alignBelowContext=astaffvoice} { \lyricsto "melodyVoi" \verse } \staffAccordionMel \staffTabLine \staffBassRhytm \context Lyrics = "lBassRhytmAboveI" \with {alignAboveContext=staffbass} \lyricsto VoiceBassRhytm \LyricBassRhythmI >> %} </pre> <p> <a href="../4b/lily-02698a8a.ly"> <img align="middle" border="0" src="../4b/lily-02698a8a.png" alt="[image of music]"> </a> </p> <p><a name="single-staff-template-with-notes,-lyrics,-and-chords.ly"></a> <h3 class="unnumberedsec">Single staff template with notes, lyrics, and chords</h3> <p>This template allows the preparation of a song with melody, words, and chords. <pre class="verbatim"> melody = \relative c' { \clef treble \key c \major \time 4/4 a4 b c d } text = \lyricmode { Aaa Bee Cee Dee } harmonies = \chordmode { a2 c } \score { << \new ChordNames { \set chordChanges = ##t \harmonies } \new Voice = "one" { \autoBeamOff \melody } \new Lyrics \lyricsto "one" \text >> \layout { } \midi { } } </pre> <p> <a href="../2c/lily-39f4b2ad.ly"> <img align="middle" border="0" src="../2c/lily-39f4b2ad.png" alt="[image of music]"> </a> </p> <p><a name="single-staff-template-with-notes,-lyrics,-chords-and-frets.ly"></a> <h3 class="unnumberedsec">Single staff template with notes, lyrics, chords and frets</h3> <p>Here is a simple lead sheet template with melody, lyrics, chords and fret diagrams. <pre class="verbatim"> % Define the fret diagrams to be used cFretDiagram = \markup { \fret-diagram #"6-x;5-3-3;4-2-2;3-o;2-1-1;1-o;" } gFretDiagram = \markup { \fret-diagram #"6-3-2;5-2-1;4-o;3-o;2-o;1-3-3;" } verseI = \lyricmode { \set stanza = #"1." This is the first verse } verseII = \lyricmode { \set stanza = #"2." This is the second verse. } theChords = \new ChordNames { \chordmode { % insert the chords for chordnames here c2 g4 c } } staffMelody = \new Staff { \context Voice = "voiceMelody" { \key c \major \clef treble \relative c' { % Type notes and fret diagram markups here c4^\cFretDiagram d8 e f4^\gFretDiagram g^\cFretDiagram \bar "|." } } } \score { << \theChords \staffMelody \new Lyrics = "lyricsI" \lyricmode { \lyricsto "voiceMelody" \verseI } \new Lyrics = "lyricsII" \lyricmode { \lyricsto "voiceMelody" \verseII } >> \layout { } \midi { } } </pre> <p> <a href="../65/lily-041c2551.ly"> <img align="middle" border="0" src="../65/lily-041c2551.png" alt="[image of music]"> </a> </p> <p><a name="single-staff-template-with-notes-and-chords.ly"></a> <h3 class="unnumberedsec">Single staff template with notes and chords</h3> <p>Want to prepare a lead sheet with a melody and chords? Look no further! <pre class="verbatim"> melody = \relative c' { \clef treble \key c \major \time 4/4 f4 e8[ c] d4 g a2 ~ a } harmonies = \chordmode { c4:m f:min7 g:maj c:aug d2:dim b:sus } \score { << \new ChordNames { \set chordChanges = ##t \harmonies } \new Staff \melody >> \layout{ } \midi { } } </pre> <p> <a href="../dd/lily-c67e885a.ly"> <img align="middle" border="0" src="../dd/lily-c67e885a.png" alt="[image of music]"> </a> </p> <p><a name="single-staff-template-with-notes-and-lyrics.ly"></a> <h3 class="unnumberedsec">Single staff template with notes and lyrics</h3> <p>This small template demonstrates a simple melody with lyrics. Cut and paste, add notes, then words for the lyrics. This example turns off automatic beaming, which is common for vocal parts. To use automatic beaming, change or comment out the relevant line. <pre class="verbatim"> melody = \relative c' { \clef treble \key c \major \time 4/4 a4 b c d } text = \lyricmode { Aaa Bee Cee Dee } \score{ << \new Voice = "one" { \autoBeamOff \melody } \new Lyrics \lyricsto "one" \text >> \layout { } \midi { } } </pre> <p> <a href="../31/lily-35228590.ly"> <img align="middle" border="0" src="../31/lily-35228590.png" alt="[image of music]"> </a> </p> <p><a name="single-staff-template-with-only-notes.ly"></a> <h3 class="unnumberedsec">Single staff template with only notes</h3> <p>This very simple template gives you a staff with notes, suitable for a solo instrument or a melodic fragment. Cut and paste this into a file, add notes, and you're finished! <pre class="verbatim"> melody = \relative c' { \clef treble \key c \major \time 4/4 a4 b c d } \score { \new Staff \melody \layout { } \midi { } } </pre> <p> <a href="../cc/lily-b158a613.ly"> <img align="middle" border="0" src="../cc/lily-b158a613.png" alt="[image of music]"> </a> </p> <p><a name="string-quartet-template-simple.ly"></a> <h3 class="unnumberedsec">String quartet template (simple)</h3> <p>This template demonstrates a simple string quartet. It also uses a <code>\global</code> section for time and key signatures <pre class="verbatim"> global= { \time 4/4 \key c \major } violinOne = \new Voice \relative c'' { \set Staff.instrumentName = #"Violin 1 " c2 d e1 \bar "|." } violinTwo = \new Voice \relative c'' { \set Staff.instrumentName = #"Violin 2 " g2 f e1 \bar "|." } viola = \new Voice \relative c' { \set Staff.instrumentName = #"Viola " \clef alto e2 d c1 \bar "|." } cello = \new Voice \relative c' { \set Staff.instrumentName = #"Cello " \clef bass c2 b a1 \bar "|." } \score { \new StaffGroup << \new Staff << \global \violinOne >> \new Staff << \global \violinTwo >> \new Staff << \global \viola >> \new Staff << \global \cello >> >> \layout { } \midi { } } </pre> <p> <a href="../c0/lily-052deeba.ly"> <img align="middle" border="0" src="../c0/lily-052deeba.png" alt="[image of music]"> </a> </p> <p><a name="string-quartet-template-with-separate-parts.ly"></a> <h3 class="unnumberedsec">String quartet template with separate parts</h3> <p>The "String quartet template" snippet produces a nice string quartet, but what if you needed to print parts? This new template demonstrates how to use the <code>\tag</code> feature to easily split a piece into individual parts. <p>You need to split this template into separate files; the filenames are contained in comments at the beginning of each file. <code>piece.ly</code> contains all the music definitions. The other files – <code>score.ly</code>, <code>vn1.ly</code>, <code>vn2.ly</code>, <code>vla.ly</code>, and <code>vlc.ly</code> – produce the appropriate part. <p>Do not forget to remove specified comments when using separate files! <pre class="verbatim"> %%%%% piece.ly %%%%% (This is the global definitions file) global= { \time 4/4 \key c \major } Violinone = \new Voice { \relative c''{ \set Staff.instrumentName = #"Violin 1 " c2 d e1 \bar "|." }} %********************************* Violintwo = \new Voice { \relative c''{ \set Staff.instrumentName = #"Violin 2 " g2 f e1 \bar "|." }} %********************************* Viola = \new Voice { \relative c' { \set Staff.instrumentName = #"Viola " \clef alto e2 d c1 \bar "|." }} %********************************* Cello = \new Voice { \relative c' { \set Staff.instrumentName = #"Cello " \clef bass c2 b a1 \bar "|."}} %********************************** music = { << \tag #'score \tag #'vn1 \new Staff { << \global \Violinone >> } \tag #'score \tag #'vn2 \new Staff { << \global \Violintwo>> } \tag #'score \tag #'vla \new Staff { << \global \Viola>> } \tag #'score \tag #'vlc \new Staff { << \global \Cello>> } >> } %%% These are the other files you need to save on your computer %%%%% score.ly %%%%% (This is the main file) %\include "piece.ly" %%% uncomment this line when using a separate file #(set-global-staff-size 14) \score { \new StaffGroup \keepWithTag #'score \music \layout { } \midi { } } %{ Uncomment this block when using separate files %%%%% vn1.ly %%%%% (This is the Violin 1 part file) \include "piece.ly" \score { \keepWithTag #'vn1 \music \layout { } } %%%%% vn2.ly %%%%% (This is the Violin 2 part file) \include "piece.ly" \score { \keepWithTag #'vn2 \music \layout { } } %%%%% vla.ly %%%%% (This is the Viola part file) \include "piece.ly" \score { \keepWithTag #'vla \music \layout { } } %%%%% vlc.ly %%%%% (This is the Cello part file) \include "piece.ly" \score { \keepWithTag #'vlc \music \layout { } } %} </pre> <p> <a href="../8c/lily-5f210b23.ly"> <img align="middle" border="0" src="../8c/lily-5f210b23.png" alt="[image of music]"> </a> </p> <p><a name="vocal-ensemble-template-with-automatic-piano-reduction.ly"></a> <h3 class="unnumberedsec">Vocal ensemble template with automatic piano reduction</h3> <p>This template adds an automatic piano reduction to the standard SATB vocal score demonstrated in "Vocal ensemble template". This demonstrates one of the strengths of LilyPond – you can use a music definition more than once. If any changes are made to the vocal notes (say, <code>tenorMusic</code>), then the changes will also apply to the piano reduction. <pre class="verbatim"> global = { \key c \major \time 4/4 } sopMusic = \relative c'' { c4 c c8[( b)] c4 } sopWords = \lyricmode { hi hi hi hi } altoMusic = \relative c' { e4 f d e } altoWords =\lyricmode { ha ha ha ha } tenorMusic = \relative c' { g4 a f g } tenorWords = \lyricmode { hu hu hu hu } bassMusic = \relative c { c4 c g c } bassWords = \lyricmode { ho ho ho ho } \score { << \new ChoirStaff << \new Lyrics = sopranos { s1 } \new Staff = women << \new Voice = sopranos { \voiceOne << \global \sopMusic >> } \new Voice = altos { \voiceTwo << \global \altoMusic >> } >> \new Lyrics = altos { s1 } \new Lyrics = tenors { s1 } \new Staff = men << \clef bass \new Voice = tenors { \voiceOne <<\global \tenorMusic >> } \new Voice = basses { \voiceTwo <<\global \bassMusic >> } >> \new Lyrics = basses { s1 } \context Lyrics = sopranos \lyricsto sopranos \sopWords \context Lyrics = altos \lyricsto altos \altoWords \context Lyrics = tenors \lyricsto tenors \tenorWords \context Lyrics = basses \lyricsto basses \bassWords >> \new PianoStaff << \new Staff << \set Staff.printPartCombineTexts = ##f \partcombine << \global \sopMusic >> << \global \altoMusic >> >> \new Staff << \clef bass \set Staff.printPartCombineTexts = ##f \partcombine << \global \tenorMusic >> << \global \bassMusic >> >> >> >> \layout { \context { % a little smaller so lyrics % can be closer to the staff \Staff \override VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3) } } } </pre> <p> <a href="../99/lily-1164d362.ly"> <img align="middle" border="0" src="../99/lily-1164d362.png" alt="[image of music]"> </a> </p> <p><a name="vocal-ensemble-template-with-lyrics-aligned-below-and-above-the-staves.ly"></a> <h3 class="unnumberedsec">Vocal ensemble template with lyrics aligned below and above the staves</h3> <p>This template is basically the same as the simple "Vocal ensemble" template, with the exception that here all the lyrics lines are placed using <code>alignAboveContext</code> and <code>alignBelowContext</code>. <pre class="verbatim"> global = { \key c \major \time 4/4 } sopMusic = \relative c'' { c4 c c8[( b)] c4 } sopWords = \lyricmode { hi hi hi hi } altoMusic = \relative c' { e4 f d e } altoWords = \lyricmode { ha ha ha ha } tenorMusic = \relative c' { g4 a f g } tenorWords = \lyricmode { hu hu hu hu } bassMusic = \relative c { c4 c g c } bassWords = \lyricmode { ho ho ho ho } \score { \new ChoirStaff << \new Staff = women << \new Voice = "sopranos" { \voiceOne << \global \sopMusic >> } \new Voice = "altos" { \voiceTwo << \global \altoMusic >> } >> \new Lyrics \with { alignAboveContext = women } \lyricsto sopranos \sopWords \new Lyrics \with { alignBelowContext = women } \lyricsto altos \altoWords % we could remove the line about this with the line below, since we want % the alto lyrics to be below the alto Voice anyway. % \new Lyrics \lyricsto altos \altoWords \new Staff = men << \clef bass \new Voice = "tenors" { \voiceOne << \global \tenorMusic >> } \new Voice = "basses" { \voiceTwo << \global \bassMusic >> } >> \new Lyrics \with { alignAboveContext = men } \lyricsto tenors \tenorWords \new Lyrics \with { alignBelowContext = men } \lyricsto basses \bassWords % again, we could replace the line above this with the line below. % \new Lyrics \lyricsto basses \bassWords >> \layout { \context { % a little smaller so lyrics % can be closer to the staff \Staff \override VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3) } } } </pre> <p> <a href="../f3/lily-a11d4879.ly"> <img align="middle" border="0" src="../f3/lily-a11d4879.png" alt="[image of music]"> </a> </p> <p><a name="vocal-ensemble-template.ly"></a> <h3 class="unnumberedsec">Vocal ensemble template</h3> <p>Here is a standard four-part SATB vocal score. With larger ensembles, it is often useful to include a section which is included in all parts. For example, the time signature and key signature are almost always the same for all parts. Like in the "Hymn" template, the four voices are regrouped on only two staves. <pre class="verbatim"> global = { \key c \major \time 4/4 } sopMusic = \relative c'' { c4 c c8[( b)] c4 } sopWords = \lyricmode { hi hi hi hi } altoMusic = \relative c' { e4 f d e } altoWords = \lyricmode { ha ha ha ha } tenorMusic = \relative c' { g4 a f g } tenorWords = \lyricmode { hu hu hu hu } bassMusic = \relative c { c4 c g c } bassWords = \lyricmode { ho ho ho ho } \score { \new ChoirStaff << \new Lyrics = sopranos { s1 } \new Staff = women << \new Voice = "sopranos" { \voiceOne << \global \sopMusic >> } \new Voice = "altos" { \voiceTwo << \global \altoMusic >> } >> \new Lyrics = "altos" { s1 } \new Lyrics = "tenors" { s1 } \new Staff = men << \clef bass \new Voice = "tenors" { \voiceOne << \global \tenorMusic >> } \new Voice = "basses" { \voiceTwo << \global \bassMusic >> } >> \new Lyrics = basses { s1 } \context Lyrics = sopranos \lyricsto sopranos \sopWords \context Lyrics = altos \lyricsto altos \altoWords \context Lyrics = tenors \lyricsto tenors \tenorWords \context Lyrics = basses \lyricsto basses \bassWords >> \layout { \context { % a little smaller so lyrics % can be closer to the staff \Staff \override VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3) } } } </pre> <p> <a href="../b2/lily-b266ca1f.ly"> <img align="middle" border="0" src="../b2/lily-b266ca1f.png" alt="[image of music]"> </a> </p> <!-- footer_tag --><br><hr> <div class="node"> <p> Previous: <a rel="previous" accesskey="p" href="MIDI.html#MIDI">MIDI</a>, Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a> </div> <div style="background-color: #e8ffe8; padding: 2; border: #c0ffc0 1px solid;"> <p> <font size="-1"> This page is for LilyPond-2.11.57 (development-branch). <br> <address> Report errors to <a href="http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs">http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs</a>. </address> <br> Your <a href="http://lilypond.org/web/devel/participating/documentation-adding">suggestions for the documentation</a> are welcome. </font> </p> </div> </BODY></html>