It's true - your example, using the bar I included in my previous email, works fine.
In my previous attempts at getting this to work with the whole quartet I had your 2 Scheme "define"s and the myHairpinMinimumLength definition in a file of defaults, which has an /include in my top file. In the included file, after the definitions, I had '\myHairpinMinimumLength #2', or whatever value I was trying out. I have now realized that I had not set it correctly in a Voice context. Having corrected that, I find that it does indeed seem to produce the desired result. (I have not had time to check the hairpins on all 106 pages yet!) The only trouble is, I am getting a lot of compiler errors and warnings. For each of the relevant layout blocks, I get: programming error: infinite rod continuing, cross fingers and then numerous instances of: programming error: ignoring weird minimum distance continuing, cross fingers In the cases of the 2nd violin and the viola, this latter message is printed 50 times each for the 3rd movement alone - quite a lot for a movement with only 64 bars! And there are certainly well over 1,000 of these errors for the whole quartet (score and parts). Have you come across this behaviour? David On Sun, 2016-01-17 at 18:22 +0100, Thomas Morley wrote: > 2016-01-17 17:36 GMT+01:00 David Sumbler <da...@aeolia.co.uk>: > > Thank you for the suggestion (below) for controlling the actual length > > of hairpins. I am afraid it has taken until now for me to have an > > opportunity to try it out in my string quartet. Unfortunately, I find > > that it is only a partial success. > > > > Previously I had '\override Hairpin.minimum-length = #7' in my Voice > > defaults. This works OK most of the time, although obviously sometimes > > it produces an over-long hairpin which needs an override. > > > > I then tried setting \myHairpinMinimumLength #1.5 (as in your example), > > but had to remove the Hairpin.minimum-length setting to get it to work. > > Unfortunately I found that a number of hairpins produced a compiler > > warning: "decrescendo too small". > > > > I don't understand this, because the example you gave seems to compile > > without a problem, other than that the line length is far greater than > > my page width. > > > > The bar that seems to cause most of the problems is: > > > > g8\< a b cs( ~ cs\mf\> b) d,\mp cs | > > g8\< g a g fs4\mf\> r\! | > > d8\< e fs e as,(\mf\> b) r4\! | > > e2\< d4\mf\> fs8(--\mp fs)-- | > > > > This is a "parallelMusic" bar for a standard string quartet. The > > warnings are produced by the decrescendo, and this hairpin has zero > > actual length, despite the \myHairpinMinimumLength setting. This > > happens in each of the parts (apart from the viola), but not in the > > score. Presumably the extra quaver in the viola part saves the score > > and the viola part from getting this too-short hairpin, but then the > > viola part gives a similar warning in a later bar. > > > > I am using Lilypond 2.19.30. > > > > David > > > Hi David, > > the code below gives the attached output (cut off) > I see no problems and no warnings. > > Tiny example? > > \version "2.19.35" > > \language "english" > > %% 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} or @var{grob}, if equal to the grob named @var{name-symbol} > already. > 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 ((hairpin-minimum-length my-minimum) grob) > (let* ((bound-left (ly:spanner-bound grob LEFT)) > (bound-right (ly:spanner-bound grob RIGHT)) > (sys (look-up-for-parent 'System Y grob)) > (left-x-ext (ly:grob-extent bound-left sys X)) > (right-x-ext (ly:grob-extent bound-right sys X))) > (ly:grob-set-property! grob 'minimum-length > ;; keep 'minimum-length user-settable > (max (ly:grob-property-data grob 'minimum-length) > ;; nb, this calculation is only an approximation > ;; should work in most cases, though > (+ my-minimum (abs (cdr left-x-ext)) (abs (cdr right-x-ext))))))) > > myHairpinMinimumLength = > #(define-music-function (parser location minimum)(number?) > #{ > \override Hairpin.before-line-breaking = > #(hairpin-minimum-length minimum) > #}) > > %{ > { > \override Hairpin.color = #red > \myHairpinMinimumLength #1.5 > \repeat unfold 6 { c4\ffff\> d\pppp\! c d \noBreak } > \break > %% overriding 'minimum-length is still possible > \override Hairpin.minimum-length = 20 > \repeat unfold 6 { c4\ffff\> d\pppp\! c d \noBreak } > } > %} > > \parallelMusic #'(A B C D) { > g8\< a b cs( ~ cs\mf\> b) d,\mp cs | > g8\< g a g fs4\mf\> r\! | > d8\< e fs e as,(\mf\> b) r4\! | > e2\< d4\mf\> fs8(--\mp fs)-- | > } > > \layout { > \context { > \Voice > \myHairpinMinimumLength #3 > } > } > > > \new StaffGroup << > \new Staff \A > \new Staff \B > \new Staff \C > \new Staff \D > >> > > \new Staff \A > \new Staff \B > \new Staff \C > \new Staff \D > > Cheers, > Harm _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user