Is there any way to write this

\version "2.19.81"
{a( b c' a a b c' a)}

with a repeat percent? Something similar to this:

\version "2.19.81"
{\repeat percent 2 {a( b c' a} ) }

Thank you, g.

I found in the documentation the "Isolated percents". Here it is the
documentation excerpt:

makePercent =
#(define-music-function (note) (ly:music?)
   "Make a percent repeat the same length as NOTE."
   (make-music 'PercentEvent
               'length (ly:music-length note)))

\relative c'' {
  \makePercent s1
}

What about the midi generation? Should I handle it with tag or there is a
better way?

Consider the following:

%%%
\version "2.19.80"

makePercent =
  #(define-music-function (parser location note) (ly:music?)
    "Make a percent repeat the same length as NOTE."
    (make-music 'PercentEvent
      'length (ly:music-length note)))

original = { a4( b c' a a b c' a) }

percentRepeat = { \repeat percent 2 { \slurHalfSolid a4( b c' a) } }

hiddenNotesAndMakePercent = { <<
{ \oneVoice \slurHalfSolid a4( b c' a \hideNotes a b c' a) \unHideNotes } \\
  { s1 \makePercent s1 }
}

\score { \original \layout {} \midi {} }
\score { \percentRepeat \layout {} }
\score { \unfoldRepeats \percentRepeat \midi {} }
\score { \hiddenNotesAndMakePercent \layout {} \midi {} }
%%%

These all produce the same MIDI output with different visual renderings. Obviously, the use of \slurHalfSolid is optional, but I think it adds a useful visual distinction to the normal slur.


-- Aaron Hill

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to