[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Forced double accidental
From: |
Paul Morris |
Subject: |
Re: Forced double accidental |
Date: |
Thu, 13 Dec 2012 22:12:46 -0500 |
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
}
- Re: Tweaking notehead direction in chords, (continued)
- Message not available
- Re: Tweaking notehead direction in chords, Thomas Morley, 2012/12/12
- Re: Tweaking notehead direction in chords, David Nalesnik, 2012/12/12
- Re: Tweaking notehead direction in chords, Paul Morris, 2012/12/12
- Re: Tweaking notehead direction in chords, Thomas Morley, 2012/12/12
- Re: Tweaking notehead direction in chords, Paul Morris, 2012/12/12
- Re: Tweaking notehead direction in chords, Thomas Morley, 2012/12/13
- Re: Forced double accidental,
Paul Morris <=
- Re: Forced double accidental, David Nalesnik, 2012/12/13
- Re: Forced double accidental, David Nalesnik, 2012/12/13
- Re: Forced double accidental, David Kastrup, 2012/12/14
- Re: Tweaking notehead direction in chords, Paul Morris, 2012/12/15
- Re: Tweaking notehead direction in chords, Thomas Morley, 2012/12/15
- Re: Tweaking notehead direction in chords, Thomas Morley, 2012/12/17
- Re: Tweaking notehead direction in chords, Paul Morris, 2012/12/17
- Re: Tweaking notehead direction in chords, Paul Morris, 2012/12/20
- Re: Tweaking notehead direction in chords, Thomas Morley, 2012/12/20
- Re: Tweaking notehead direction in chords, David Kastrup, 2012/12/21