lilypond-user
[Top][All Lists]
Advanced

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

Re: Custom articulations/pitched single-note trills


From: Neil Puttock
Subject: Re: Custom articulations/pitched single-note trills
Date: Fri, 26 Dec 2008 16:06:36 +0000

2008/12/21 gnomino <address@hidden>:
>> I'm not top posting
>
> Thanks for your help.
>
> I was just wondering, is there any reason that \pitchedTrill only works with
> trill spanners?

That's just the way it's coded in the Pitched_trill_engraver; there's
no way of using it for any other purpose without recoding or hacking
trill spanners (see below).

> I soon discovered that I needed to typeset pitched mordents in
> addition to pitched trills, and since it would be tedious to create a set of
> \artSharp, \artNatural, \artFlat, \artSharpSharp, etc. for every 
> articulation, I
> came up with the following general function:

I've never seen a mordent typeset this way; it's customary to put the
pitch above or below the articulation.  Nevertheless, here's a hack
using a trill spanner which will allow you to typeset any articulation
with a parenthesized pitch:

pitchedArtic =
#(define-music-function (parser location str main-note paren next-note)
  (string? ly:music? ly:music? ly:music?)
  (let* ((get-notes (lambda (ev-chord)
          (filter
           (lambda (m) (eq? 'NoteEvent (ly:music-property m 'name)))
           (ly:music-property ev-chord 'elements))))
         (paren-notes (get-notes paren)))

    (if (pair? paren-notes)
  (begin
    (let*
        ((paren-pitch (ly:music-property (car paren-notes) 'pitch))
         (forced (ly:music-property (car paren-notes ) 'force-accidental #f)))

      (if (ly:pitch? paren-pitch)
    (begin
      (ly:music-set-property! main-note 'elements
            (cons (make-music
             'TrillSpanEvent
             'force-accidental forced
             'pitch paren-pitch
             'span-direction START)
            (ly:music-property main-note 'elements)))

      (ly:music-set-property! next-note 'elements
            (cons stopTrillSpan
            (ly:music-property next-note 'elements))))
    (begin
      (ly:warning (_ "Second argument should be single note: "))
      (display paren-notes)))
      )))
    (make-music 'SequentialMusic
    'origin location
    'elements (list #{
          \once \override TrillSpanner #'style = #'dashed-line
          \once \override TrillSpanner #'dash-period = #-1
          \once \override TrillSpanner #'(bound-details left text) =
            #(make-musicglyph-markup (format "scripts.~a" $str))
          #}
        main-note next-note))))

\relative c' {
  \pitchedArtic "mordent" cis b
  \pitchedArtic "prall" c des
  c2
}

Regards,
Neil




reply via email to

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