lilypond-user
[Top][All Lists]
Advanced

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

Re: Apply a music-function script to all elements of a list


From: Thomas Morley
Subject: Re: Apply a music-function script to all elements of a list
Date: Mon, 20 Feb 2017 23:26:07 +0100

2017-02-20 16:31 GMT+01:00 zaord <address@hidden>:
> Hello,
>
> I coded a script that adds markup. This function \ diag allows me to display
> a customized diagram (here left hand "button board" of an accordion) and I
> would like to apply it to all the elements of a chordmode {}.
> The script below works very well but only for a chordmode with 1 element.

I have my doubts. Usually TextScript is not allowed in
ChordNames-context, unless you include the relevant engraver.

> If
> the Chordmode have two elements, then the diagram is writing over himself
> but don't follow the score !
>
> In another hand, lilypond does not recreate new diagrams and the diagrams
> are superpozed ...

You need to iterate your function over the argument applying it to
every event-chord found.

Something at the lines of

diag=
#(define-music-function (parser location music)
  (ly:music?)
  (music-map
    (lambda (m)
     (if (music-is-of-type? m 'event-chord)
      #{ <>^\markup \complete #m $m #}
      m))
    music))

And later:

\new ChordNames \with { \consists "Text_engraver" } \diag \chordNames


HTH,
  Harm



reply via email to

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