Re: Stanzas over staves

2018-04-22 Thread Partitura Organum

On 22-4-2018 19:33, Helge Kruse wrote:


Glad to here that's working for you. Unfortunately this doesn't work for
me. I reordered the lines a bit because I think that the override
changes the line-width property of wordwrap-string. But the reordering
doesn't change the ouput. The text crosses several measures in this
example. I thought that \with-dimensions defines the extend of the
markup. But this doesn't affect the measure width.

Regards
Helge

%%BEGIN
\version "2.19.65"
narrator=#(define-music-function (dim text) (number? string?)
   #{
   s1^\markup
   \with-dimensions #(cons 0 (+ dim 2)) #'(0 . 0)
   \whiteout
   \translate #'(0 . -1.5)
   \override #(cons (quote line-width) dim )
   \wordwrap-string   #text
#})

{
   \new PianoStaff <<
 \new Staff {
 s1
 \narrator 30 "The brown fox jumps quickly over the lazy dog."
 s1 s
 }
 \new Staff { s1 s s s }
   >>
}
%%END


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


Add " \once\override TextScript.extra-spacing-width = #'(0 . 0)" to the 
function. Then it works. Don't know why...


narrator=#(define-music-function
  (dim text) (number? string?)

   #{
  \once\override TextScript.extra-spacing-width = #'(0 . 0)
  s1^\markup
  \with-dimensions #(cons 0 (+ dim 2)) #'(0 . 0)
  \whiteout
  \translate #'(0 . -1.5)
  \override #(cons (quote line-width) dim)
  \wordwrap-string   #text
   #})

Regards,
Auke


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


Re: Stanzas over staves

2018-04-22 Thread Helge Kruse
Am 20.04.2018 um 07:58 schrieb Partitura Organum:
> 
> 
> On 19-4-2018 22:19, Thomas Morley wrote:
>> The function expects `text' to be a string. So
>> (1) use wordwrap-string
>> (2) without {}
> 
> Thank you, now it works. And  I learned how to do calculations in scheme
> along the way as well. So the narrator function should be
> 
> narrator=#(define-music-function
>   (dim text) (number? string?)
>   #{
>   s1^\markup
>   \with-dimensions #(cons 0 (+ dim 2)) #'(0 . 0)
>   \whiteout
>   \override #(cons (quote line-width) dim)
>   \translate #'(0 . -1.5)
>   \wordwrap-string   #text
>    #})
Glad to here that's working for you. Unfortunately this doesn't work for
me. I reordered the lines a bit because I think that the override
changes the line-width property of wordwrap-string. But the reordering
doesn't change the ouput. The text crosses several measures in this
example. I thought that \with-dimensions defines the extend of the
markup. But this doesn't affect the measure width.

Regards
Helge

%%BEGIN
\version "2.19.65"
narrator=#(define-music-function (dim text) (number? string?)
  #{
  s1^\markup
  \with-dimensions #(cons 0 (+ dim 2)) #'(0 . 0)
  \whiteout
  \translate #'(0 . -1.5)
  \override #(cons (quote line-width) dim )
  \wordwrap-string   #text
   #})

{
  \new PianoStaff <<
\new Staff {
s1
\narrator 30 "The brown fox jumps quickly over the lazy dog."
s1 s
}
\new Staff { s1 s s s }
  >>
}
%%END


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


Re: Stanzas over staves

2018-04-19 Thread Partitura Organum



On 19-4-2018 22:19, Thomas Morley wrote:

The function expects `text' to be a string. So
(1) use wordwrap-string
(2) without {}


Thank you, now it works. And  I learned how to do calculations in scheme 
along the way as well. So the narrator function should be


narrator=#(define-music-function
  (dim text) (number? string?)
  #{
  s1^\markup
  \with-dimensions #(cons 0 (+ dim 2)) #'(0 . 0)
  \whiteout
  \override #(cons (quote line-width) dim)
  \translate #'(0 . -1.5)
  \wordwrap-string   #text
   #})

Regards,
Auke

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


Re: Stanzas over staves

2018-04-19 Thread Thomas Morley
2018-04-19 21:09 GMT+02:00 Partitura Organum :
>
>
> On 19-4-2018 00:30, Simon Albrecht wrote:
>>
>> You have to quote line-width because it’s a symbol, not a variable. That
>> can also be done in a verbose or in a practical way:
>> \override #(cons 'line-width dim)
>> or
>> \override #(cons (quote line-width) dim).
>> The two are exactly equivalent.
>
>
> The second is new for me, nice to learn. The first form I did try (after
> having found out about cons). It does compile, but it does not work.
> Somehow, inside a scheme function the 'line-width argument does not point to
> the actual line-width property of the markup being constructed.
>
> I.e. this does work as intended:
>
> scoreAUpperHarpI = \relative c'' {
> \once\override TextScript.extra-spacing-width = #'(0 . 0)
> s1^\markup
>  \with-dimensions #'(0 . 22) #'(0 . 0)
>  \whiteout \override #'(line-width . 20)
>  \translate #'(0 . 0)
>  \wordwrap   { Ah, how oft we read or hear of  Boys we almost stand in
> fear of!  For example, take these stories
>}
> }
>
> scoreALowerHarpI = \relative c' { s1  }
>
> scoreAHarpIPart = \new PianoStaff \with {
>   instrumentName = "Harfe I"
> } <<
>   \new Staff = "upper" \scoreAUpperHarpI
>   \new Staff = "lower" { \clef bass \scoreALowerHarpI }
>>>
>
> \score {
>   <<
> \scoreAHarpIPart
>   >>
>   \layout { }
> }
>
>
> However, when transforming this into a scheme function the line-width and
> wordwrap do not work as intended:
>
> narrator=#(define-music-function
>   (parser location dim text) (number? string?)
>
>#{
>   \override TextScript.extra-spacing-width = #'(0 . -0.50)
>  s1^\markup
>   \with-dimensions #(cons 0 dim) #'(0 . 0)
>   \whiteout
>   \override #(cons (quote line-width) dim)
>   \translate #'(0 . -1.5)
>   \wordwrap {  #text }

The function expects `text' to be a string. So
(1) use wordwrap-string
(2) without {}

>#})
>
> scoreAUpperHarpII = \relative c'' {
>   \narrator#30 "Of named Max and Moritz, Who, instead of early turning
> etcetc"
>  }
>
> scoreALowerHarpII= \relative c' { s1  }
>
> scoreAHarpIIPart = \new PianoStaff \with {
>   instrumentName = "Harfe II"
> } <<
>   \new Staff = "upper" \scoreAUpperHarpII
>   \new Staff = "lower" { \clef bass \scoreALowerHarpII }
>>>
>
> \score {
>   <<
> \scoreAHarpIIPart
>   >>
>   \layout { }
> }
>
> How should the function be constructued toi make this work an intended?
>
> Regards,
> Auke
>



Cheers,
  Harm

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


Re: Stanzas over staves

2018-04-19 Thread Partitura Organum



On 19-4-2018 00:30, Simon Albrecht wrote:
You have to quote line-width because it’s a symbol, not a variable. 
That can also be done in a verbose or in a practical way:

\override #(cons 'line-width dim)
or
\override #(cons (quote line-width) dim).
The two are exactly equivalent. 


The second is new for me, nice to learn. The first form I did try (after 
having found out about cons). It does compile, but it does not work. 
Somehow, inside a scheme function the 'line-width argument does not 
point to the actual line-width property of the markup being constructed.


I.e. this does work as intended:

scoreAUpperHarpI = \relative c'' {
    \once\override TextScript.extra-spacing-width = #'(0 . 0)
    s1^\markup
 \with-dimensions #'(0 . 22) #'(0 . 0)
 \whiteout \override #'(line-width . 20)
 \translate #'(0 . 0)
 \wordwrap   { Ah, how oft we read or hear of  Boys we almost stand 
in fear of!  For example, take these stories

   }
}

scoreALowerHarpI = \relative c' { s1  }

scoreAHarpIPart = \new PianoStaff \with {
  instrumentName = "Harfe I"
} <<
  \new Staff = "upper" \scoreAUpperHarpI
  \new Staff = "lower" { \clef bass \scoreALowerHarpI }
>>

\score {
  <<
    \scoreAHarpIPart
  >>
  \layout { }
}


However, when transforming this into a scheme function the line-width 
and wordwrap do not work as intended:


narrator=#(define-music-function
  (parser location dim text) (number? string?)

   #{
  \override TextScript.extra-spacing-width = #'(0 . -0.50)
 s1^\markup
  \with-dimensions #(cons 0 dim) #'(0 . 0)
  \whiteout
  \override #(cons (quote line-width) dim)
  \translate #'(0 . -1.5)
  \wordwrap {  #text }
   #})

scoreAUpperHarpII = \relative c'' {
  \narrator#30 "Of named Max and Moritz, Who, instead of early turning 
etcetc"

 }

scoreALowerHarpII= \relative c' { s1  }

scoreAHarpIIPart = \new PianoStaff \with {
  instrumentName = "Harfe II"
} <<
  \new Staff = "upper" \scoreAUpperHarpII
  \new Staff = "lower" { \clef bass \scoreALowerHarpII }
>>

\score {
  <<
    \scoreAHarpIIPart
  >>
  \layout { }
}

How should the function be constructued toi make this work an intended?

Regards,
Auke


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


Re: Stanzas over staves

2018-04-18 Thread Simon Albrecht

On 18.04.2018 23:20, Partitura Organum wrote:
My scheme knowledge is very very limited. I just found out one can 
construct a pair in a scheme function like this:


   #(cons a b)

where a and b are the values. So for your function "narrator", this 
would become:


   \with-dimensions #(cons 0 dim)  #'(0 . 0)


Good call, that’s another way to do it.

I am however lost how to make "\override #'(line-width . dim)" work 
inside this scheme-function. 


You have to quote line-width because it’s a symbol, not a variable. That 
can also be done in a verbose or in a practical way:

\override #(cons 'line-width dim)
or
\override #(cons (quote line-width) dim).
The two are exactly equivalent.

Best, Simon

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


Re: Stanzas over staves

2018-04-18 Thread Partitura Organum



On 18-4-2018 20:26, Helge Kruse wrote:

Am 18.04.2018 um 12:39 schrieb Engraver:

I use "with-dimensions" if I want to place some text over staves. And
"\whiteout" can be used to blot out the staff-lines. See attached.
It's rather hackish, so I hope the more knowledgeable members of the
list have a more elegant solution for you.

This is one approach I would follow.
Since this repeats I would like to put this to a scheme construct. But I
don't have sufficient knowledge. Here is my (failed) try:

%%START
\version "2.19.65"

narrator =
#(define-music-function (dim text) (integer? string?)
#{
  s1^\markup
   \with-dimensions #'(0 . dim) #'(0 . 0)
   \override #'(line-width . dim)
   \translate #'(0 . -1.5)
   \wordwrap {  text }
#})


\score {
   \narrator #1  "The message"
}
%%END

It looks like the parameter 'dim' can't be used in this way to build a
valid parameter to with-dimension. Is this true? How to do it correctly?

How could I pass 'dim+2' to the override of line-width?

Regards,
Helge

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


My scheme knowledge is very very limited. I just found out one can 
construct a pair in a scheme function like this:


   #(cons a b)

where a and b are the values. So for your function "narrator", this 
would become:


   \with-dimensions #(cons 0 dim)  #'(0 . 0)

I am however lost how to make "\override #'(line-width . dim)" work 
inside this scheme-function.


Regards,
Auke




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


Re: Stanzas over staves

2018-04-18 Thread Simon Albrecht

On 18.04.2018 20:26, Helge Kruse wrote:

It looks like the parameter 'dim' can't be used in this way to build a
valid parameter to with-dimension. Is this true? How to do it correctly?


You need quasi-quotation:
\with-dimensions #`(0 . ,dim) #'(0 . 0)
For more on this, consult the Extending Guide to LilyPond, the Guile 1.8 
reference manual or any other Scheme resource of your liking.


Best, Simon

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


Re: Stanzas over staves

2018-04-18 Thread Helge Kruse
Am 18.04.2018 um 12:39 schrieb Engraver:
> I use "with-dimensions" if I want to place some text over staves. And
> "\whiteout" can be used to blot out the staff-lines. See attached.
> It's rather hackish, so I hope the more knowledgeable members of the
> list have a more elegant solution for you.

This is one approach I would follow.
Since this repeats I would like to put this to a scheme construct. But I
don't have sufficient knowledge. Here is my (failed) try:

%%START
\version "2.19.65"

narrator =
#(define-music-function (dim text) (integer? string?)
   #{
 s1^\markup
  \with-dimensions #'(0 . dim) #'(0 . 0)
  \override #'(line-width . dim)
  \translate #'(0 . -1.5)
  \wordwrap {  text }
   #})


\score {
  \narrator #1  "The message"
}
%%END

It looks like the parameter 'dim' can't be used in this way to build a
valid parameter to with-dimension. Is this true? How to do it correctly?

How could I pass 'dim+2' to the override of line-width?

Regards,
Helge

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


Fwd: Re: Stanzas over staves

2018-04-18 Thread Engraver



On 18-4-2018 07:20, Helge Kruse wrote:

But there are some open points.

- The harp requires two staff lines. I managed to remove the 
outside-staff-priority for one staff. But the other staff line is 
pushed away. How can I use both staves of one harp for the text? How 
could I place the text covering all staves of the score and avoid 
Lilyponds anti-collision routines that moves the staff lines away?


- The readability of the text could be improved by changing to color 
of the lines in the narrative measure to gray, light gray, or probably 
white. LSR #700 shows a way to color staff lines. But is there a 
simpler way when I need a common color for all lines?


Best regards
Helge 



I use "with-dimensions" if I want to place some text over staves. And
"\whiteout" can be used to blot out the staff-lines. See attached.
It's rather hackish, so I hope the more knowledgeable members of the
list have a more elegant solution for you.

Regards,
Auke

\version "2.19.80"

\header {
  title = "Max and Moritz"
}

% http://lsr.di.unimi.it/LSR/Item?id=780
narrative = {
  \once\override TextScript.extra-spacing-width = #'(0 . 0)
  %\once\override TextScript.Y-offset = #2
  %\once\override TextScript.outside-staff-priority = ##f
  %\once\override TextScript.self-alignment-X = #LEFT
  %\once\override Stem.transparent = ##t
  %\once\override NoteHead.transparent = ##t
  %\once\override NoteHead.no-ledgers = ##t
}


scoreAUpperHarpI = \relative c'' {
  c4 4 4 4
  s1
  s
  \narrative s1^\markup 
\with-dimensions #'(0 . 42) #'(0 . 0)
\override #'(line-width . 40)
\translate #'(0 . -1.5) 
\wordwrap { Of two youths, named Max and Moritz, Who, instead of early turning Their young minds to useful learning, Often leered with horrid features At their lessons and their teachers. }
  s
}

scoreALowerHarpI = \relative c' { s1 s s s s }

scoreAUpperHarpII = \relative c'' {
  s1
  \narrative s^\markup 
 \with-dimensions #'(0 . 22) #'(0 . 0)
 \whiteout \override #'(line-width . 20) 
 \translate #'(0 . 0) 
 \wordwrap   { Ah, how oft we read or hear of  Boys we almost stand in fear of!  For example, take these stories  
   }
   s1
   s
   e4 4 4 4
}

scoreALowerHarpII = \relative c' { s1 s s s s }

scoreAUpperHarpIII = \relative c'' { s s | d4 4 4 4 | s1 s }

scoreALowerHarpIII = \relative c' { s1 s s s s }

scoreAHarpIPart = \new PianoStaff \with {
  instrumentName = "Harfe I"
} <<
  \new Staff = "upper" \scoreAUpperHarpI
  \new Staff = "lower" { \clef bass \scoreALowerHarpI }
>>


scoreAHarpIIPart = \new PianoStaff \with {
  instrumentName = "Harfe II"
} <<
  \new Staff = "upper" \scoreAUpperHarpII
  \new Staff = "lower" { \clef bass \scoreALowerHarpII }
>>

scoreAHarpIIIPart = \new PianoStaff \with {
  instrumentName = "Harfe III"
} <<
  \new Staff = "upper" \scoreAUpperHarpIII
  \new Staff = "lower" { \clef bass \scoreALowerHarpIII }
>>

\score {
  <<
\scoreAHarpIPart
\scoreAHarpIIPart
\scoreAHarpIIIPart
  >>
  \layout { }
}

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


Re: Stanzas over staves

2018-04-17 Thread Helge Kruse

Am 17.04.2018 um 21:13 schrieb Kieren MacMillan:

it looks like you simply want to stack the text as markup above a measure-long 
rest (with fermatas in all parts, I would assume?).

Oh, my bad wording. I mean not above the lines but inside.


That's definitely a simple situation, easy to accomplish in Lilypond. Maybe try 
something like
Combining your snippet with snippet #780 from the Lilypond snippet 
repository I was able to create a minimum example. This shows how the 
text should overlap the staff. The choosen staff idicates what player is 
the narrator at the given measure.


But there are some open points.

- The harp requires two staff lines. I managed to remove the 
outside-staff-priority for one staff. But the other staff line is pushed 
away. How can I use both staves of one harp for the text? How could I 
place the text covering all staves of the score and avoid Lilyponds 
anti-collision routines that moves the staff lines away?


- The readability of the text could be improved by changing to color of 
the lines in the narrative measure to gray, light gray, or probably 
white. LSR #700 shows a way to color staff lines. But is there a simpler 
way when I need a common color for all lines?


Best regards
Helge

\version "2.19.80"

\header {
  title = "Max and Moritz"
}

% http://lsr.di.unimi.it/LSR/Item?id=780
narrative = {
  \once\override TextScript.extra-spacing-width = #'(0 . 0)
  \once\override TextScript.Y-offset = #-.5
  \once\override TextScript.outside-staff-priority = ##f
  \once\override TextScript.self-alignment-X = #LEFT
  \once\override Stem.transparent = ##t
  \once\override NoteHead.transparent = ##t
  \once\override NoteHead.no-ledgers = ##t
}


scoreAUpperHarpI = \relative c'' {
  c4 4 4 4
  s1
  s
  \narrative s1^\markup 
\override #'(line-width . 40)
\wordwrap { Of two youths, named Max and Moritz, Who, instead of early turning Their young minds to useful learning, Often leered with horrid features At their lessons and their teachers. }
  s
}

scoreALowerHarpI = \relative c' { s1 s s s s }

scoreAUpperHarpII = \relative c'' {
  s1
  \narrative 
   s^\markup 
\override #'(line-width . 20) 
\wordwrap   { Ah, how oft we read or hear of  Boys we almost stand in fear of!  For example, take these stories  
   }
   s1
   s
   e4 4 4 4
}

scoreALowerHarpII = \relative c' { s1 s s s s }

scoreAUpperHarpIII = \relative c'' { s s | d4 4 4 4 | s1 s }

scoreALowerHarpIII = \relative c' { s1 s s s s }

scoreAHarpIPart = \new PianoStaff \with {
  instrumentName = "Harfe I"
} <<
  \new Staff = "upper" \scoreAUpperHarpI
  \new Staff = "lower" { \clef bass \scoreALowerHarpI }
>>

scoreAHarpIIPart = \new PianoStaff \with {
  instrumentName = "Harfe II"
} <<
  \new Staff = "upper" \scoreAUpperHarpII
  \new Staff = "lower" { \clef bass \scoreALowerHarpII }
>>

scoreAHarpIIIPart = \new PianoStaff \with {
  instrumentName = "Harfe III"
} <<
  \new Staff = "upper" \scoreAUpperHarpIII
  \new Staff = "lower" { \clef bass \scoreALowerHarpIII }
>>

\score {
  <<
\scoreAHarpIPart
\scoreAHarpIIPart
\scoreAHarpIIIPart
  >>
  \layout { }
}
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Stanzas over staves

2018-04-17 Thread Kieren MacMillan
Hi again,

Given your example:

> measure 1: some notes
> measure 2: text: This is the story of Max and Moritz
> measure 3: some notes
> measure 4: text: Moritz
> measure 5,6: more notes
> measure 7: text AH, how oft we read or hear of Boys we almost stand in
> fear of! For example, take these stories of two youths, named Max and
> Moritz (as stack of lines)
> measure 8-20: many notes

it looks like you simply want to stack the text as markup above a measure-long 
rest (with fermatas in all parts, I would assume?). That's definitely a simple 
situation, easy to accomplish in Lilypond. Maybe try something like

%%%  SNIPPET BEGINS
\version "2.19.80"
\language "english"

musicandtext = {
  c'4 d' e' f'
  \tweak minimum-length #24 R1\fermataMarkup^\markup \override #'(line-width . 
20) \override #'(baseline-skip . 2.3) \wordwrap { This is a very long bit of 
dialogue, which will wrap to the length you want. }
}

\score { \musicandtext }
%%%  SNIPPET ENDS

Of course, if you’re doing a lot of it, you should make a function which does 
all the appropriate things for you. Syntactic sugar is the best kind of sugar.  
=)

Hope this helps!
Kieren.


Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info


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