Re: Double ossia with tabulature issue

2022-07-07 Thread Jean Abou Samra




On 7/8/22 02:23, Neo Anderson wrote:

Hi!

I've been trying to add an ossia to an existing guitar part with the 
tabulature. However, I run into this issue that the ossia gets doubled 
as long as the tab part is uncommented. As soon as I don't use the tab 
staff, everything is fine.


I guess it's all because of my /score block, but I can't figure it out.

The ossia itself doesn't have to have its own tab, but if, as an 
extra, someone could make it happen, I would be happy, too.


MWEs:
a) Minimal reproducible example included as an attachement
b) https://www.hacklily.org/?edit=Aelfstone/sheet-music/ossia_issue_mwe.ly
c) The code itself

%%
\version "2.23.10"

gtrOne = {
  d'1~ d'1
  \break
  <<
    { f'1 }
    \new Staff
    \with { alignAboveContext = "gtrOne" }
    { c''1 }
  >>
  g'1
}


\score {
  <<
    \new Staff = "gtrOne" \with { }
    { \gtrOne }
    \new TabStaff
    { \gtrOne }
  >>
  \layout {
    \context { }
  }
}

%%




Well, LilyPond is doing exactly what you've asked it. Since
there is \new Staff both in the normal staff and in the tablature,
you get two new staves. You need to do \new Staff in the staff,
and \new TabStaff in the tablature. Furthermore, you need to adjust
alignAboveContext. To do that without repeating the music, you
can use tags.


\version "2.23.10"

ossia = { c''1 }

gtrOne = {
  d'1~ d'1
  \break

  <<
    { f'1 }
    \tag staff \new Staff = ossia \with { alignAboveContext = gtrOne } 
\ossia

    \tag ossia \new TabStaff \with { alignAboveContext = ossia } \ossia
  >>
  g'1
}


\score {
  <<
    \new Staff = "gtrOne" \keepWithTag staff \gtrOne
    \new TabStaff \keepWithTag ossia \gtrOne
  >>
}


See 
https://lilypond.org/doc/v2.23/Documentation/notation/different-editions-from-one-source#using-tags


Note that I've also removed your useless (empty) \layout block.

Best,
Jean




Double ossia with tabulature issue

2022-07-07 Thread Neo Anderson
Hi!
I've been trying to add an ossia to an existing guitar part with the 
tabulature. However, I run into this issue that the ossia gets doubled as long 
as the tab part is uncommented. As soon as I don't use the tab staff, 
everything is fine.
I guess it's all because of my /score block, but I can't figure it out. 
The ossia itself doesn't have to have its own tab, but if, as an extra, someone 
could make it happen, I would be happy, too.
MWEs:a) Minimal reproducible example included as an attachementb) 
https://www.hacklily.org/?edit=Aelfstone/sheet-music/ossia_issue_mwe.lyc) The 
code itself

%%
\version "2.23.10"

gtrOne = {  d'1~ d'1  \break <<    { f'1 }    \new Staff     \with { 
alignAboveContext = "gtrOne" }    { c''1 }  >>    g'1}

\score {  <<    \new Staff = "gtrOne" \with { }    { \gtrOne }        \new 
TabStaff    { \gtrOne }        >>  \layout {    \context { }  }}
%%


\version "2.23.10"

gtrOne = {
  d'1~ d'1
  \break  
 
  <<
{ f'1 }
\new Staff 
\with { alignAboveContext = "gtrOne" }
{ c''1 }
  >>
  
  g'1
}


\score {
  <<
\new Staff = "gtrOne" \with { }
{ \gtrOne }

\new TabStaff
{ \gtrOne }  
  >>
  \layout {
\context { }
  }
}


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

2022-07-07 Thread Lukas-Fabian Moser

Hi Viktor,


Please forgive my ignorance, I have two follow-up questions:
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?

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).


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


Two HorizontalBracket over the same note

2022-07-07 Thread Jose Carlos Alvarez Gonzalez
 Hello to everyone,:)

I'm José Carlos and I'm newbie on lilypond and I can not be able to do the
following idea:
I want to add two HorizontalBracket over the same note (one of ending and
one for starting, to put the numbers of tones or semitones that the
interval have)
https://paste.debian.net/plainh/c955f325

\version "2.22.2"\relative c' {
  \omit Staff.TimeSignature
  \cadenzaOn
  \override NoteHead.style = #'default
  \override HorizontalBracket.direction = #DOWN
  \override HorizontalBracket.connect-to-neighbor = #(#f #f)
  \once\override HorizontalBracketText.text = "1"
  d1 \startGroup
  e\stopGroup\startGroup \once\override HorizontalBracketText.text =
"1/2"
  f \stopGroup}\layout {
  \context {
\Voice
\consists Horizontal_bracket_engraver
  }
}


The problem is that HorizontalBracket  is grouping the two interval. In
that example, i want to see:
d (1) e (1/2) f

I have to try to overried HorizontalBracket.connect-to-neighbor:
\override HorizontalBracket.connect-to-neighbor = #(#f #f)

but that not works for me.

In the following image https://imgur.com/a/NeHwnz7 I draw what I want to get

Thank you very much for all

:)


Best Regards

José Carlos


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

2022-07-07 Thread Viktor Mastoridis
On Wed, 6 Jul 2022 at 08:07, Lukas-Fabian Moser  wrote:

>
> Am 05.07.22 um 23:39 schrieb Lukas-Fabian Moser:
>
> Hi Viktor,
> Am 05.07.22 um 20:17 schrieb Viktor Mastoridis:
>
> For educational purposes, I would like to see whether it's possible to add
> a small note head after the key signature?
> Like a single Ambitus note, really.
>
>
> Why would I do it?
> For example, I would like to add a (small) D note to a G-Major key
> signature, suggesting that, despite the F# key indicating G-major or
> E-minor scale, this piece is in D-Myxolydian mode.
>
> Maybe something like this?
>
> ... probably cleaner not to re-define key, but record the current tonic in
> the KeySignature grob using an engraver.
> \version "2.23.10"
>
> tonic_notehead_engraver = #
> (lambda (ctx)
>   (make-engraver
>(acknowledgers
> ((key-signature-interface engraver grob source-engraver)
>  (if (eq? (grob::name grob) 'KeySignature)
>  (ly:grob-set-nested-property!
>   grob '(details tonic) (ly:context-property ctx 'tonic)))
>
> notehead_key_signature = #
> (lambda (grob)
>   (let*
>((key-sig (ly:key-signature-interface::print grob))
>  (notehead
>   (grob-interpret-markup grob
>  (markup #:tiny #:musicglyph "noteheads.s2")))
>  (notehead-parens (parenthesize-stencil notehead 0.1 0.3 0 0.1))
>  (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-parens
>(/ adjusted-tonic-position 2) Y)
> 0.5)))
>
>
> \layout {
>   \context {
> \Staff
> \consists #tonic_notehead_engraver
> \override KeySignature.stencil = #notehead_key_signature
>   }
> }
>
> {
>   \key d \mixolydian
>   a'1
>   \key a \mixolydian
>   1
>   \key g \mixolydian
>   1
>   \key g \dorian
>   1
>   \key c \minor
>   1
>   \clef bass
>   d1
>   \break
>   1
> }
>


Thank you very much, Lukas-Fabian. This is precisely what I am after!

Please forgive my ignorance, I have two follow-up questions:
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.

2. How can I remove the parenthesis? I tried but continuously broke the
code:-)


Re: Error message using AikenHeads with NullVoice

2022-07-07 Thread Jean Abou Samra




On 7/7/22 18:23, David F. wrote:

On Jul 7, 2022, at 1:59 AM, Valentin Petzel  wrote:

A different way to approach the problem would be to also specify something like

\context {
  \NullVoice
  shapeNoteStyles = ##()
}

It is still questionable why NullVoice would hickup on simply changing the
NoteHead style, so think this is worth creating a bug report.

Cheers,
Valentin

Yes, it does seem odd—and avoidable—that NullVoice would have a problem with 
shape notes.

With aikenHeads, there is one note-head shape (the triangle that is not a 
pyramid) that depends on the stem direction.  My assumption is that’s where the 
error is coming from.


Yup.


But if the note is not being shown at all, that logic doesn’t need to be 
executed.


The definition of NullVoice in ly/engraver-init.ly contains

  %% provide non-printing NoteHeads with proper extents for lyric alignment
  \consists Note_heads_engraver
  \omit NoteHead
  \override NoteHead.X-extent = #(lambda (g)
    (ly:stencil-extent (ly:note-head::print g) X))


Best,
Jean




Re: Error message using AikenHeads with NullVoice

2022-07-07 Thread David F.


> On Jul 7, 2022, at 1:59 AM, Valentin Petzel  wrote:
> 
> A different way to approach the problem would be to also specify something 
> like
> 
> \context {
>  \NullVoice
>  shapeNoteStyles = ##()
> }
> 
> It is still questionable why NullVoice would hickup on simply changing the 
> NoteHead style, so think this is worth creating a bug report.
> 
> Cheers,
> Valentin

Yes, it does seem odd—and avoidable—that NullVoice would have a problem with 
shape notes.

With aikenHeads, there is one note-head shape (the triangle that is not a 
pyramid) that depends on the stem direction.  My assumption is that’s where the 
error is coming from.  But if the note is not being shown at all, that logic 
doesn’t need to be executed.

David F.





Re: Error message using AikenHeads with NullVoice

2022-07-07 Thread David F.



> On Jul 6, 2022, at 12:40 PM, David Wright  wrote:
> 
> On Wed 06 Jul 2022 at 11:56:52 (-0600), David F. wrote:
>> [ … ]
>> The command to use aikenHeads comes from a separate style file that gets 
>> included for each hymn.  But there is an unfortunate interaction between 
>> aikenHeads and NullVoice: Lilypond outputs the following error message:
>> 
>> programming error: must have stem dir for note head
>> continuing, cross fingers
>> 
>> And it outputs a lot of these messages.  I need to find a way to stop 
>> Lilypond from outputting this error.  Any kind of quick fix or hack would be 
>> sufficient.
> 
> $ lilypond source-file.ly |& tee /tmp/complete-errors | grep -v 'programming 
> error: must have stem dir for note head' | grep -v 'continuing, cross fingers'
> 
> Is this hackish enough? The unfiltered errors are available
> for consultation in /tmp/complete-errors. I would need sed
> rather than grep to filter out the second line only when
> preceded by this particular first line.
> 
> Cheers,
> David.

Yes, that would be an option.  I’m already filtering the warning I get from 
setting a custom variable from the command line:

"2>&1 | grep -v '^warning: no such internal option: 
\(aspect-ratio\|style\)$’”

But in this case, I’d be suppressing the error completely.  Which means that, 
in the future, if something I did were to also cause this error, I wouldn’t see 
it.

David F.




Re: Error message using AikenHeads with NullVoice

2022-07-07 Thread Valentin Petzel
A different way to approach the problem would be to also specify something like

\context {
  \NullVoice
  shapeNoteStyles = ##()
}

It is still questionable why NullVoice would hickup on simply changing the 
NoteHead style, so think this is worth creating a bug report.

Cheers,
Valentin

Am Mittwoch, 6. Juli 2022, 23:06:48 CEST schrieb David F.:
> > On Jul 6, 2022, at 1:20 PM, Jean Abou Samra  wrote:
> > 
> > How about changing \Staff into \Voice?
> > 
> > \layout {
> > 
> > \context {
> > 
> > \Voice
> > 
> > \aikenHeads
> > 
> > }
> > 
> > }
> > 
> > That way, it won't affect those NullVoice contexts.
> > 
> > Best,
> > Jean
> 
> Perfect.  That does exactly what I wanted.
> 
> Thanks!
> 
> David F.



signature.asc
Description: This is a digitally signed message part.


Orchestral works good practice

2022-07-07 Thread Rip _Mus
Good morning to everyone,
I am preparing a large orchestral work.
In my writing style, each instrument often has two voices in its staff, for
various reason (for example, each clarinet can handle two voices when
playing multiphonics trills with threshold tones, or other techniques), but
in some other cases instruments couple have the same notes, or both tacet.
I read that, in these cases, \partCombine is not suitable.
Are there strategies for these kind of engraving needs?

Thank you

Rip_mus