lilypond-user
[Top][All Lists]
Advanced

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

Re: Building blocks request for review


From: Thomas Morley
Subject: Re: Building blocks request for review
Date: Fri, 12 Jul 2013 03:10:58 +0200

2013/7/11 Urs Liska <address@hidden>:
> Am 11.07.2013 23:19, schrieb Thomas Morley:
[...]
>> Investigating futher ...
>
> Looking forward to it :-)
>
> Urs

Hi Urs,

I was annoyed by the loads of warnings for beamed half notes.

Therefore I wrote some code to avoid that:

\version "2.16.2"

#(define delete-beams-for-certain-durations
;; Deletes @code{'BeamEvent} from @code{'articulations} if the duration of
;; @code{'NoteEvent} is longer than or equal to a quarter.
  (lambda (music)
    (if (music-is-of-type? music 'note-event)
        (let* ((dur (ly:duration-log (ly:music-property music 'duration)))
               (arts (ly:music-property music 'articulations)))
           (if (<= dur 2)
             (set! (ly:music-property music 'articulations)
                (remove
                  (lambda (a) (eq? 'BeamEvent (ly:prob-property a 'name)))
                  (ly:music-property music 'articulations))))
           music)
        music)))

noBeamForLongerNotes =
#(define-music-function (parser location m)(ly:music?)
" Maps @code{delete-beams-for-certain-durations} over @var{m} "
(music-map delete-beams-for-certain-durations m))


You could apply \noBeamForLongerNotes in
building-blocks-patterns.ily
like:

patterns =
#(define-music-function (parser location layer) (number?)
   (set! denominator layer)
   #{
     \noBeamForLongerNotes {
     \time 2/2
     \newExercise 2
     c2] r2  | % 2
;;    [skip] !!
     c2[ c2 c2 c2 c2 c2 c2 c2]  | % 255
     }
   #})

So far for today, perhaps more the upcoming weekend.


Btw, what's the reason for starting a new exercise with:
     \newExercise 2
     c2]
i.e. the closing bracket?
Seems there is not a matching pendant..

Regards,
  Harm



reply via email to

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