On Tue, 2016-01-19 at 23:00 +0100, Thomas Morley wrote: > %% a helper: > #(define (look-up-for-parent name-symbol axis grob) > "Return the parent of @var{grob}, specified by it's @var{name-symbol} > in > axis @var{axis} of @var{grob}. If @var{grob} is already equal to the > grob > named @var{name-symbol} return @var{grob}. If not found, look up for > the next > parent." > (let* ((parent (ly:grob-parent grob axis))) > (cond > ((not (ly:grob? parent)) > (ly:error > (_"Perhaps typing error for \"~a\" or \"~a\" is not in the > parent-tree.") > name-symbol name-symbol)) > ((equal? name-symbol (grob::name grob)) grob) > ((not (equal? name-symbol (grob::name parent))) > (look-up-for-parent name-symbol axis parent)) > (else parent)))) > > #(define (my-hairpin-minimum-length grob) > "Sets @code{minimum-length} for @code{Hairpin}, if their left bound is > not the > @code{NoteColumn}. > The visible length is actually the one, specified by an additional > override for > @code{minimum-length} or the default. > If left bound is @code{NoteColumn}, default or specified > @code{minimum-length} > will take over." > (let* ((bound-left (ly:spanner-bound grob LEFT)) > (sys (look-up-for-parent 'System Y grob)) > (left-x-ext (ly:grob-extent bound-left sys X)) > (not-note-column? > (lambda (g) > (not (and (ly:grob? g) > (grob::has-interface g > 'note-column-interface)))))) > (if (not-note-column? bound-left) > (ly:grob-set-property! grob 'minimum-length > (+ > (* (if (interval-sane? left-x-ext) (cdr left-x-ext) 1) > (ly:grob-property-data grob 'bound-padding)) > (ly:grob-property-data grob 'minimum-length) > (if (interval-sane? left-x-ext) (cdr left-x-ext) 0)))))) > > %% `myHairpinMinimumLength' tries to warrant the visible length of a > Hairpin > %% to be not less than the value of `minimum-length' > myHairpinMinimumLength = > \override Hairpin.before-line-breaking = #my-hairpin-minimum-length > > \layout { > \context { > \Voice > \myHairpinMinimumLength > %% default for 'minimum-length is #2 > %% try different values > \override Hairpin.minimum-length = #2 > } > } > I have now tested this latest version out on my string quartet score, and it seems to have solved the problem of too-short hairpins. I have not checked through the whole piece thoroughly yet, but certainly in the places where I previously had "decrescendo too small" warnings I now get a hairpin of a sensible length. (I have set Hairpin.minimum-length to 2.5).
Unfortunately I am still getting some over-long hairpins. I think that perhaps this has nothing to do with myHairpinMinimumLength, because I was getting these long hairpins before you ever sent it to me - this is one of the reasons I was going to set about tweaking hairpin lengths in the piece. The 2 bars I quoted before are: % bar 14 g8\< a b cs( ~ cs\mf\> b) d,\mp cs | g8\< g a g fs4\mf\> r\invP | d8\< e fs e as,(\mf\> b) r4\invP | e2\< d4\mf\> fs8(-\ten\mp fs)-\ten | % bar 15 b8 cs\< d e fs-\ten\> fs\! e d \time 3/2 | b,8\mp as\< b cs as-\ten\> b\! r4 \time 3/2 | r2 cs8-\ten\mf\> b\! r4 \time 3/2 | g8 e\< fs e fs-\ten\> d\! r4 \time 3/2 | This is in \parallelMusic for a string quartet. The decrescendo hairpins in bar 14 are now a reasonable length with the new routine. But the same items in bar 15 are far too long, in both score and all parts: they are roughly the same length as the crescendo hairpins earlier in the same bar, and thus the 5th and 6th quavers are forced apart for no good reason. I have tried substituting \! for my \invP markings, and replacing my tweaked -\ten markings with standard -- marks. I have also tried removing the dynamics in the viola part - I wondered whether the mf, which causes the viola hairpin to start a little later than the others, was somehow upsetting things. I have also searched all of the relevant input files for any mention of Hairpin settings that I might have overlooked, but found none. None of these experiments have changed anything: I still get a long hairpin in bar 15, although bar 14 is fine. As I said, it looks as if your routine is now working pretty well, and the problem I am having with bar 15 (and a few others) is some peculiar bug within Lilypond, but I can't figure out what is causing it to manifest itself at this particular point. Any suggestions you can make regarding this will, of course, be very gratefully received! David _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user