lilypond-user
[Top][All Lists]
Advanced

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

Concatenating markup fragments in a function


From: Andrew Bernard
Subject: Concatenating markup fragments in a function
Date: Tue, 17 Sep 2019 21:43:58 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

Sometimes in my scores I need to indicate a note name, with accidental, for example for very very high notes, just to aid the player. Sometimes I use a list to help out with very densely packed chords. [Don't blame me for this practice - it's my composer colleague!]

I am perfectly well aware I can user a markup such as "C#" with unicode accidentals. Fine. But I find the accidentals to be too small to read easily in my contexts, and the point of this is to enhance readability, so I have a function which uses a separate concatenation of an accidental so I can make the size larger. This works well.

\version "2.19.83"

#(define-markup-command (note-names layout props note-name accidental)
   (markup? markup?)
   "Provide note name for clarity."
   (interpret-markup layout props
     #{
       \markup {
         \override #'(font-name . "Latin Modern Sans Demi Cond")
         \concat
         {
           \fontsize #-1 \vcenter #note-name \hspace #.2
           \fontsize #-4 #accidental
         }
       }
     #}))


example:

  c'4
  ^\markup \note-names "C" \natural

[Using this function also gives me the possibilty to adapt it easily to use smufl accidentals which is something I also need, so there re multiple reasons for having this.]

But having made this function a while ago, I am going through some old scores which have lists of note names, like this:

_\markup \note-names "[A♯ B♮ C♯ D♯ F♯ G♯]"

Now what I would like to do is modify this to be able to say, in the same vein as the single name function above, for example:

 <c' e' gis'>
  ^\markup \note-names-multiple #'(("C" . \natural) ("E" . \natural) ("G" . \sharp))


Here is my (very poor) sketch of what I need:

\version "2.19.83"

#(define-markup-command (note-names-multiple layout props note-names-list)
   (list?)
   "Provide multiple note names for clarity."
   (let ((txt ""))
     (let loop ((l note-names-list))
       (if (not (null? l))
           (begin
            (display (car l))
            (newline)
            (set! txt (string-append txt (car (car l))))
            (set! txt (string-append txt " "))
            (display txt) (newline)
            (loop (cdr l))
            )
           ))
     (interpret-markup layout props
       (markup txt)
       )
     ))

Obviously this is not complete. But I have come to a dead halt not knowing how I can glue bits of markup, rather than text, together inside the let loop, as per the single shot in the first function.

[Pardon me if this attempt looks like complete nonsense - I banged my head badly with much blood on the bandsaw in my workshop today and I confess I may not be thinking straight! Dear me.]


Andrew














reply via email to

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