Re: French tablature (with note heads)?

2022-07-09 Thread Alasdair McAndrew
Dear Jean,

That's just perfect - very nicely done indeed - with many thanks.  Also -
Tobias Hume!  (I'm attempting to typeset in modern notation one of the
pieces from his "Poeticall Musick" of 1607, for two lyra viols tuned ffeff
and one bass viol.)

However, from looking at your score, there seem to be quite a few tweaks
needed in order to move notes and letters around to get everything in the
right place.  I wonder if this could be made internal to Lilypond, so that,
for example, calling "FrenchTab" would give you everything you needed?

Alasdair


Part of staff does not obey alignAboveContext

2022-07-09 Thread Davide Liessi
Dear all,

in the second example below, the second part of the ossia staff jumps
below the main staff.
Am I doing something wrong or is it a bug in LilyPond?

Best wishes.
Davide

%

\version "2.23.4"

\score {
  \new Staff = "main" <<
\new Voice {
  <<
{ a'8 }
\new Staff = "ossia"
\with { alignAboveContext = "main" }
{ a'8 \stopStaff }
  >>
  a'8 a'8 a'8 a'2
  <<
{ a'1 }
\context Staff = "ossia"
{ \startStaff a'1 }
  >>
}
  >>
}

\score {
  \new Staff = "main" <<
\new Voice {
  <<
{ a'8 a'8 }
\new Staff = "ossia"
\with { alignAboveContext = "main" }
{ a'4 \stopStaff }
  >>
  a'8 a'8 a'2
  <<
{ a'1 }
\context Staff = "ossia"
{ \startStaff a'1 }
  >>
}
  >>
}



Re: Part of staff does not obey alignAboveContext

2022-07-09 Thread David Kastrup
Davide Liessi  writes:

> Dear all,
>
> in the second example below, the second part of the ossia staff jumps
> below the main staff.
> Am I doing something wrong or is it a bug in LilyPond?
>
> Best wishes.
> Davide
>
> %
>
> \version "2.23.4"
>
> \score {
>   \new Staff = "main" <<
> \new Voice {
>   <<
> { a'8 }
> \new Staff = "ossia"
> \with { alignAboveContext = "main" }
> { a'8 \stopStaff }
>   >>
>   a'8 a'8 a'8 a'2
>   <<
> { a'1 }
> \context Staff = "ossia"
> { \startStaff a'1 }
>   >>
> }
>   >>
> }
>
> \score {
>   \new Staff = "main" <<
> \new Voice {
>   <<
> { a'8 a'8 }
> \new Staff = "ossia"
> \with { alignAboveContext = "main" }
> { a'4 \stopStaff }
>   >>
>   a'8 a'8 a'2
>   <<
> { a'1 }
> \context Staff = "ossia"
> { \startStaff a'1 }
>   >>
> }
>   >>
> }

There is no "second part of the ossia staff" in the second example:
there is a second, independent ossia staff.  The $1000 question actually
is how your first score manages to have the ossia staff survive long
enough to have the second invocation find it still existent.

And the answer appears to be that the Auto_beam_engraver keeps it alive
for some reason: if you write { a'8\noBeam \stopStaff } instead of
{ a'8 \stopStaff } as the body of the first ossia Staff, it gets
detached from the second ossia staff just like in your second example.

Whether this constitutes a bug, I am not really sure.  It definitely
constitutes a curiosity.

-- 
David Kastrup



Re: Part of staff does not obey alignAboveContext

2022-07-09 Thread Jean Abou Samra


> Le 9 juil. 2022 à 13:09, David Kastrup  a écrit :
> 
> Whether this constitutes a bug, I am not really sure.  It definitely
> constitutes a curiosity.

Sounds like

https://gitlab.com/lilypond/lilypond/-/issues/5499

Best,
Jean



lilypond-book texinfo and a two-book-ly-file

2022-07-09 Thread Thomas Morley
Hi,

for some huge custom code I'm going to write some documentation using texinfo.
I started to set up the file manual.tely.
In terminal then:
lilypond-book manual.tely
texi2html manual.texi

At some point I have:
@lilypondfile[quote]{../doc-snippets/haenschen-klein.ly}

Two questions about it:
(1) This ly-file ouputs two books and I see several images after
running lilypond-book for it:
lily-6333cb39-1-1.eps
lily-6333cb39-1.eps
lily-6333cb39.eps
lily-6333cb39-1.png
lily-6333cb39.png
Alas only the output of the first book is finally printed (i.e. after texi2html)
Is it possible get both books printed?

(2) One of the books is in portrait the other in landscape format
Is there any texinfo option to get the landscape one rotated?
That landscape thingy is needed and I can't change it, it may be an
option to drop the portrait-book, though.
Even dropping that one I'd need to get the landscape output rotated, though.

Thanks,
  Harm



Re: Part of staff does not obey alignAboveContext

2022-07-09 Thread Davide Liessi
Dear David,

Il giorno sab 9 lug 2022 alle ore 13:13 David Kastrup  ha scritto:
> There is no "second part of the ossia staff" in the second example:
> there is a second, independent ossia staff.
> [...]

thanks for the explanation.

I overlooked the fact that there were spacer rests for the whole
length of the piece (in order to keep the context alive) in the \new
Staff = "ossia" in the following example taken from NR 1.6.2:

<<
  \new Staff = "ossia" \with {
\remove Time_signature_engraver
\hide Clef
\magnifyStaff #2/3
  }
  { \stopStaff s1*6 }

  \new Staff \relative {
c'4 b c2
<<
  { e4 f e2 }
  \context Staff = "ossia" {
\startStaff e4 g8 f e2 \stopStaff
  }
>>
g4 a g2 \break
c4 b c2
<<
  { g4 a g2 }
  \context Staff = "ossia" {
\startStaff g4 e8 f g2 \stopStaff
  }
>>
e4 d c2
  }
>>

Of course adding spacer rests in the \new Staff = "ossia" in my
example does not work, as it pushes all the following music forward.

In NR 5.1.2 I read the following description of \context:

\context with a name specified will create a distinct context only if
a context of the same type with the same name in the same context
hierarchy does not already exist. Otherwise it will be taken as a
reference to that previously created context, and its music expression
will be passed to that context for interpretation.

This is correct, but gave me the wrong impression that \context could
reference any context that existed at some previous point in the music
and, if needed, prolong it to include the specified music.
Maybe the words "at the current moment" or similar could be added at
the end of the first sentence.

Best wishes.
Davide



Re: lilypond-book texinfo and a two-book-ly-file

2022-07-09 Thread Jean Abou Samra




Le 09/07/2022 à 13:41, Thomas Morley a écrit :

Hi,

for some huge custom code I'm going to write some documentation using texinfo.
I started to set up the file manual.tely.
In terminal then:
 lilypond-book manual.tely
 texi2html manual.texi

At some point I have:
@lilypondfile[quote]{../doc-snippets/haenschen-klein.ly}

Two questions about it:
(1) This ly-file ouputs two books and I see several images after
running lilypond-book for it:
lily-6333cb39-1-1.eps
lily-6333cb39-1.eps
lily-6333cb39.eps
lily-6333cb39-1.png
lily-6333cb39.png
Alas only the output of the first book is finally printed (i.e. after texi2html)
Is it possible get both books printed?



A low-tech solution is to put your music variables in an
include file and do two ly snippets, each with one of the
two books.



(2) One of the books is in portrait the other in landscape format
Is there any texinfo option to get the landscape one rotated?
That landscape thingy is needed and I can't change it, it may be an
option to drop the portrait-book, though.
Even dropping that one I'd need to get the landscape output rotated, though.


I don't think Texinfo has an easy way to rotate an image when
inserting it.

If I were to do this, I would probably just write the documentation
in a .ly file using \markup. Alternatively, I might use Sphinx,
which unlike Texinfo is extensible, and modify
https://github.com/sphinx-notes/lilypond
to add support for rotating the output.

Jean




Re: Adding a root note next to the key signature (like a single note Ambitus)

2022-07-09 Thread Viktor Mastoridis
> 1. How do I change the pitch of the 'root' note? I tried playing with the
> three numbers from "(+ tonic-position 3) 7) 3)))". But I can't understand
> their logic.
>
> I'm not quite sure what you mean: The pitch of the 'root' note is taken
> directly from the \key command.
>
> For example, the following example generates all reasonable roots for key
> signatures with two sharps:
>
> {
>   \key d \major
>   a'1
>   \key e \dorian
>   a'1
>   \key fis \phrygian
>   a'1
>   \key g \lydian
>   a'1
>   \key a \mixolydian
>   a'1
>   \key b \aeolian
>   a'1
>   \key cis \locrian
>   a'1
> }
>
> Does this already solve your question?
>
No, it didn't at first.
I was talking about custom scales like Hijaz (1 2b 3 4 5 6b 7b) and its
variations.
I use the \set Staff.keyAlterations command.
But then I remembered that I have to use the normal \key command before the
keyAlterations command, to give it a context for the alterations.
I tried that and it works as a charm (see below).


But I can also explain the logic behind the three numbers 3 7 3 in the
> expression you quoted:
>
>- "tonic" is the tonic as a LilyPond pitch.
>- "tonic-position" is defined as (+ (ly:pitch-steps tonic)
>(ly:grob-property grob 'c0-position), i.e.
>... the vertical position of "middle c" for the current clef (measured
>in half-staff distances, i.e. note steps, from the centermost staff line)
>plus
>... the number of steps our tonic lies above middle c.
>Now we have the problem that this gives us the position of _some_
>tonic note, but we do not know yet in which octave it will lie; so it may
>very well be sitting far above or far below the staff. Therefore:
>- "adjusted-tonic-position" is defined as (- (modulo (+ tonic-position
>3) 7) 3))), i.e. ((tonic-position + 3) mod 7) - 3. The idea is: Take the
>tonic-position modulo 7 since pitch names repeat after 7 steps. If we would
>simply take "tonic-position mod 7", this would amount to guaranteeing the
>tonic-position to lie between 0 and 6: But this means our note will lie on
>or above the centermost staff line (the lower staff lines will not be 
> used).
>What we want instead is a "shifted" modulo operation that returns
>values not between 0 and 6 but between -3 and 3; in other words: Values of
>"tonic-position" between -3 and 3 should not get changed. So we first add 3
>(yielding a value between 0 and 6), then doing the modulo and finally
>transforming back by subtracting 3 again.
>
> To sum up: The 7 should not be changed (that's the amount of steps in our
> note name system), and the two 3's should be equal (and it's no coincidence
> that 3 = (7-1)/2).
>
Thank you for that. It's fantastic how Music Theory gets another life as a
Lilypond code:-)

2. How can I remove the parenthesis? I tried but continuously broke the
> code:-)
>
> The notehead stencil is in the "notehead" variable, and the paranthesized
> stencil is stored in "notehead-parens". The simplest way to get rid of the
> parentheses would be to replace "notehead-parens" in the final construction
> of the stencil by "notehead". But then we can also get rid of
> "notehead-parens" completely, hence we get:
>
> notehead_key_signature = #
> (lambda (grob)
>   (let*
>((key-sig (ly:key-signature-interface::print grob))
>  (notehead
>   (grob-interpret-markup grob
>  (markup #:tiny #:musicglyph "noteheads.s2")))
>  (tonic (assq-ref (ly:grob-property grob 'details) 'tonic))
>  (tonic-position (+ (ly:pitch-steps tonic)
> (ly:grob-property grob 'c0-position)))
>  (adjusted-tonic-position
>   (- (modulo (+ tonic-position 3) 7) 3)))
>(ly:stencil-combine-at-edge
> key-sig X RIGHT
> (ly:stencil-translate-axis notehead
>(/ adjusted-tonic-position 2) Y)
> 0.5)))
>
> HTH
> Lukas
>

Thank you, thank you, thank you.

I finally arrived where I intended to go.
This is what I use on top of your code and it renders perfectly - image
attached.
\key d \major
  \set Staff.keyAlterations = #`(
(2 . ,FLAT)
(3 . ,SHARP)
(6 . ,FLAT)
)
\mark "D Hijaz"
d' es' fis' g' a' bes' c'' d''

Viktor


Re: lilypond-book texinfo and a two-book-ly-file

2022-07-09 Thread Thomas Morley
Am Sa., 9. Juli 2022 um 16:44 Uhr schrieb Jean Abou Samra :
>
>
>
> Le 09/07/2022 à 13:41, Thomas Morley a écrit :
> > Hi,
> >
> > for some huge custom code I'm going to write some documentation using 
> > texinfo.
> > I started to set up the file manual.tely.
> > In terminal then:
> >  lilypond-book manual.tely
> >  texi2html manual.texi
> >
> > At some point I have:
> > @lilypondfile[quote]{../doc-snippets/haenschen-klein.ly}
> >
> > Two questions about it:
> > (1) This ly-file ouputs two books and I see several images after
> > running lilypond-book for it:
> > lily-6333cb39-1-1.eps
> > lily-6333cb39-1.eps
> > lily-6333cb39.eps
> > lily-6333cb39-1.png
> > lily-6333cb39.png
> > Alas only the output of the first book is finally printed (i.e. after 
> > texi2html)
> > Is it possible get both books printed?
>
>
> A low-tech solution is to put your music variables in an
> include file and do two ly snippets, each with one of the
> two books.

Ok, I'll continue to try out things :)

> > (2) One of the books is in portrait the other in landscape format
> > Is there any texinfo option to get the landscape one rotated?
> > That landscape thingy is needed and I can't change it, it may be an
> > option to drop the portrait-book, though.
> > Even dropping that one I'd need to get the landscape output rotated, though.
>
> I don't think Texinfo has an easy way to rotate an image when
> inserting it.
>
> If I were to do this, I would probably just write the documentation
> in a .ly file using \markup. Alternatively, I might use Sphinx,
> which unlike Texinfo is extensible, and modify
> https://github.com/sphinx-notes/lilypond
> to add support for rotating the output.
>
> Jean
>

I'll really love the texinfo/lilypond-book/html combination.
Most the feature to click on an image and get the source-code.

Thus \markup in ly-file is no option.
I once tried for another project, it was a nightmare...

I had a quick glance over the sphinx docu
https://sphinx.silverrainz.me/lilypond/
But couldn't figure whether it's possible with sphinx?

Thanks,
  Harm