lilypond-user
[Top][All Lists]
Advanced

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

Re: slur and percent


From: Gianmaria Lari
Subject: Re: slur and percent
Date: Thu, 3 May 2018 22:29:36 +0200



On 3 May 2018 at 01:27, Aaron Hill <address@hidden> wrote:
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.


When I saw your code I didn't understand why the last example was so complicated. Then I tried to simply write:

\score { {a4( b c' a \makePercent s1 <>) } \layout {} \midi{} } 

and discovered that lilypond stop the slur before the percent!
So thank you for your code!

Ciao, g.
P.S. Yes, the midi output of your examples are all the same. They are not the same if I use \articulate script because in that case 

a( b c' a) a( b c' a) 

generate a different output than

a( b c' a a b c' a) 

reply via email to

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