Re: writing text on the staff & using numbers in music functions

2016-05-02 Thread Flaming Hakama by Elaine
> > But I could not get it to move down onto the staff.  As described in
> >
http://www.lilypond.org/doc/v2.19/Documentation/notation/formatting-text#text-alignment
> > "Vertical alignment is a bit more complex. As stated above, markup
objects
> > can be moved as a whole; however, it is also possible to move specific
elements
> > inside a markup block."
> >
> > It took me a while to realize this meant that the techniques using
> > raise, lower, translate, general-align and translate-scaled
> > will NOT affect the "markup object moved as a whole",
> > but rather affect the relative position of objects within the markup
object.
...
> Well, it's not true, see:
...
> Printing text in Staff depends of the settings for TextScript
>
> {
>   \override TextScript.outside-staff-priority = #'()
>   \override TextScript.staff-padding = #'()
>   s1^\markup {
> \line { \circle "."  "This is the anchor" }
> \translate #'(-25 . 0) \with-dimensions #empty-interval
> #empty-interval "xy"
>   }
> }


That's great, thanks for demonstrating that.
Just curious, but how did you ever learn this?

It seems doubtful that one would have arrived at this insight using the
manuals.


Trying to find this info in the docs, the formatting-text page
http://lilypond.org/doc/v2.19/Documentation/learning/moving-objects
starts out with a link to the LM about moving objects.

But neither that page, nor the NR section about text alignment
http://www.lilypond.org/doc/v2.19/Documentation/notation/formatting-text#text-alignment
mentions the outside-staff-priority.


Searching for this property, it can be found in
Tweaking Output > Placement of Objects > Outside-staff objects
http://lilypond.org/doc/v2.19/Documentation/learning/outside_002dstaff-objects

But even here, there is no mention of how to get outside-staff objects
placed in the staff.

Of course, based on the naming convention "outside-staff objects", it seems
unlikely that you could place an outside-staff object within the staff.
So, maybe this is a silly discussion to begin with.  However, since it is
possible, I wonder if it should be mentioned?


"Objects with the lower value of the outside-staff-priority property are
placed nearer to the staff, and other outside-staff objects are then raised
as far as necessary to avoid collisions. The outside-staff-priority is
defined in the grob-interface and so is a property of all layout objects.
By default it is set to #f for all within-staff objects, and to a numerical
value appropriate to each outside-staff object when the object is created."

If anything, one might guess that in order to get an outside staff object
placed in the staff, you would specify it's outside-staff-priority as "#f",
since the above quoted passase says that's the default for within-staff
objects.

Yet, the example you provide sets TextScript.outside-staff-priority to an
empty list.  Is an empty list equivalent to "#f"?


Then there is the matter of staff-padding.  The LM section on grob sizing
mentions it with respect to vertical alignment of dynamics and refers to
the section on Collisions of objects
http://lilypond.org/doc/v2.19/Documentation/learning/collisions-of-objects

Within there, it is described in the section on Moving Objects
http://lilypond.org/doc/v2.19/Documentation/learning/moving-objects

"staff-padding applies only to those objects which are always set outside
the staff – it controls the minimum distance from the staff to the
outside-staff object."

This also seems to imply that an outside-staff object cannot be set within
the staff.

If you read this literally--but keeping in mind that you've demonstrated
that it is possible to set text within the staff--it is saying that
staff-padding does not apply to text markup (since text markup is not
always set outside the staff.)

This would be more consistent if it said, "staff-padding applies only to
outside-staff objects – it controls the minimum distance from the staff to
the outside-staff object."  In which case the discrepancy is only in the
naming convention, since an outside-staff object is not necessarily always
set outside the staff.


And in the section specifically on the staff-padding property:

"staff-padding can be used to align objects such as dynamics along a
baseline at a fixed distance from the staff, when no other notation forces
them further from the staff.""

Which is to say, it is unclear why and how this relates to setting text
within the staff.


So, it is not very clear where one would learn that both of these are
necessary:

  \override TextScript.outside-staff-priority = #'()
  \override TextScript.staff-padding = #'()


In any case, thanks for your help.  What would I do without this list?



David Elaine Alt
415 . 341 .4954   "*Confusion is
highly underrated*"
ela...@flaminghakama.com
self-immolation.info
skype: flaming_hakama
Producer ~ Composer ~ Instrumentalist

Re: writing text on the staff & using numbers in music functions

2016-03-31 Thread Thomas Morley
2016-03-31 6:26 GMT+02:00 Flaming Hakama by Elaine :
> \version "2.19.15"
>
> %{
> I first tried adding parenthesis as text to the multi-measure rest, as
> described in
> http://www.lilypond.org/doc/v2.18/Documentation/snippets/text#text-multi_002dmeasure-rest-markup
> since it claims to center text.  Which it does:
>
> %}
>
> #(define (white-under grob) (grob-interpret-markup grob
>   (markup #:vcenter #:whiteout #:pad-x 1 (ly:grob-property grob 'text
>
> setInlineMMRN = {
> \set Score.skipBars = ##t
> \override Score.MultiMeasureRest.expand-limit = 1
> \override Score.MultiMeasureRest.minimum-length = #30
> }
>
> inlineMMRN = {
> \once \override MultiMeasureRest.layer = #-2
> \once \override MultiMeasureRestNumber.layer = #-1
> \once \override MultiMeasureRestNumber.Y-offset = #0
> \once \override MultiMeasureRestNumber.stencil = #white-under
> }
>
> timeParens = \markup { \huge "(" \magnify #1.4 " " \huge ")" }
>
> {
> \setInlineMMRN
> \inlineMMRN R1*4^\markup { \timeParens }
> }

Why add MultiMeasureRestText?
You already create a new stencil for MultiMeasureRestNumber, add the
parentheses there:

#(define (white-under grob)
  (grob-interpret-markup grob
#{
  \markup
\whiteout
\pad-x #-0.2
\line \vcenter {
  \huge \normal-text "("
  #(ly:grob-property grob 'text)
  \huge \normal-text  ")"
  }
#}))

setInlineMMRN = {
\set Score.skipBars = ##t
\override Score.MultiMeasureRest.expand-limit = 1
\override Score.MultiMeasureRest.minimum-length = #30
}

inlineMMRN = {
\once \override MultiMeasureRest.layer = #-2
\once \override MultiMeasureRestNumber.layer = #-1
\once \override MultiMeasureRestNumber.Y-offset = #0
\once \override MultiMeasureRestNumber.stencil = #white-under
}

{
\setInlineMMRN
\inlineMMRN
R1*4
}

This could even be shortened...

> %{
>
> But I could not get it to move down onto the staff.  As described in
> http://www.lilypond.org/doc/v2.19/Documentation/notation/formatting-text#text-alignment
> "Vertical alignment is a bit more complex. As stated above, markup objects
> can be moved as a whole;
> however, it is also possible to move specific elements inside a markup
> block."
>
> It took me a while to realize this meant that the techniques using
> raise, lower, translate, general-align and translate-scaled
> will NOT affect the "markup object moved as a whole",
> but rather affect the relative position of objects within the markup object.
>
> I also learned that these techniques, in addition to never placing text on
> the staff,
> will not place text to the left of the anchor point.
>
> Perhaps this section should include a comment to the effect of:
>
> "The commands raise, lower, translate, general-align and translate-scaled
> used within a markup block are limited to printing text
> outside the staff and to the right of the anchor point."
> %}

Well, it's not true, see:

\markup {
   \line { \circle "."  "This is the anchor" }
   \translate #'(-25 . 3) \with-dimensions #empty-interval #empty-interval "xy"
 }

Printing text in Staff depends of the settings for TextScript

{
  \override TextScript.outside-staff-priority = #'()
  \override TextScript.staff-padding = #'()
  s1^\markup {
\line { \circle "."  "This is the anchor" }
\translate #'(-25 . 0) \with-dimensions #empty-interval
#empty-interval "xy"
  }
}


> %  The documentation for moving objects suggests using extra-offset.
> %  http://lilypond.org/doc/v2.19/Documentation/learning/moving-objects
> %  Likewise, this does not work on the multi-measure rest.
>
> \setInlineMMRN
> \inlineMMRN
> \once \override TextScript #'extra-offset = #'(0 . -3.7)
> R1*8^\timeParens
> }

A markup added to a MMR is of type MultiMeasureRestText _not_ TextScript, see:

{
  \once \override TextScript #'extra-offset = #'(0 . -3.7)
  R1^"foo"
  \once \override MultiMeasureRestText #'extra-offset = #'(0 . -3.7)
  R1^"foo"
}

No need for all the other stuff...
> [...]

HTH,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


writing text on the staff & using numbers in music functions

2016-03-30 Thread Flaming Hakama by Elaine
\version "2.19.15"

%{

Thanks to everyone who suggested looking at LSR-753 for the "Jazz style"
multi-measure rest.
That is substantially what I want.


In attempts to add parenthesis in the staff around the number within the
staff, I ran into several problems.

I first tried adding parenthesis as text to the multi-measure rest, as
described in
http://www.lilypond.org/doc/v2.18/Documentation/snippets/text#text-multi_002dmeasure-rest-markup
since it claims to center text.  Which it does:

%}

#(define (white-under grob) (grob-interpret-markup grob
  (markup #:vcenter #:whiteout #:pad-x 1 (ly:grob-property grob 'text

setInlineMMRN = {
\set Score.skipBars = ##t
\override Score.MultiMeasureRest.expand-limit = 1
\override Score.MultiMeasureRest.minimum-length = #30
}

inlineMMRN = {
\once \override MultiMeasureRest.layer = #-2
\once \override MultiMeasureRestNumber.layer = #-1
\once \override MultiMeasureRestNumber.Y-offset = #0
\once \override MultiMeasureRestNumber.stencil = #white-under
}

timeParens = \markup { \huge "(" \magnify #1.4 " " \huge ")" }

{
\setInlineMMRN
\inlineMMRN R1*4^\markup { \timeParens }
}


%{

But I could not get it to move down onto the staff.  As described in
http://www.lilypond.org/doc/v2.19/Documentation/notation/formatting-text#text-alignment
"Vertical alignment is a bit more complex. As stated above, markup objects
can be moved as a whole;
however, it is also possible to move specific elements inside a markup
block."

It took me a while to realize this meant that the techniques using
raise, lower, translate, general-align and translate-scaled
will NOT affect the "markup object moved as a whole",
but rather affect the relative position of objects within the markup
object.

I also learned that these techniques, in addition to never placing text on
the staff,
will not place text to the left of the anchor point.

Perhaps this section should include a comment to the effect of:

"The commands raise, lower, translate, general-align and translate-scaled
used within a markup block are limited to printing text
outside the staff and to the right of the anchor point."
%}

{
%
%  An example of a failed attempt to translate text within a markup block
%

%  The translated object will not move to the left, even if it does not
collide with anything:
d'1^\markup {
Acte I
\translate #'(-30 . 4) "Scène 1"
}
1 1

%  It seems the translated object is positioned relative to the first text
object
%  and the entire markup is positioned above the staff.
%  Here, the lowered second object has the effect of pushing the first
object higher up.
1^\markup {
Acte I
\translate #'(0 . -4) "Scène 1"
}
1 1
d'1^\markup {
Acte I
\translate #'(0 . 4) "Scène 1"
}

%  The documentation for moving objects suggests using extra-offset.
%  http://lilypond.org/doc/v2.19/Documentation/learning/moving-objects
%  Likewise, this does not work on the multi-measure rest.

\setInlineMMRN
\inlineMMRN
\once \override TextScript #'extra-offset = #'(0 . -3.7)
R1*8^\timeParens
}


%  What did allow me to place text in the staff was attaching it to an
empty chord.

wideTimeParens = \markup { \magnify #11.5 " " \huge "(" \magnify #1.4 " "
\huge ")" }

inlineMMRN = {
\once \override MultiMeasureRest.layer = #-2
\once \override MultiMeasureRestNumber.layer = #-1
\once \override MultiMeasureRestNumber.Y-offset = #0
\once \override MultiMeasureRestNumber.stencil = #white-under
\once \override TextScript #'extra-offset = #'(0 . -3.7)
<>^\wideTimeParens
}

{
\setInlineMMRN
\inlineMMRN
R1*4
}


%  But then I lost the auto-centered-ness of attaching it to the
multi-measure rest.

{
\setInlineMMRN
\inlineMMRN
R1*44
\inlineMMRN
R1*8
\inlineMMRN
R1*12
}


%  So I can tweak these into submission.

inlineMMRN = {
\once \override MultiMeasureRest.layer = #-2
\once \override MultiMeasureRestNumber.layer = #-1
\once \override MultiMeasureRestNumber.Y-offset = #0
\once \override MultiMeasureRestNumber.stencil = #white-under
\once \override TextScript #'extra-offset = #'(0 . -3.7)
}

{
\setInlineMMRN
\inlineMMRN
<>^\markup { \magnify #10.4 " " \huge "(" \magnify #4 " " \huge ")" }
R1*44
\inlineMMRN
<>^\markup { \magnify #13.1 " " \huge "(" \magnify #1.9 " " \huge ")" }
R1*8
\inlineMMRN
<>^\markup { \magnify #12 " " \huge "(" \magnify #3.9 " " \huge ")" }
R1*12
}

%{

Finally, here is the real point of my post:

It would be nice to have a function that could take these arguments:
duration, number of measures, X-tweak, Y-tweak.

I've done music functions before music and text, but not with numbers.
My template for a music function that takes numbers comes from
http://lilypond.org/doc/v2.18/Documentation/notation/substitution-function-examples

padText = #(define-music-function
 (parser location padding)
 (number?)
   #{
 \once \override TextScript.padding = #padding
   #})

\relative c'' {
  c4^"piu mosso" b a b
  \padText #1.8
  c4^"piu mosso" b a b
  \padText #2.6
  c4^"piu mosso" b a b
}

So, here is my attempt.
Does anyone have any