--- /dev/null
+%% Do not edit this file; it is auto-generated from LSR!
+\version "2.11.23"
+
+\header{
+texidoc = "
+@unnumbered Introduction
+
+This document shows examples from the
+@uref{http://lsr@/.dsi@/.unimi@/.it,LilyPond Snippet Repository}.
+
+In the web version of this document, you can click on the file name
+or figure for each example to see the corresponding input file."
+}
+
+% make sure .png is generated.
+\markup{ "This document is for LilyPond version" #(ly:export(lilypond-version)) }
+
--- /dev/null
+depth = ../../../
+
+STEPMAKE_TEMPLATES=documentation texinfo tex
+LOCALSTEPMAKE_TEMPLATES=lilypond ly lysdoc
+
+## Hmm, would this work? No -- if we really want examples, move
+## to other dir (input/) comes to mind.
+## examples = font20 ancient-font
+## LOCALSTEPMAKE_TEMPLATES += ly mutopia
+
+EXTRA_DIST_FILES=
+
+include $(depth)/make/stepmake.make
+
+TITLE=Advanced snippets
--- /dev/null
+# -*-python-*-
+
+Import ('env', 'collate')
+collate (title = 'Advanced snippets')
--- /dev/null
+%% Do not edit this file; it is auto-generated from LSR!
+\version "2.11.23"
+
+\header { texidoc = "
+Ambits can be added per voice. In that case, the ambitus must be moved
+manually to prevent collisions.
+" }
+
+\new Staff <<
+ \new Voice \with {
+ \consists "Ambitus_engraver"
+ } \relative c'' {
+ \override Ambitus #'X-offset = # 1.0
+ \voiceOne
+ c4 a d e f2
+ }
+ \new Voice \with {
+ \consists "Ambitus_engraver"
+ } \relative c' {
+ \voiceTwo
+ es4 f g as b2
+ }
+>>
+
--- /dev/null
+%% Do not edit this file; it is auto-generated from LSR!
+\version "2.11.23"
+
+\header { texidoc = "
+Ambituses indicate pitch ranges for voices.
+
+
+Accidentals only show up if they're not part of key signature.
+@code{AmbitusNoteHead} grobs also have ledger lines.
+" }
+
+\layout {
+ ragged-right = ##t
+ \context {
+ \Voice
+ \consists Ambitus_engraver
+ }
+}
+
+\relative
+<<
+ \new Staff {
+ \time 2/4 c4 f'
+ }
+ \new Staff \relative {
+ \time 2/4
+ \key d \major
+ cis as'
+ }
+>>
+
--- /dev/null
+%% Do not edit this file; it is auto-generated from LSR!
+\version "2.11.23"
+
+\header { texidoc = "
+The shapeNoteStyles property gives you the ability to define various
+note heads styles for each step of the scale (as defined by the key
+signature or the \"tonic\" property).
+
+This property requires a set of symbols, which can be purely arbitrary
+(geometrical expressions such as triangle, cross, xcircle etc. are
+allowed) or based on old American engraving tradition (you can use some
+latin note names as well).
+
+That said, if you're trying to imitate old American song books, you may
+also want to try LilyPond's predefined note heads styles, through
+shortcut commands such as \\aikenHeads or \\sacredHarpHeads.
+
+This exemple shows different ways to obtain shape note heads, and
+demonstrates the ability to transpose a melody without losing the
+correspondance between harmonic functions and note heads styles.
+" }
+
+fragment = {
+ \key c \major
+ c1 d e f g a b c
+ \break
+}
+
+\relative {
+ \set shapeNoteStyles = ##(do re mi fa #f la ti)
+ \fragment
+}
+
+% temporary change help LSR integration -gp
+%{
+\transpose c d
+ \relative {
+ \set shapeNoteStyles = ##(do re mi fa #f la ti)
+ \fragment
+}
+
+\relative {
+ \set shapeNoteStyles = ##(cross triangle fa #f mensural xcircle diamond)
+ \fragment
+}
+%}
+
--- /dev/null
+%% Do not edit this file; it is auto-generated from LSR!
+\version "2.11.23"
+
+\header { texidoc = "
+The command @code{\\clef \"treble_8\"} is equivalent to setting
+@code{clefGlyph}, @code{clefPosition} (which controls the Y position of
+the clef), @code{middleCPosition} and @code{clefOctavation}. A clef is
+printed when any of these properties are changed. The following
+example shows possibilities when setting properties manually.
+" }
+
+{
+ \set Staff.clefGlyph = #"clefs.F"
+ \set Staff.clefPosition = #2
+ c'4
+ \set Staff.clefGlyph = #"clefs.G"
+ c'4
+ \set Staff.clefGlyph = #"clefs.C"
+ c'4
+ \set Staff.clefOctavation = #7
+ c'4
+ \set Staff.clefOctavation = #0
+ \set Staff.clefPosition = #0
+ c'4
+ \clef "bass"
+ c'4
+ \set Staff.middleCPosition = #4
+ c'4
+}
+
--- /dev/null
+%% Do not edit this file; it is auto-generated from LSR!
+\version "2.11.23"
+
+\header { texidoc = "
+ The clef indicates which lines of the staff correspond to which
+pitches. The clef is set with the @code{\\clef} command
+
+
+ @{ c''2 \\clef alto g'2 @}
+
+
+Supported clefs include:
+
+@code{treble, violin, G, G2} G clef on 2nd line @code{alto, C} C clef
+on 3rd line @code{tenor} C clef on 4th line. @code{bass, F} F clef on
+4th line @code{french} G clef on 1st line, so-called French violin clef
+@code{soprano} C clef on 1st line @code{mezzosoprano} C clef on 2nd
+line @code{baritone} C clef on 5th line @code{varbaritone} F clef on
+3rd line @code{subbass} F clef on 5th line @code{percussion} percussion
+clef @code{tab} tablature clef
+
+ By adding @code{_8} or @code{^8} to the clef name, the clef is
+transposed one octave down or up, respectively, and @code{_15} and
+@code{^15} transposes by two octaves. The argument clefname must be
+enclosed in quotes when it contains underscores or digits. See the last
+two bars for an example.
+" }
+
+{ g'2 \clef alto g'2
+ \clef tenor g'2 \clef bass g'2
+ \clef french g'2 \clef soprano g'2
+ \clef mezzosoprano g'2 \clef baritone g'2
+ \clef varbaritone g'2 \clef subbass g'2
+ \clef percussion g'2 \clef tab g'2
+% TO TRANSPOSE THE CLEF ONE OCTAVE UP OR DOWN SEE THE FOLLOWING BARS:
+ \clef "G_8" c'1 \clef "G^8" c'1
+}
+
--- /dev/null
+%% Do not edit this file; it is auto-generated from LSR!
+\version "2.11.23"
+
+\header { texidoc = "
+In music that contains many occurrences of the same sequence of notes
+at different pitches, you can use the following music function. It
+takes a note, of which the pitch is used. The supporting Scheme
+functions were borrowed from the Tips and Tricks document in the manual.
+
+This example creates the rhythm used throughout Mars, from The Planets,
+by Gustav Holst.
+" }
+
+#(define (make-note-req p d)
+ (make-music 'NoteEvent
+ 'duration d
+ 'pitch p))
+
+#(define (make-note p d)
+ (make-music 'EventChord
+ 'elements (list (make-note-req p d))))
+
+#(define (seq-music-list elts)
+ (make-music 'SequentialMusic
+ 'elements elts))
+
+#(define (make-triplet elt)
+ (make-music 'TimeScaledMusic
+ 'denominator 3
+ 'numerator 2
+ 'element elt))
+
+
+rhythm = #(define-music-function (parser location note) (ly:music?)
+ "Make the rhythm in Mars (the Planets) at the given note's pitch"
+ (let* ((p (ly:music-property
+ (car (ly:music-property note 'elements))
+ 'pitch)))
+ (seq-music-list (list
+ (make-triplet (seq-music-list (list
+ (make-note p (ly:make-duration 3 0 2 3))
+ (make-note p (ly:make-duration 3 0 2 3))
+ (make-note p (ly:make-duration 3 0 2 3))
+ )))
+ (make-note p (ly:make-duration 2 0))
+ (make-note p (ly:make-duration 2 0))
+ (make-note p (ly:make-duration 3 0))
+ (make-note p (ly:make-duration 3 0))
+ (make-note p (ly:make-duration 2 0))
+ ))))
+
+\score {
+ \new Staff {
+ \time 5/4
+
+ \rhythm c'
+ \rhythm c''
+ \rhythm g
+ }
+}
+
--- /dev/null
+%% Do not edit this file; it is auto-generated from LSR!
+\version "2.11.23"
+
+\header { texidoc = "
+In early XXth century works, starting with Schönberg, Berg and Webern
+(the \"second\" Viennese school), every pitch in the twelve- note scale
+has to be regarded as equal, without any hierarchy such as the
+classical (tonal) degrees. Therefore, these composers print one
+accidental for each note, even at natural pitches, to emphasize their
+new approach to music theory and language. This snippet (thanks to Rune
+Zedeler) shows how to achieve such notation rules with LilyPond.
+" }
+
+webernAccidentals = {
+ % the 5s are just "a value different from any accidental"
+ \set Staff.keySignature = #'((0 . 5) (1 . 5) (2 . 5) (3 . 5)
+ (4 . 5) (5 . 5) (6 . 5))
+ \set Staff.extraNatural = ##f
+ #(set-accidental-style 'forget)
+}
+
+\layout {
+ \context { \Staff \remove Key_engraver }
+}
+\score {
+ {
+ \webernAccidentals
+ c' dis' cis' cis'
+ c' dis' cis' cis'
+ c' c' dis' des'
+ }
+}
--- /dev/null
+%% Do not edit this file; it is auto-generated from LSR!
+\version "2.11.23"
+
+\header { texidoc = "
+ Normally accidentals are printed automatically, but you may also print
+them manually. A reminder accidental can be forced by adding an
+exclamation mark ! after the pitch. A cautionary accidental (i.e., an
+accidental within parentheses) can be obtained by adding the question
+mark `?' after the pitch.
+
+
+
+Cautionary accidentals may be made smaller, or placed inside
+parentheses
+" }
+
+{
+cis' cis' cis'! cis'?
+
+ c''4
+ cis''?4
+ \once \override Staff.AccidentalCautionary #'font-size = #-2
+ cis''?4
+ \once \override Staff.AccidentalCautionary #'parenthesized = ##t
+ cis''?4
+}
--- /dev/null
+%% Do not edit this file; it is auto-generated from LSR!
+\version "2.11.23"
+
+\header { texidoc = "
+This Scheme-based snippet allows you to generate 256 random notes based
+on the current time (or any randomish number you might wish to specify
+instead, so you can obtain the same random notes each time): i.e. to
+get different random notes patterns, just change this number.
+" }
+
+\score {
+{ #(let ((random-state (seed->random-state (current-time))))
+ (ly:export
+ (make-music 'SequentialMusic 'elements
+ (map (lambda x
+ (let ((idx (random 12 random-state)))
+ (make-music 'EventChord
+ 'elements (list (make-music 'NoteEvent
+ 'duration (ly:make-duration 2 0 1 1)
+ 'pitch (ly:make-pitch (quotient idx 7)
+ (remainder idx 7)
+ 0))))))
+ (make-list 256)))))
+ }
+}
--- /dev/null
+%% Do not edit this file; it is auto-generated from LSR!
+\version "2.11.23"
+
+\header { texidoc = "
+The key signature indicates the tonality in which a piece is played.
+It is denoted by a set of alterations (flats or sharps) at the start of
+the staff.
+
+ Setting or changing the key signature is done with the @code{\\key}
+command
+
+
+@code{\\key} pitch type
+
+
+Here, type should be @code{\\major} or @code{\\minor} to get
+pitch-major or pitch-minor, respectively. You may also use the
+standard mode names (also called “church modes”): @code{\\ionian},
+@code{\\locrian}, @code{\\aeolian}, @code{\\mixolydian},
+@code{\\lydian}, @code{\\phrygian}, and @code{\\dorian}.
+
+
+This command sets the context property @code{Staff.keySignature}.
+Non-standard key signatures can be specified by setting this property
+directly.
+
+
+Accidentals and key signatures often confuse new users, because
+unaltered notes get natural signs depending on the key signature.
+" }
+
+\relative c''
+{
+\key d \major
+a b cis d
+\key g \minor
+a bes c d
+\set Staff.printKeyCancellation = ##f
+\key d \major
+a b cis d
+\key g \minor
+a bes c d
+}
+
--- /dev/null
+%% Do not edit this file; it is auto-generated from LSR!
+\version "2.11.23"
+
+\header { texidoc = "
+Half-flats and half-sharps are formed by adding -eh and -ih; the
+following is a series of Cs with increasing pitches. Micro tones are
+also exported to the MIDI file. There are no generally accepted
+standards for denoting three quarter flats, so LilyPond's symbol does
+not conform to any standard.
+" }
+
+\relative c''
+{
+{ ceseh ceh cih cisih }
+}
--- /dev/null
+%% Do not edit this file; it is auto-generated from LSR!
+\version "2.11.23"
+
+\header { texidoc = "
+The notes are specified by the letters a through g. The octave is
+formed with notes ranging from c to b. The pitch c is an octave below
+middle C and the letters span the octave above that C.
+" }
+
+{
+\clef bass
+a,4 b, c d e f g a b c' d' e' \clef treble f' g' a' b' c''
+}
+
--- /dev/null
+%% Do not edit this file; it is auto-generated from LSR!
+\version "2.11.23"
+
+\header { texidoc = "
+A sharp is formed by adding -is to the end of a pitch name and a flat
+is formed by adding -es. Double sharps and double flats are obtained by
+adding -isis or -eses. These names are the Dutch note names. In Dutch,
+aes is contracted to as, but both forms are accepted. Similarly, both
+es and ees are accepted.
+" }
+
+\relative c''
+{
+% ly snippet contents follows:
+ceses4
+ces
+c
+cis
+cisis
+
+% end ly snippet
+}
--- /dev/null
+%% Do not edit this file; it is auto-generated from LSR!
+\version "2.11.23"
+
+\header { texidoc = "
+The optional octave specification takes the form of a series of single
+quote (`'') characters or a series of comma (`,') characters. Each '
+raises the pitch by one octave; each , lowers the pitch by an octave
+" }
+
+{
+c' c'' es' g' as' gisis' ais'
+}
+
--- /dev/null
+%% Do not edit this file; it is auto-generated from LSR!
+\version "2.11.23"
+
+\header { texidoc = "
+There is a way to enforce enharmonic modifications for notes in order
+to have the minimum number of accidentals. In that case, ``Double
+accidentals should be removed, as well as E-sharp (-> F), bC (-> B), bF
+(-> E), B-sharp (-> C).'', as proposed by a request for a new feature.
+In this manner, the most natural enharmonic notes are chosen in this
+example.
+" }
+
+#(define (naturalise-pitch p)
+ (let* ((o (ly:pitch-octave p))
+ (a (ly:pitch-alteration p))
+ (n (ly:pitch-notename p)))
+
+ (cond
+ ((and (> a 1) (or (eq? n 6) (eq? n 2)))
+ (set! a (- a 2))
+ (set! n (+ n 1)))
+ ((and (< a -1) (or (eq? n 0) (eq? n 3)))
+ (set! a (+ a 2))
+ (set! n (- n 1))))
+
+ (cond
+ ((> a 2) (set! a (- a 4)) (set! n (+ n 1)))
+ ((< a -2) (set! a (+ a 4)) (set! n (- n 1))))
+
+ (if (< n 0) (begin (set! o (- o 1)) (set! n (+ n 7))))
+ (if (> n 6) (begin (set! o (+ o 1)) (set! n (- n 7))))
+
+ (ly:make-pitch o n a)))
+
+#(define (naturalise music)
+ (let* ((es (ly:music-property music 'elements))
+ (e (ly:music-property music 'element))
+ (p (ly:music-property music 'pitch)))
+
+ (if (pair? es)
+ (ly:music-set-property!
+ music 'elements
+ (map (lambda (x) (naturalise x)) es)))
+
+ (if (ly:music? e)
+ (ly:music-set-property!
+ music 'element
+ (naturalise e)))
+
+ (if (ly:pitch? p)
+ (begin
+ (set! p (naturalise-pitch p))
+ (ly:music-set-property! music 'pitch p)))
+
+ music))
+
+music = \relative c' { c4 d e f g a b c }
+
+naturaliseMusic =
+#(define-music-function (parser location m)
+ (ly:music?)
+ (naturalise m))
+
+\score {
+ \context Staff {
+ \transpose c ais \music
+ \naturaliseMusic \transpose c ais \music
+ \transpose c deses \music
+ \naturaliseMusic \transpose c deses \music
+ }
+ \layout { ragged-right = ##t}
+}
+
+