lilypond-user
[Top][All Lists]
Advanced

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

Does \balloonText only work inside chords?


From: Urs Liska
Subject: Does \balloonText only work inside chords?
Date: Mon, 18 Jun 2018 11:56:26 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

According to NR 1.7.2 \balloonText is "used like \tweak, typically within chords, to attach text to an individual note." I have two questions to this:

1) If it were used like \tweak it would affect the element *following after* the command, isn't it? But in

<c, g'-\balloonText #'(-2 . -2) \markup { "I'm a note head" } c>2.

(from the NR) the balloon text is applied to the g', not the c''. So wouldn't it be more correct to say that it works "like an articulation"?  also it's an event-function. Additionally, if I'm not mistaken this adds an entry to the 'articulations list, so it wouldn't be possible to add a balloon to, say, a staccato, isn't it, only a rhythmic-event?

2) Additionally, it seems that \balloonText only works within chords, which seems sort-of strange to me

Modified from an example in NR 1.7.2:

\version "2.19.80"

\new Voice \with { 
  \consists "Balloon_engraver" 
}
\relative {
 \displayMusic { <c' -\balloonText #'(-2 . -2) \markup { "I'm a note head" } >}
 \displayMusic { c' -\balloonText #'(-2 . -2) \markup { "I'm a note head" }}
}

This prints

(make-music
  'SequentialMusic
  'elements
  (list (make-music
          'EventChord
          'elements
          (list (make-music
                  'NoteEvent
                  'duration
                  (ly:make-duration 2)
                  'articulations
                  (list (make-music
                          'AnnotateOutputEvent
                          'text
                          (markup #:line (#:simple "I'm a note head"))
                          'Y-offset
                          -2
                          'X-offset
                          -2))
                  'pitch
                  (ly:make-pitch 0 0))))))

(make-music
  'SequentialMusic
  'elements
  (list (make-music
          'NoteEvent
          'articulations
          (list (make-music
                  'AnnotateOutputEvent
                  'text
                  (markup #:line (#:simple "I'm a note head"))
                  'Y-offset
                  -2
                  'X-offset
                  -2))
          'duration
          (ly:make-duration 2)
          'pitch
          (ly:make-pitch 0 0))))


    

which looks fine to me, but it fails with the following error:

ERROR: In procedure symbol->string:
ERROR: Wrong type argument in position 1 (expecting symbol): ()
Exited with return code 1.

Am I misunderstanding anything here? What I ultimately want to achieve is:

  • There's a music function that takes a ly:music? argument
  • single out either the argument or its first element (if sequential)
  • "tweak" the music (i.e. the element following the function in the input) and add a balloon text.

I see how I could take the music and create/add-to the articulations property. But I'm not sure how to do that when the music is not a chord, or even a \tweak-able element: In

    { c' -\myBalloon d' e' }

the balloon should be attached to the d', and in

    { c' -\myBalloon -! d' }

I would want the balloon to be attached to the -! articulation while in

    { <c' g' -\myBalloon c''> }

it should be attached to the middle g', not the upper c''.

Any explanation or advice? Thanks Urs


reply via email to

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