lilypond-user
[Top][All Lists]
Advanced

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

Re: Help a newb: Formatting custom instrument names


From: Michael Blankenship
Subject: Re: Help a newb: Formatting custom instrument names
Date: Tue, 8 Dec 2020 14:57:01 -0500

FOLLOW UP #2:
​Added Lukas's code for instrument names to "draw-staff-symbols" and analogous statements to the layout block in that file. The columnClef code remains, but the layout statements are commented out. It's very close to being correct, but 3 issues that come to mind:
​1) I'd prefer the columns were right-aligned instead of centered, but I tried several times and couldn't figure out how to make that change.
​2) I need to be able to shift the columns horizontally to
​3) how do I shift the bar numbers up above the staff so they don't collide with the vowel clef?
​Finally: Is there a way to set up the code so that it scales with the size of the staff spaces?

​Cheers,
​MB
On Dec 8 2020, at 2:06 pm, Michael Blankenship <blankens10@gmail.com> wrote:
FOLLOW UP:
​I partially solved my own problem. I added the \columnClef statement to the layout block in "draw-staff-symbol.ily", on the line below \Staff. It works now, but another reasons I thought instrumentName would work better is that it's very hard to read the vowel clef when it's printed on top of the staff, instead of just before it. I can't seem to get the "officially a clef" version to shift to just left of the staff.
​Would going back to an instrument name based construction make this simpler and easier? How would I modify the code to do that?

On Dec 8 2020, at 1:53 pm, Michael Blankenship <blankens10@gmail.com> wrote:
Lukas and Leo,
​Thanks for the response! I tried to frame the original question as simply as possible, so I left some things out that have now become relevant. One of the reasons I was trying to use instrument names is that I actually want to use a more extensive version of the "clef" before the first system, and a simplified version for the rest of the systems. The clef is for a larger project I'm working on to transcribe the sounds of lyrics as musical objects. So the clef lists the vowels that each space of the staff represents. So, they could be encoded as clefs, and one would just have to specify a different clef for the first system, but if they're encoded as instrument names, the software would automatically do the change in clef. I don't know enough to know if one way is better than the other, but whichever way, I still am having issues.
I put the latest code Lukas sent out into the larger context of the lyric notation library, and every time I tried adding:
​           \columnClef \markuplist { i ɪ ɛ æ ʌ ɑ ɝ ɔ oʊ ʊ u }
​to the lyric-notation.ily file, it either produced an output that just didn't have the clef, or it threw an error, usually an "unexpected" exception like:
​Parsing...
/Users/blankens10/Documents/GitHub/lyric-notation-master/lyric-notation.ily:73:36: error: syntax error, unexpected SYMBOL
           \columnClef \markuplist
                                   i ɪ ɛ æ ʌ ɑ ɝ ɔ oʊ ʊ u
/Users/blankens10/Documents/GitHub/lyric-notation-master/lyric-notation.ily:73:36: error: not a note name: i
           \columnClef \markuplist
                                   i ɪ ɛ æ ʌ ɑ ɝ ɔ oʊ ʊ u
​etc.
Here's the link for the lyric notation library, so maybe you can help me figure out where to put the code so it works correctly?
​I added all Lukas's code through the definition of columnClef to "draw-staff-symbol.ily" and I figured the line
​         \columnClef \markuplist { i ɪ ɛ æ ʌ ɑ ɝ ɔ oʊ ʊ u }
​should be added to "lyric-notation.ily" somewhere. But every place I tried it, it didn't work. I wasn't sure if it should go inside the \with statement under \new RhythmicStaff, or if it should go in a context block somewhere?
​Ugg, being a dumb newb is such an impotent feeling, one that I'm not used to being on this side of.
​Any additional help would be greatly appreciated.
​Cheers,
​Michael

On Dec 8 2020, at 4:48 am, Lukas-Fabian Moser <lfm@gmx.de> wrote:
Hi Leo,

Am 07.12.20 um 23:36 schrieb Leo Correia de Verdier:
> I’m not sure if this is an interesting suggestion, but if you want this as the actual clef you could write
> %%%%%%%%%%%%%%
> \once \override Staff.Clef.stencil = #ly:text-interface::print
>    \once \override Staff.Clef.text = \markup {
>      \override #'(font-size . -6.5)
>      \unit-height-column { First second third fourth fifth sixth seventh eighth ninth tenth eleventh } }
>    \once \override Staff.Clef.Y-offset = #5
>    \clef treble % or whatever
> %%%%%%%%%%%%%%

That's an excellent suggestion - I remember when I read Michael's
question I thought: If we want "a sort of clef", we should use a \clef
for it. But of course that changes the layout (even though one might use
a whiteout property to hide the staff lines).

I moved your logic into a function (and replaced your explicit Y-offset
by 0 combined with Y-centering the markup):

\version "2.21.80"

#(define-markup-command (force-unit-height layout props arg) (markup?)
   (let* ((y-centered-arg (markup #:general-align 1 0 arg))
          (stil (interpret-markup layout props y-centered-arg))
          (x (ly:stencil-extent stil 0))
          (y (cons -1/2 1/2)))
     (ly:stencil-outline stil (make-filled-box-stencil x y))))

#(define-markup-command (unit-height-column layout props args)
(markup-list?)
   (interpret-markup layout props #{
     \markup {
       \override #'(baseline-skip . 0)
       \center-column \force-unit-height #args
                     } #} ))

columnClef =
#(define-music-function (contents) (markup-list?)
   #{
     \once \override Staff.Clef.stencil = #ly:text-interface::print
     \once \override Staff.Clef.Y-offset = 0
     \once \override Staff.Clef.text = \markup {
       \override #'(font-size . -6.5)
       \general-align #Y #CENTER
       \unit-height-column #contents
     }
   #})

\new Staff {
  \columnClef \markuplist { first second third fourth }
  a'4
}

Lukas

reply via email to

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