Am 21.03.2017 um 11:44 schrieb Malte Meyn:
> Or if you don’t want variants for all \grace variants (i. e. \grace,
> \slashedGrace, \appoggiatura, \acciaccatura, \afterGrace), just make a
> function that takes a music expression and scales it to 1. Maybe this
> could also be nice for cadenza-like things in real time notes (if you
> combine it with \newSpacingSection or a duration argument):
> 
> […]

scaleToLength =
#(define-music-function (dur mus) (ly:duration? ly:music?)
   (let* ((real-len (ly:music-length mus))
          (mom (ly:duration-length dur))
          (ratio-mom (ly:moment-div mom real-len))
          (ratio (cons (ly:moment-main-numerator ratio-mom)
                   (ly:moment-main-denominator ratio-mom))))
     #{
       \scaleDurations #ratio #mus
     #}))

% from Chopin’s Nocturne op. 15 No. 2
\new PianoStaff <<
  \new Staff \relative {
    \time 2/4
    \key fis \major
    \teeny
    \scaleToLength 2 {
      b'8([ ais b) ais( a gis) a( gis a) gis( g fis) g( fis g)
      fis\( f e eis fis eis dis( eis fis) ais( gis eis fis dis gis)\)]
    }
  }
  \new Staff \relative {
    \clef bass
    \key fis \major
    << { s8 d4 } \\ { fis,8( d' <gis b> cis,) } >>
  }
>>

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

Reply via email to