[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 10:18:15 +0200 |
2013/7/12 Urs Liska <address@hidden>:
> 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!
Glad I could help.
> 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 ...
Well, don't know ...
Today, with fresh eyes, I noticed some oversights while cleaning up
this function.
One line deleted, more consistent coding:
#(define delete-beams-for-certain-durations
;; Deletes @code{'BeamEvent} from @code{'articulations} if the duration of
;; the @code{'NoteEvent} is greater than a quarter.
(lambda (music)
(if (music-is-of-type? music 'note-event)
(let* ((dur (ly:duration-log (ly:music-property music 'duration))))
(if (<= dur 2)
(set! (ly:music-property music 'articulations)
(remove
(lambda (a) (music-is-of-type? a 'beam-event))
(ly:music-property music 'articulations))))
music)
music)))
Cheers,
Harm
Re: Building blocks request for review, Urs Liska, 2013/07/12