lilypond-user
[Top][All Lists]
Advanced

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

Re: Tweaking notehead direction in chords


From: Paul Morris
Subject: Re: Tweaking notehead direction in chords
Date: Thu, 13 Dec 2012 22:53:29 -0500

Hi David,

On Dec 13, 2012, at 10:36 PM, David Nalesnik <address@hidden> wrote:

> Hi again,
> 
> On Thu, Dec 13, 2012 at 9:30 PM, David Nalesnik
> <address@hidden> wrote:
>> Hi Paul,
>> 
>> Somehow your response has gotten associated with the wrong thread.
>> 
>> On Thu, Dec 13, 2012 at 9:12 PM, Paul Morris <address@hidden> wrote:
>> 
>>> I came up with the following using "inf?" to check for an infinite value 
>>> and use 0 if so.  It works on my machine.  Blank > screen after uploading 
>>> to the LSR again, but maybe it is just taking time to update?  So I left it 
>>> up this time.
>> 
>> 
>> I notice that you haven't added the $ sign before offsets in the LSR
>> snippet as Harm and I advised.  Try that and I see no reason the
>> snippet shouldn't work..
>> 
> 
> Ah, no, I see. You did add it, but not in the right place.  

Thanks for catching that.  I was sure I had added it!


> Here's how
> the music function should look:
> 
> displaceHeads =
> #(define-music-function (parser location offsets) (list?)
> #{
>  \once \override NoteColumn #'before-line-breaking = #(shift $offsets)
> #})

Yep, I've fixed it now.  Just got in too much of a hurry I guess.

And we're back on the right thread.

Cheers,
-Paul



On Dec 13, 2012, at 10:12 PM, Paul Morris <address@hidden> wrote:

> On Dec 13, 2012, at 6:50 AM, Thomas Morley <address@hidden> wrote:
> 
>> 2012/12/13 Paul Morris <address@hidden>:
>> [...]
>>> I found a good way to break it.  If you try it with whole notes the stem's 
>>> X-extent is (+inf.0 . -inf.0) and you get this error: "programming error: 
>>> Infinity or NaN encountered"
>> 
>> Likely, a check for
>> grob::is-live?
>> should be helpful.
> 
> Thanks, I gave that a try tonight, but 
> grob:is-live? 
> returned #t for the stem grob for whole notes.  It appears their stem is live 
> but with a width of negative infinity.
> 
> 
>>> So I tried to work around this with the code below, but when I uploaded it 
>>> to the LSR something went wrong, no error messages or anything but the 
>>> preview page was just blank.[1]  I put the previous version back but it was 
>>> still blank, so I must have broken something.
>>> 
>>> [1] http://lsr.dsi.unimi.it/LSR/Item?u=1&id=861
>> 
>> Today I can't see any problems. Sometimes the LSR seems to need a
>> little more time.
> 
> I came up with the following using "inf?" to check for an infinite value and 
> use 0 if so.  It works on my machine.  Blank screen after uploading to the 
> LSR again, but maybe it is just taking time to update?  So I left it up this 
> time. 
> 
> http://lsr.dsi.unimi.it/LSR/Item?u=1&id=862
> 
> Regards,
> -Paul
> 
> 
> #(define ((shift offsets) grob)
> (let* ((note-heads (ly:grob-array->list (ly:grob-object grob 'note-heads)))
>       (stem (ly:grob-object grob 'stem))
>       (stem-ext (ly:grob-property stem 'X-extent))
>       (half-stem-ext (if (inf? (cdr stem-ext)) 0 (cdr stem-ext))))
>  (display stem-ext) (newline)
>  (for-each
>    (lambda (p q)
>      (let ((head-ext (interval-length (ly:grob-property p 'X-extent))))
>        (ly:grob-translate-axis! p (* q (- head-ext half-stem-ext)) X)))
>    note-heads offsets)))
> 
> 
> displaceHeads =
> #(define-music-function (parser location offsets) (list?)
> #{
>  \once \override NoteColumn #'before-line-breaking = #(shift offsets)
> #}
> )
> 
> %%%%%%%% EXAMPLE %%%%%%%%
> 
> theMusic = \relative c' {
> e4
> 
> \displaceHeads #'(1) 
> \once \override Staff.NoteHead #'stem-attachment = #'(1.09 . -0.34)
> e
> 
> d'
> 
> \displaceHeads #'(-1) 
> \once \override Staff.NoteHead #'stem-attachment = #'(1.11 . -0.34)
> d
> 
> <c, e>
> 
> \displaceHeads #'(0 1) <c e>
> 
> <e'g>
> 
> \displaceHeads #'(-1 0) <e g>
> 
> <f, a c>
> 
> \displaceHeads #'(1 0 0) 
> \once \override Staff.Stem #'stem-begin-position = #-3.3 
> <f a c>
> 
> <c' e g>
> 
> \displaceHeads #'(-1 -1 0) <c e g>
> 
> <ees f a c>
> 
> \displaceHeads #'(0 -1 0 0) <ees f a c>
> 
> <ees, f a c>
> 
> \displaceHeads #'(1 0 0 0) 
> \once \override Staff.Stem #'stem-begin-position = #-4.3 
> <ees f a c>
> }
> 
> \new Staff {
> \theMusic
> }
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user




reply via email to

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