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: Urs Liska
Subject: Re: Building blocks request for review
Date: Fri, 12 Jul 2013 09:20:48 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130510 Thunderbird/17.0.6

Am 12.07.2013 03:10, schrieb Thomas Morley:

Hi Urs,

I was annoyed by the loads of warnings for beamed half notes.
I was annoyed too, but unfortunately I'm still way from being able to fix that myself.
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))
That's awesome!
Do you think that's a function of a more general use? Normally you shouldn't have that situation often. Although - in the context of \shiftDurations it could happen more often ...

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
     }
   #})
For my project I found a more natural and elegant way to include it when "preparing" the \patterns:

II =  {
  \shiftDurations #1 #0  
  \scaleDurations 2/1
  \noBeamForLongerNotes {
    \patterns 4
  }
}

(the same of course in the "I =" part)


    

So far for today, perhaps more the upcoming weekend.
That would be great.
As mentioned the two most important issues are the non-working DrumStaff #'line-count and the beam subdivision.
I'm not even sure what the desired result should be, but of course adjacent notes (i.e. without a rest in between) should be beamed according to their usual time signature pattern and not strictly subdivided.


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..
That was a bug in my Python snippet which is fixed by now.
When generating a pattern I look for the index of the first and last note and generate the beaming code if there is more than one note in the line. Because I did some tests in the wrong order it ended up with putting that wrong closing bracket to the single note of the first lines. The fix was swapping two lines in the Python code.

Many thanks again
Urs

Regards,
  Harm


reply via email to

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