\balloonText applied to single note errors with symbol->string ??

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

\balloonText applied to single note errors with symbol->string ??

Thomas Morley-2
Hi,

the code below

\layout { \context { \Voice \consists "Balloon_engraver" } }
{ c'-\balloonText #'(2 . 0) \markup { "1" } }

returns (in 2.21.0):
ERROR: In procedure symbol->string:
ERROR: Wrong type argument in position 1 (expecting symbol): ()

2.18.2 gives a more useful message:
/home/hermann/lilypond/usr/share/lilypond/current/scm/lily-library.scm:242:8:
In procedure symbol->string in expression (process-procedure book
paper ...):
/home/hermann/lilypond/usr/share/lilypond/current/scm/lily-library.scm:242:8:
Wrong type argument in position 1 (expecting symbol): ()

Though, I've no clue where symbol->string comes into the game...

Ofcourse the NR recommends to use balloonText _inside_ of chords, and
indeed the problem goes away, wrapping the note in an event-chord.
But shouldn't it work as a postevent to a single note, too??


Btw, it's present in all tested versions down to 2.12.3

Cheers,
  Harm

_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
dak
Reply | Threaded
Open this post in threaded view
|

Re: \balloonText applied to single note errors with symbol->string ??

dak
Thomas Morley <[hidden email]> writes:

> Hi,
>
> the code below
>
> \layout { \context { \Voice \consists "Balloon_engraver" } }
> { c'-\balloonText #'(2 . 0) \markup { "1" } }
>
> returns (in 2.21.0):
> ERROR: In procedure symbol->string:
> ERROR: Wrong type argument in position 1 (expecting symbol): ()
>
> 2.18.2 gives a more useful message:
> /home/hermann/lilypond/usr/share/lilypond/current/scm/lily-library.scm:242:8:
> In procedure symbol->string in expression (process-procedure book
> paper ...):
> /home/hermann/lilypond/usr/share/lilypond/current/scm/lily-library.scm:242:8:
> Wrong type argument in position 1 (expecting symbol): ()
>
> Though, I've no clue where symbol->string comes into the game...
In lily/balloon-engraver.cc

> Ofcourse the NR recommends to use balloonText _inside_ of chords, and
> indeed the problem goes away, wrapping the note in an event-chord.
> But shouldn't it work as a postevent to a single note, too??

The implementation does not work with separate AnnotateOutput events
(more exactly, they require specifying the particular grob type to use
since usually a number of grobs could be annotated).  One could try to
capture all rhythmic-events and annotate them all.  It's all reasonably
icky stuff that should at one point of time be upgraded to look like
what we do with footnotes.  As a stopgap measure, one could use the
following patch for a bit nicer behavior.




--
David Kastrup

_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond

0001-Warn-about-balloonText-outside-of-chords.patch (966 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: \balloonText applied to single note errors with symbol->string ??

Thomas Morley-2
Am Sa., 28. Sept. 2019 um 21:54 Uhr schrieb David Kastrup <[hidden email]>:

>
> Thomas Morley <[hidden email]> writes:
>
> > Hi,
> >
> > the code below
> >
> > \layout { \context { \Voice \consists "Balloon_engraver" } }
> > { c'-\balloonText #'(2 . 0) \markup { "1" } }
> >
> > returns (in 2.21.0):
> > ERROR: In procedure symbol->string:
> > ERROR: Wrong type argument in position 1 (expecting symbol): ()
> >
> > 2.18.2 gives a more useful message:
> > /home/hermann/lilypond/usr/share/lilypond/current/scm/lily-library.scm:242:8:
> > In procedure symbol->string in expression (process-procedure book
> > paper ...):
> > /home/hermann/lilypond/usr/share/lilypond/current/scm/lily-library.scm:242:8:
> > Wrong type argument in position 1 (expecting symbol): ()
> >
> > Though, I've no clue where symbol->string comes into the game...
>
> In lily/balloon-engraver.cc
>
> > Ofcourse the NR recommends to use balloonText _inside_ of chords, and
> > indeed the problem goes away, wrapping the note in an event-chord.
> > But shouldn't it work as a postevent to a single note, too??
>
> The implementation does not work with separate AnnotateOutput events
> (more exactly, they require specifying the particular grob type to use
> since usually a number of grobs could be annotated).  One could try to
> capture all rhythmic-events and annotate them all.  It's all reasonably
> icky stuff that should at one point of time be upgraded to look like
> what we do with footnotes.  As a stopgap measure, one could use the
> following patch for a bit nicer behavior.

Hi David,

thanks for the explanations.
A warning directly pointing to the problem is of course very helpful.

Though, how about making balloonText work outside of chords? Therefore
one could provide an optional default argument, i.e. NoteHead, for
in-chord usage.
balloonGrobText could rely on it then.
See the code below.
The persisting problem is ofcourse how to annotate a single item of
multiple others of the same kind in an event-chord?
I found no nice way to do so, neither with current state of master nor
with my suggestion.

\version "2.21.0" %% works for lower versions as well

balloonText-test =
#(define-event-function (grob offset text)
  ((symbol? 'NoteHead) number-pair? markup?)
   (_i "Attach @var{text} at @var{offset} (use like @code{\\tweak})")
   (make-music 'AnnotateOutputEvent
               'symbol grob
               'X-offset (car offset)
               'Y-offset (cdr offset)
               'text text))

balloonGrobText-test =
#(define-music-function (grob-name offset text)
   ((symbol? 'NoteHead) number-pair? markup?)
   (_i "Attach @var{text} to @var{grob-name} at offset @var{offset}
 (use like @code{\\once})")
   (make-event-chord (list (balloonText-test grob-name offset text))))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% EXAMPLES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\layout { \context { \Voice \consists "Balloon_engraver" } }

{
    \balloonLengthOn
    %% "post-event" for NoteHead (default), Flag, Rest, Fingering, NoteHead in
    %% event-chord
    c'4-\balloonText-test #'(1 . 5) "NoteHead"
    d'8-\balloonText-test Flag #'(2 . -2) "Flag"
    r-\balloonText-test Rest #'(2 . 4) "Rest"
    e'4-1-\balloonText-test Fingering #'(1 . 5) "Fingering"
    <d' f'-\balloonText-test #'(2 . -2) "NoteHead" a'>
}

{
  %% "\once \override" for Stem, Rest, NoteHead (default)
  \balloonGrobText-test Stem #'(3 . 4) "I'm a Stem"
  b4
  \balloonGrobText-test Rest #'(-4 . -4) "I'm a rest"
  r
  \balloonGrobText-test #'(4 . -4) "I'm a note head"
  c'
  %% How to annotate a single Item in an event-chord, like one Fingering among
  %% multiple ones?
  %% balloonGrobText-test catches all, \balloonText-test always the NoteHead
  %%   (as well as the default \balloonGrobText and \balloonText)
  \balloonGrobText-test StringNumber #'(1 . 1) "I'm a string number"
  <
    e'\2 -\balloonText-test StringNumber #'(1 . 2) "Fail for StringNumber"
    g'\4
  >
}


Thanks,
  Harm

_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
dak
Reply | Threaded
Open this post in threaded view
|

Re: \balloonText applied to single note errors with symbol->string ??

dak
Thomas Morley <[hidden email]> writes:

> Am Sa., 28. Sept. 2019 um 21:54 Uhr schrieb David Kastrup <[hidden email]>:
>>
>> Thomas Morley <[hidden email]> writes:
>>
>> > Hi,
>> >
>> > the code below
>> >
>> > \layout { \context { \Voice \consists "Balloon_engraver" } }
>> > { c'-\balloonText #'(2 . 0) \markup { "1" } }
>> >
>> > returns (in 2.21.0):
>> > ERROR: In procedure symbol->string:
>> > ERROR: Wrong type argument in position 1 (expecting symbol): ()
>> >
>> > 2.18.2 gives a more useful message:
>> > /home/hermann/lilypond/usr/share/lilypond/current/scm/lily-library.scm:242:8:
>> > In procedure symbol->string in expression (process-procedure book
>> > paper ...):
>> > /home/hermann/lilypond/usr/share/lilypond/current/scm/lily-library.scm:242:8:
>> > Wrong type argument in position 1 (expecting symbol): ()
>> >
>> > Though, I've no clue where symbol->string comes into the game...
>>
>> In lily/balloon-engraver.cc
>>
>> > Ofcourse the NR recommends to use balloonText _inside_ of chords, and
>> > indeed the problem goes away, wrapping the note in an event-chord.
>> > But shouldn't it work as a postevent to a single note, too??
>>
>> The implementation does not work with separate AnnotateOutput events
>> (more exactly, they require specifying the particular grob type to use
>> since usually a number of grobs could be annotated).  One could try to
>> capture all rhythmic-events and annotate them all.  It's all reasonably
>> icky stuff that should at one point of time be upgraded to look like
>> what we do with footnotes.  As a stopgap measure, one could use the
>> following patch for a bit nicer behavior.
>
> Hi David,
>
> thanks for the explanations.
> A warning directly pointing to the problem is of course very helpful.
>
> Though, how about making balloonText work outside of chords? Therefore
> one could provide an optional default argument, i.e. NoteHead, for
> in-chord usage.

Well, that's not really a solution rather than papering over a problem
in a manner that will happen to match expected use in the majority of
uses.  Make no mistake, it would decrease the amount of problem reports
but be quite confusing when it doesn't do the trick.

For just bypassing the warning, one could just put in NoteHead fixedly
in the music for the \balloonText case and be done without changing any
interface.  But the result is a missing warning and thus unchanged code.

--
David Kastrup

_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond