lilypond-user
[Top][All Lists]
Advanced

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

Re: Not Nice Review of the LilyPond


From: Thomas Morley
Subject: Re: Not Nice Review of the LilyPond
Date: Sun, 2 Dec 2018 15:26:44 +0100

Am So., 2. Dez. 2018 um 14:01 Uhr schrieb Sandro Santilli <address@hidden>:
>
> On Sun, Dec 02, 2018 at 11:01:36AM +0000, J Martin Rushton wrote:
>
> > "LilyPond source files appear to be written in a custom programming
> > language whose grammar is never discussed."
> > - I'm afraid this one is bang on target.
>
> Hey, I have the exact same feeling. Very obscure way to put chords
> in parenthesis (I asked yesterday).

I beg to differ.
It's the consequence of entering ChordNames as music and the
possibility to have them in midi, let them display as notes in Staff
etc
To keep those features you may try:

parenthesize =
#(define-music-function (dir arg) ((symbol? #f) ly:music?)

#{
  $(if dir
       #{
       \once \override ParenthesesItem.stencils =
         #(lambda (grob)
            (let ((lp (ly:font-get-glyph
                        (ly:grob-default-font grob)
                        "accidentals.leftparen"))
                  (rp (ly:font-get-glyph
                        (ly:grob-default-font grob)
                        "accidentals.rightparen")))
              (cond ((eq? dir 'left)
                     (list lp empty-stencil))
                    ((eq? dir 'right)
                     (list empty-stencil rp))
                    (else
                      (ly:warning "unknown direction: \"~a\", ignoring" dir)
                      (list lp rp)))))
       #})
%% the defaulr parenthesize
  $(if (memq 'event-chord (ly:music-property arg 'types))
       ;; arg is an EventChord -> set the parenthesize property
       ;; on all child notes and rests
       (for-each
        (lambda (ev)
          (if (or (memq 'note-event (ly:music-property ev 'types))
                  (memq 'rest-event (ly:music-property ev 'types)))
              (set! (ly:music-property ev 'parenthesize) #t)))
        (ly:music-property arg 'elements))
       ;; No chord, simply set property for this expression:
       (set! (ly:music-property arg 'parenthesize) #t))
  $arg
#})


\new ChordNames
  \chordmode {
    \override ChordName.stencil =
    #(lambda (grob)
      (box-stencil
        (ly:text-interface::print grob)
        0 0))

      %% default
    \parenthesize c1
    %% left paren
    \parenthesize #'left c:7
    %% right paren
    \parenthesize #'right d:5+
    %% issues a warning and both parentheses are done
    \parenthesize #'whatever ees
  }

@ David:
Would this be a useful extension/replacement of our current default
\parenthesize?

Otoh,
it's often requested to enter ChordNames as markup without any nice features.
For this pupose I made
http://lsr.di.unimi.it/LSR/Item?u=1&id=1057
Currently unapproved (as you see it has a pretty verbose description lol)...
It's usable, though.
You could enter:

  \new ChordMarkup
    \lyricmode {
      "C:13" C:alt "C:7.alt" "Gm:7.(b5)/F"
      (C D) [Cm Dm]
    }

Getting the attached output

Cheers,
  Harm

Attachment: atest-83-chord-markup.png
Description: PNG image


reply via email to

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