Overriding NoteHead stencil in a chord produces unwanted X offset

View: New views
9 Messages — Rating Filter:   Alert me  

Overriding NoteHead stencil in a chord produces unwanted X offset

by Mike Solomon-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey lilypond users,
    In compiling the following:

\version "2.13.0"

\relative  c' { <c \tweak #'stencil #ly:text-interface::print \tweak #'text
#(markup #:musicglyph "noteheads.s2")  cis' g'>1 }

You'll see that the middle notehead of the above-chord is too far to the
right.  Some other tweaks:

\relative  c' { << { <c g''>1 } \\ { \override Stem #'transparent = ##t
\override Stem #'direction = #UP c'4 } >> }

Too left.

\relative  c' { << { <c g''>1 } \\ { \override Stem #'transparent = ##t c'4
} >> }

Too left.

\relative  c' { << { <c g''>1 } { \override Stem #'transparent = ##t c'4 }
>> }

Too right.

Is there anything you'd recommend that'll get this quarter note flush with
the whole notes?

Thanks!
~Mike




_______________________________________________
lilypond-user mailing list
lilypond-user@...
http://lists.gnu.org/mailman/listinfo/lilypond-user

Re: Overriding NoteHead stencil in a chord produces unwanted X offset

by Mark Polesky :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Mike Solomon wrote:

> \relative  c' {
>   <<
>      { <c g''>1 }
>      { \override Stem #'transparent = ##t c'4 }
>   >>
> }
>
> You'll see that the middle notehead of the above-chord is too far
> to the right....
> Is there anything you'd recommend that'll get this quarter note
> flush with the whole notes?

I'll help you, but I need to understand better what you want.

1) Why do you want the quarter-note stem removed?
2) The quarter-note is already "flush" with (the right side of) the
   whole notes in the last example. Do you want it centered? Why?

The reason I'm asking these questions is because I need to make
sure you're not casually violating standard engraving without good
reason. I don't mean to be annoying! It may also help if you post
a full measure so I can see the musical context.

Thanks.
- Mark



     


_______________________________________________
lilypond-user mailing list
lilypond-user@...
http://lists.gnu.org/mailman/listinfo/lilypond-user

Re: Overriding NoteHead stencil in a chord produces unwanted X offset

by Mike Solomon-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Good question!
I am trying to write clarinet multiphonics.  Traditionally (and by
traditionally I mean in the past 10 years wherever I see it), the middle
note of a clarinet multiphonic is written as a quarter note regardless of
the multiphonic's duration.  This is to signify that it may or may not
appear depending on the dynamic.  The best example I can drum up is E
Michael Richard's site on multiphonics:

http://userpages.umbc.edu/~emrich/chapter6-5.html

Although most scores that use notation like this are hand-written, you'll
see that generally the composer endeavors to center-align the filled-in
notehead.

I erroneously said "flush" when I meant centered - you're absolutely right.

Although I could keep the stem, this emerging notational convention seems to
always dispense with the stem, so I'd like to as well.

The minimal example I provided is more or less a full-measure multiphonic.
In the score I'm writing, this chord is accompanied by an eps markup w/ a
fingering chart, but other than that what I've put below constitutes a
measure of the actual score.

THANK YOU very much for your help!
~Mike

On 7/4/09 12:25 PM, "Mark Polesky" <markpolesky@...> wrote:

>
> Mike Solomon wrote:
>> \relative  c' {
>>   <<
>>      { <c g''>1 }
>>      { \override Stem #'transparent = ##t c'4 }
>>>>
>> }
>>
>> You'll see that the middle notehead of the above-chord is too far
>> to the right....
>> Is there anything you'd recommend that'll get this quarter note
>> flush with the whole notes?
>
> I'll help you, but I need to understand better what you want.
>
> 1) Why do you want the quarter-note stem removed?
> 2) The quarter-note is already "flush" with (the right side of) the
>    whole notes in the last example. Do you want it centered? Why?
>
> The reason I'm asking these questions is because I need to make
> sure you're not casually violating standard engraving without good
> reason. I don't mean to be annoying! It may also help if you post
> a full measure so I can see the musical context.
>
> Thanks.
> - Mark
>
>
>
>      
>




_______________________________________________
lilypond-user mailing list
lilypond-user@...
http://lists.gnu.org/mailman/listinfo/lilypond-user

Re: Overriding NoteHead stencil in a chord produces unwanted X offset

by Mark Polesky :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Mike Solomon wrote:
> Good question!
> I am trying to write clarinet multiphonics.>
> http://userpages.umbc.edu/~emrich/chapter6-5.html

I see. Here's a temporary solution, which could be automated with
some ingenuity. The value 1.65 seems to work below, but it's not
the value I would have expected to work. I might play around a
little more with this, because as it stands, this would be
cumbersome if you have a lot of these. Are you writing just a few
here and there? By the way, what do the up and down arrows mean,
eighth-tones? Also, is there always just one quarter-note-head in
the middle? I assume that there can be more than one.

\relative  c' {
  <c
  \tweak #'duration-log #2 \tweak #'X-extent #'(0 . 1.65) cis'
  g'>1
}

> THANK YOU very much for your help!

Happy to help.
- Mark


     


_______________________________________________
lilypond-user mailing list
lilypond-user@...
http://lists.gnu.org/mailman/listinfo/lilypond-user

Re: Overriding NoteHead stencil in a chord produces unwanted X offset

by Mike Solomon-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The up and down arrows are eighth tones, but there is no standard convention
for how to write them.  Also, as you can imagine, they are approximations of
just-intoned intervals.  What really matters is the fingering chart.  To
effectuate these eighth tones, I modified someone else's quarter tone code
(see below).  
As I'll be using a lot of microtones, I may work on automating your very
good solution. My deadline for the piece is July 20, so I am under the gun,
but as Confucius once said, "One day devoted to automating a process saves
you a lifetime of doing it manually."

~Mike

#(define-public Q-SHARP 499/4000)
#(define-public Q-Q-SHARP 999/4000)
#(define-public Q-Q-Q-SHARP 1499/4000)
#(define-public SHARP-Q 2499/4000)
#(define-public SHARP-Q-Q 2999/4000)
#(define-public SHARP-Q-Q-Q 3499/4000)
#(define-public Q-FLAT -499/4000)
#(define-public Q-Q-FLAT -999/4000)
#(define-public Q-Q-Q-FLAT -1499/4000)
#(define-public FLAT-Q -2499/4000)
#(define-public FLAT-Q-Q -2999/4000)
#(define-public FLAT-Q-Q-Q -3499/4000)

quartertonearrowPitchNames =  #`(

        (ceses . ,(ly:make-pitch -1 0 DOUBLE-FLAT))
        (cesfff . ,(ly:make-pitch -1 0 FLAT-Q-Q-Q))
        (cesff . ,(ly:make-pitch -1 0 FLAT-Q-Q))
        (cesf . ,(ly:make-pitch -1 0 FLAT-Q))
        (ces . ,(ly:make-pitch -1 0 FLAT))
        (cfffes . ,(ly:make-pitch -1 0 Q-Q-Q-FLAT))
        (cffes . ,(ly:make-pitch -1 0 Q-Q-FLAT))
        (cfes . ,(ly:make-pitch -1 0 Q-FLAT))
        (c . ,(ly:make-pitch -1 0 NATURAL))
        (csis . ,(ly:make-pitch -1 0 Q-SHARP))
        (cssis . ,(ly:make-pitch -1 0 Q-Q-SHARP))
        (csssis . ,(ly:make-pitch -1 0 Q-Q-Q-SHARP))
        (cis . ,(ly:make-pitch -1 0 SHARP))
        (ciss . ,(ly:make-pitch -1 0 SHARP-Q))
        (cisss . ,(ly:make-pitch -1 0 SHARP-Q-Q))
        (cissss . ,(ly:make-pitch -1 0 SHARP-Q-Q-Q))
        (cisis . ,(ly:make-pitch -1 0 DOUBLE-SHARP))

        (deses . ,(ly:make-pitch -1 1 DOUBLE-FLAT))
        (desfff . ,(ly:make-pitch -1 1 FLAT-Q-Q-Q))
        (desff . ,(ly:make-pitch -1 1 FLAT-Q-Q))
        (desf . ,(ly:make-pitch -1 1 FLAT-Q))
        (des . ,(ly:make-pitch -1 1 FLAT))
        (dfffes . ,(ly:make-pitch -1 1 Q-Q-Q-FLAT))
        (dffes . ,(ly:make-pitch -1 1 Q-Q-FLAT))
        (dfes . ,(ly:make-pitch -1 1 Q-FLAT))
        (d . ,(ly:make-pitch -1 1 NATURAL))
        (dsis . ,(ly:make-pitch -1 1 Q-SHARP))
        (dssis . ,(ly:make-pitch -1 1 Q-Q-SHARP))
        (dsssis . ,(ly:make-pitch -1 1 Q-Q-Q-SHARP))
        (dis . ,(ly:make-pitch -1 1 SHARP))
        (diss . ,(ly:make-pitch -1 1 SHARP-Q))
        (disss . ,(ly:make-pitch -1 1 SHARP-Q-Q))
        (dissss . ,(ly:make-pitch -1 1 SHARP-Q-Q-Q))
        (disis . ,(ly:make-pitch -1 1 DOUBLE-SHARP))

        (eeses . ,(ly:make-pitch -1 2 DOUBLE-FLAT))
        (eesfff . ,(ly:make-pitch -1 2 FLAT-Q-Q-Q))
        (eesff . ,(ly:make-pitch -1 2 FLAT-Q-Q))
        (eesf . ,(ly:make-pitch -1 2 FLAT-Q))
        (ees . ,(ly:make-pitch -1 2 FLAT))
        (efffes . ,(ly:make-pitch -1 2 Q-Q-Q-FLAT))
        (effes . ,(ly:make-pitch -1 2 Q-Q-FLAT))
        (efes . ,(ly:make-pitch -1 2 Q-FLAT))
        (e . ,(ly:make-pitch -1 2 NATURAL))
        (esis . ,(ly:make-pitch -1 2 Q-SHARP))
        (essis . ,(ly:make-pitch -1 2 Q-Q-SHARP))
        (esssis . ,(ly:make-pitch -1 2 Q-Q-Q-SHARP))
        (eis . ,(ly:make-pitch -1 2 SHARP))
        (eiss . ,(ly:make-pitch -1 2 SHARP-Q))
        (eisss . ,(ly:make-pitch -1 2 SHARP-Q-Q))
        (eissss . ,(ly:make-pitch -1 2 SHARP-Q-Q-Q))
        (eisis . ,(ly:make-pitch -1 2 DOUBLE-SHARP))

        (feses . ,(ly:make-pitch -1 3 DOUBLE-FLAT))
        (fesfff . ,(ly:make-pitch -1 3 FLAT-Q-Q-Q))
        (fesff . ,(ly:make-pitch -1 3 FLAT-Q-Q))
        (fesf . ,(ly:make-pitch -1 3 FLAT-Q))
        (fes . ,(ly:make-pitch -1 3 FLAT))
        (ffffes . ,(ly:make-pitch -1 3 Q-Q-Q-FLAT))
        (fffes . ,(ly:make-pitch -1 3 Q-Q-FLAT))
        (ffes . ,(ly:make-pitch -1 3 Q-FLAT))
        (f . ,(ly:make-pitch -1 3 NATURAL))
        (fsis . ,(ly:make-pitch -1 3 Q-SHARP))
        (fssis . ,(ly:make-pitch -1 3 Q-Q-SHARP))
        (fsssis . ,(ly:make-pitch -1 3 Q-Q-Q-SHARP))
        (fis . ,(ly:make-pitch -1 3 SHARP))
        (fiss . ,(ly:make-pitch -1 3 SHARP-Q))
        (fisss . ,(ly:make-pitch -1 3 SHARP-Q-Q))
        (fissss . ,(ly:make-pitch -1 3 SHARP-Q-Q-Q))
        (fisis . ,(ly:make-pitch -1 3 DOUBLE-SHARP))

        (geses . ,(ly:make-pitch -1 4 DOUBLE-FLAT))
        (gesfff . ,(ly:make-pitch -1 4 FLAT-Q-Q-Q))
        (gesff . ,(ly:make-pitch -1 4 FLAT-Q-Q))
        (gesf . ,(ly:make-pitch -1 4 FLAT-Q))
        (ges . ,(ly:make-pitch -1 4 FLAT))
        (gfffes . ,(ly:make-pitch -1 4 Q-Q-Q-FLAT))
        (gffes . ,(ly:make-pitch -1 4 Q-Q-FLAT))
        (gfes . ,(ly:make-pitch -1 4 Q-FLAT))
        (g . ,(ly:make-pitch -1 4 NATURAL))
        (gsis . ,(ly:make-pitch -1 4 Q-SHARP))
        (gssis . ,(ly:make-pitch -1 4 Q-Q-SHARP))
        (gsssis . ,(ly:make-pitch -1 4 Q-Q-Q-SHARP))
        (gis . ,(ly:make-pitch -1 4 SHARP))
        (giss . ,(ly:make-pitch -1 4 SHARP-Q))
        (gisss . ,(ly:make-pitch -1 4 SHARP-Q-Q))
        (gissss . ,(ly:make-pitch -1 4 SHARP-Q-Q-Q))
        (gisis . ,(ly:make-pitch -1 4 DOUBLE-SHARP))

        (aeses . ,(ly:make-pitch -1 5 DOUBLE-FLAT))
        (aesfff . ,(ly:make-pitch -1 5 FLAT-Q-Q-Q))
        (aesff . ,(ly:make-pitch -1 5 FLAT-Q-Q))
        (aesf . ,(ly:make-pitch -1 5 FLAT-Q))
        (aes . ,(ly:make-pitch -1 5 FLAT))
        (afffes . ,(ly:make-pitch -1 5 Q-Q-Q-FLAT))
        (affes . ,(ly:make-pitch -1 5 Q-Q-FLAT))
        (afes . ,(ly:make-pitch -1 5 Q-FLAT))
        (a . ,(ly:make-pitch -1 5 NATURAL))
        (asis . ,(ly:make-pitch -1 5 Q-SHARP))
        (assis . ,(ly:make-pitch -1 5 Q-Q-SHARP))
        (asssis . ,(ly:make-pitch -1 5 Q-Q-Q-SHARP))
        (ais . ,(ly:make-pitch -1 5 SHARP))
        (aiss . ,(ly:make-pitch -1 5 SHARP-Q))
        (aisss . ,(ly:make-pitch -1 5 SHARP-Q-Q))
        (aissss . ,(ly:make-pitch -1 5 SHARP-Q-Q-Q))
        (aisis . ,(ly:make-pitch -1 5 DOUBLE-SHARP))

        (beses . ,(ly:make-pitch -1 6 DOUBLE-FLAT))
        (besfff . ,(ly:make-pitch -1 6 FLAT-Q-Q-Q))
        (besff . ,(ly:make-pitch -1 6 FLAT-Q-Q))
        (besf . ,(ly:make-pitch -1 6 FLAT-Q))
        (bes . ,(ly:make-pitch -1 6 FLAT))
        (bfffes . ,(ly:make-pitch -1 6 Q-Q-Q-FLAT))
        (bffes . ,(ly:make-pitch -1 6 Q-Q-FLAT))
        (bfes . ,(ly:make-pitch -1 6 Q-FLAT))
        (b . ,(ly:make-pitch -1 6 NATURAL))
        (bsis . ,(ly:make-pitch -1 6 Q-SHARP))
        (bssis . ,(ly:make-pitch -1 6 Q-Q-SHARP))
        (bsssis . ,(ly:make-pitch -1 6 Q-Q-Q-SHARP))
        (bis . ,(ly:make-pitch -1 6 SHARP))
        (biss . ,(ly:make-pitch -1 6 SHARP-Q))
        (bisss . ,(ly:make-pitch -1 6 SHARP-Q-Q))
        (bissss . ,(ly:make-pitch -1 6 SHARP-Q-Q-Q))
        (bisis . ,(ly:make-pitch -1 6 DOUBLE-SHARP))

)


%% set pitch names.
pitchnames = \quartertonearrowPitchNames
#(ly:parser-set-note-names parser pitchnames)


quartertonearrowGlyphs = #`(
        (1 . "accidentals.doublesharp")
        (3499/4000 . "accidentals.sharp.slashslash.stemstemstem")
    (2999/4000 . "accidentals.sharp.slashslashslash.stemstem")
    (2499/4000 . "accidentals.sharp.arrowup")
        (1/2 . "accidentals.sharp")
    (1499/4000 . "accidentals.sharp.arrowdown")
    (999/4000 . "accidentals.sharp.slashslashslash.stem")
    (499/4000 . "accidentals.sharp.slashslash.stem")
        (0 . "accidentals.natural")
    (-499/4000 . "accidentals.mirroredflat")
        (-999/4000 . "accidentals.mirroredflat.flat")
        (-1499/4000 . "accidentals.flat.arrowup")
        (-1/2 . "accidentals.flat")
        (-2499/4000 . "accidentals.flat.arrowdown")
        (-2999/4000 . "accidentals.flat.slash")
        (-3499/4000 . "accidentals.flat.slashslash")
        (-1 . "accidentals.flatflat")
)


On 7/4/09 1:14 PM, "Mark Polesky" <markpolesky@...> wrote:

>
> Mike Solomon wrote:
>> Good question!
>> I am trying to write clarinet multiphonics.>
>> http://userpages.umbc.edu/~emrich/chapter6-5.html
>
> I see. Here's a temporary solution, which could be automated with
> some ingenuity. The value 1.65 seems to work below, but it's not
> the value I would have expected to work. I might play around a
> little more with this, because as it stands, this would be
> cumbersome if you have a lot of these. Are you writing just a few
> here and there? By the way, what do the up and down arrows mean,
> eighth-tones? Also, is there always just one quarter-note-head in
> the middle? I assume that there can be more than one.
>
> \relative  c' {
>   <c
>   \tweak #'duration-log #2 \tweak #'X-extent #'(0 . 1.65) cis'
>   g'>1
> }
>
>> THANK YOU very much for your help!
>
> Happy to help.
> - Mark
>
>
>      
>




_______________________________________________
lilypond-user mailing list
lilypond-user@...
http://lists.gnu.org/mailman/listinfo/lilypond-user

Re: Overriding NoteHead stencil in a chord produces unwanted X offset

by Neil Puttock :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/7/4 Mark Polesky <markpolesky@...>:

> \relative  c' {
>  <c
>  \tweak #'duration-log #2 \tweak #'X-extent #'(0 . 1.65) cis'
>  g'>1
> }

Why not use an artificial harmonic instead?  They're automatically
centred on semibreves:

centreFill =
#(define-music-function (parser location note) (ly:music?)
   (if (eq? (ly:music-property note 'name) 'NoteEvent)
       (begin
         (set! (ly:music-property note 'articulations)
               (cons harmonic
                     (ly:music-property note 'articulations)))
         (set! (ly:music-property note 'tweaks)
               (acons 'stencil (lambda (grob) (grob-interpret-markup
                                               grob
                                               (make-musicglyph-markup
"noteheads.s2")))
                      (ly:music-property note 'tweaks)))))
   note)

\relative  c' { <c \centreFill cis' g'>1 }

Regards,
Neil


_______________________________________________
lilypond-user mailing list
lilypond-user@...
http://lists.gnu.org/mailman/listinfo/lilypond-user

Re: Overriding NoteHead stencil in a chord produces unwanted X offset

by Mark Polesky :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Neil Puttock wrote:
> Why not use an artificial harmonic instead?  They're
> automatically centred on semibreves...

Neil,

this is what I ended up doing; what do you think? As you probably
know, I'm a stickler for semantics, and strictly speaking, these
notes are not harmonics.

Also, why does (drop-right ...) work without having to add
#(use-modules (srfi srfi-1))?

- Mark


\version "2.13.0"

#(define (EventChord? music)
  (eq? (ly:music-property music 'name) 'EventChord))

#(define (centered-s2-head grob)
   (let* ((this-stil   (ly:note-head::print grob))
          (X-ext       (ly:stencil-extent this-stil 0))
          (Y-ext       (ly:stencil-extent this-stil 1))
          (font        (ly:grob-default-font grob))
          (s2-stil     (ly:font-get-glyph font "noteheads.s2"))
          (s2-expr     (ly:stencil-expr s2-stil))
          (s2-X-ext    (ly:stencil-extent s2-stil 0))
          (X-diff      (- (cdr X-ext) (cdr s2-X-ext)))
          (half-X-diff (/ X-diff 2))
          (new-X-ext   (cons (- (car s2-X-ext) half-X-diff)
                             (+ (cdr s2-X-ext) half-X-diff)))
          (new-stil    (ly:make-stencil s2-expr new-X-ext Y-ext)))
    new-stil))

multiphonics =
#(define-music-function (parser location music) (ly:music?)
  (music-map
   (lambda (x)
    (if (EventChord? x)
     (let* ((all-notes   (event-chord-notes x))
            (inner-notes (cdr (drop-right all-notes 1))))
       (map (lambda (note)
             (let ((tweaks (ly:music-property note 'tweaks)))
               (ly:music-set-property! note 'tweaks
                 (append tweaks `((stencil . ,centered-s2-head))))))
            inner-notes)
       x))
    x)
#{
  $music
#}))

% chords must be spelled from bottom to top in the ly file!
\relative  c' {
  % one at a time
  \multiphonics <c cis' g'>2

  % several in a row
  \multiphonics {
    <f fis' c'>2
    <c ais' cis g'>1
    <f dis' fis c'>1
  }
}


     

_______________________________________________
lilypond-user mailing list
lilypond-user@...
http://lists.gnu.org/mailman/listinfo/lilypond-user

centered-s2-head.png (4K) Download Attachment

Re: Overriding NoteHead stencil in a chord produces unwanted X offset

by Neil Puttock :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> this is what I ended up doing; what do you think? As you probably
> know, I'm a stickler for semantics, and strictly speaking, these
> notes are not harmonics.

It's more complicated, but definitely a worthwhile improvement on my
quick hack (which naturally doesn't work with minims).  I hope you'll
consider adding it to the LSR.

>
> Also, why does (drop-right ...) work without having to add
> #(use-modules (srfi srfi-1))?

I haven't the foggiest idea.  Perhaps it's being picked up from one of
the loaded .scm files.

Regards,
Neil


_______________________________________________
lilypond-user mailing list
lilypond-user@...
http://lists.gnu.org/mailman/listinfo/lilypond-user

Re: Overriding NoteHead stencil in a chord produces unwanted X offset

by Patrick McCarty-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Jul 9, 2009 at 2:08 PM, Neil Puttock<n.puttock@...> wrote:
>>
>> Also, why does (drop-right ...) work without having to add
>> #(use-modules (srfi srfi-1))?
>
> I haven't the foggiest idea.  Perhaps it's being picked up from one of
> the loaded .scm files.

It's loaded in scm/lily.scm, along with a few other modules.

-Patrick


_______________________________________________
lilypond-user mailing list
lilypond-user@...
http://lists.gnu.org/mailman/listinfo/lilypond-user