combining two whole notes into one

2023-09-26 Thread Виноградов Юрий
Hello. I have two votes. And each one sings the same note. For example, F. When the notes are stylized, they are combined using the \mergeDifferentlyHeadedOn command. But whole notes are not joined together with this command. Please help me. Maybe someone knows how to do it.Юрий Виноградов



Re: Initial rests in MIDI not included?

2023-09-26 Thread David Wright
On Wed 27 Sep 2023 at 01:13:09 (+0200), Jean Abou Samra wrote:
> After replacing “ ... ” with “ c' ”, I got the expected MIDI output with
> LilyPond 2.24.2, i.e., lots of silence and four C notes at the end.

I did the same, and I attach a screenshot of audacious playing the
file, called mid.midi. The little white blip above the Play button
is the equaliser graph displaying the first c' at 2 min 40 sec of
playing time. (Yawn.)

I also attach a screenshot of timidity playing the same file. Notice
the length of the file: 4 seconds; and that's how long it plays for.

Cheers,
David.


Re: Initial rests in MIDI not included?

2023-09-26 Thread David Wright
On Tue 26 Sep 2023 at 18:52:52 (-0400), Kevin Cole wrote:
> Once again, I'm flummoxed by some syntax problem... I was hoping for 40
> measures of silence, as I plan to mix it with other parts, and want to be
> able to mute parts interactively. However the following doesn't give me 40
> measures of silence, but starts right in on PartTwo. What have I missed
> THIS time?
> 
> %%%
> \version "2.24.2"
> 
> PartTwo = \relative a { ... }
> 
> \score {
>   \unfoldRepeats {
> \new Voice = "PartTwo" {
>   R1*32 R1*8
>   \repeat unfold 4 {
> \transpose c c'  { \PartTwo }
>   }
> }
>   }
> 
>   \midi { }
> }
> %%%

Is it possible your player is set to skip leading/trailing silence,
which is quite usual.

Cheers,
David.



Re: Initial rests in MIDI not included?

2023-09-26 Thread Jean Abou Samra
After replacing “ ... ” with “ c' ”, I got the expected MIDI output with
LilyPond 2.24.2, i.e., lots of silence and four C notes at the end.


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


Initial rests in MIDI not included?

2023-09-26 Thread Kevin Cole
Once again, I'm flummoxed by some syntax problem... I was hoping for 40
measures of silence, as I plan to mix it with other parts, and want to be
able to mute parts interactively. However the following doesn't give me 40
measures of silence, but starts right in on PartTwo. What have I missed
THIS time?

%%%
\version "2.24.2"

PartTwo = \relative a { ... }

\score {
  \unfoldRepeats {
\new Voice = "PartTwo" {
  R1*32 R1*8
  \repeat unfold 4 {
\transpose c c'  { \PartTwo }
  }
}
  }

  \midi { }
}
%%%


Re: Strange behavior of repeat unfold inside a repeat volta with alternatives.

2023-09-26 Thread Stéphane SOPPERA
Thanks for the explanation! I was not aware of the previous behavior and 
that was very confusing.
And I guess I was not expecting alternatives to work with /unfold/ 
either but that makes sense.


On 2023-09-26 23:53, David Kastrup wrote:

Stéphane SOPPERA  writes:


I observed a strange behavior with a /repeat unfold/ inside a /repeat
volta/ with /alternatives/. See the attached /bug_repeat__ok.ly/ for
full source.

Using Lilypond 2.24.1:

     \repeat volta 2 {
   %% Here we repeat three times the same music.
*  \relative { c'4 e g r } |**
**  \relative { c'4 e g r } |**
**  \relative { c'4 e g r } |*
   \alternative {
     \volta 1 \relative { b4 d f g | }
     \volta 2 \relative { b4 d g  | }
   }
     }

works as intended, but:

     \repeat volta 2 {
   %% Here we replaced the repetition with an `unfold` repeat.
*  \repeat unfold 3 { \relative { c'4 e g r } | }*
   \alternative {
     \volta 1 \relative { b4 d f g | }
     \volta 2 \relative { b4 d g  | }
   }
     }

fails. The measure 5 appears before measure 4, the volta is misplaced
and alternatives are lost (see /bug_repeats__ok.pdf/).

To fix the issue I can put the /repeat unfold/ inside curly brackets:

     \repeat volta 2 {
   %% Here we put the `unfold` repeat inside curly braces.
*  { \repeat unfold 3 { \relative { c'4 e g r } | } }*
   \alternative {
     \volta 1 \relative { b4 d f g | }
     \volta 2 \relative { b4 d g  | }
   }
     }

Any idea why Lilypond behaves this way? Am I missing something?

It is a consequence of syntax compatibility to previously when
\alternative could follow a \repeat rather than be inside of its body.
So the last music before an in-\repeat \alternative must not be a
\repeat without \alternative or it will sweep up the \alternative for
itself.  As you noticed, braces are the proper workaround.


Re: Strange behavior of repeat unfold inside a repeat volta with alternatives.

2023-09-26 Thread David Kastrup
Stéphane SOPPERA  writes:

> I observed a strange behavior with a /repeat unfold/ inside a /repeat
> volta/ with /alternatives/. See the attached /bug_repeat__ok.ly/ for
> full source.
>
> Using Lilypond 2.24.1:
>
>     \repeat volta 2 {
>   %% Here we repeat three times the same music.
> *  \relative { c'4 e g r } |**
> **  \relative { c'4 e g r } |**
> **  \relative { c'4 e g r } |*
>   \alternative {
>     \volta 1 \relative { b4 d f g | }
>     \volta 2 \relative { b4 d g  | }
>   }
>     }
>
> works as intended, but:
>
>     \repeat volta 2 {
>   %% Here we replaced the repetition with an `unfold` repeat.
> *  \repeat unfold 3 { \relative { c'4 e g r } | }*
>   \alternative {
>     \volta 1 \relative { b4 d f g | }
>     \volta 2 \relative { b4 d g  | }
>   }
>     }
>
> fails. The measure 5 appears before measure 4, the volta is misplaced
> and alternatives are lost (see /bug_repeats__ok.pdf/).
>
> To fix the issue I can put the /repeat unfold/ inside curly brackets:
>
>     \repeat volta 2 {
>   %% Here we put the `unfold` repeat inside curly braces.
> *  { \repeat unfold 3 { \relative { c'4 e g r } | } }*
>   \alternative {
>     \volta 1 \relative { b4 d f g | }
>     \volta 2 \relative { b4 d g  | }
>   }
>     }
>
> Any idea why Lilypond behaves this way? Am I missing something?

It is a consequence of syntax compatibility to previously when
\alternative could follow a \repeat rather than be inside of its body.
So the last music before an in-\repeat \alternative must not be a
\repeat without \alternative or it will sweep up the \alternative for
itself.  As you noticed, braces are the proper workaround.

-- 
David Kastrup



Strange behavior of repeat unfold inside a repeat volta with alternatives.

2023-09-26 Thread Stéphane SOPPERA

Hi,

I observed a strange behavior with a /repeat unfold/ inside a /repeat 
volta/ with /alternatives/. See the attached /bug_repeat__ok.ly/ for 
full source.


Using Lilypond 2.24.1:

    \repeat volta 2 {
  %% Here we repeat three times the same music.
*  \relative { c'4 e g r } |**
**  \relative { c'4 e g r } |**
**  \relative { c'4 e g r } |*
  \alternative {
    \volta 1 \relative { b4 d f g | }
    \volta 2 \relative { b4 d g  | }
  }
    }

works as intended, but:

    \repeat volta 2 {
  %% Here we replaced the repetition with an `unfold` repeat.
*  \repeat unfold 3 { \relative { c'4 e g r } | }*
  \alternative {
    \volta 1 \relative { b4 d f g | }
    \volta 2 \relative { b4 d g  | }
  }
    }

fails. The measure 5 appears before measure 4, the volta is misplaced 
and alternatives are lost (see /bug_repeats__ok.pdf/).


To fix the issue I can put the /repeat unfold/ inside curly brackets:

    \repeat volta 2 {
  %% Here we put the `unfold` repeat inside curly braces.
*  { \repeat unfold 3 { \relative { c'4 e g r } | } }*
  \alternative {
    \volta 1 \relative { b4 d f g | }
    \volta 2 \relative { b4 d g  | }
  }
    }

Any idea why Lilypond behaves this way? Am I missing something?
\version "2.24.1"

\markup {
  \column {
\wordwrap  { Repeat \typewriter volta without inner repeat \typewriter 
unfold. }
\wordwrap  \bold { Work as intended. }
  }
}

\score {
  {
\tempo 4 = 140
\repeat volta 2 {
  %% Here we repeat three times the same music.
  \relative { c'4 e g r } |
  \relative { c'4 e g r } |
  \relative { c'4 e g r } |
  \alternative {
\volta 1 \relative { b4 d f g | }
\volta 2 \relative { b4 d g  | }
  }
}
\fine
  }
}

\markup {
  \column {
\wordwrap  { Repeat \typewriter volta with inner repeat \typewriter unfold. 
}
\wordwrap \bold { 
  Measure 5 appears before measure 4, the volta is misplaced 
  and alternatives are lost.
}
  }
}

\score {
  {
\tempo 4 = 140
\repeat volta 2 {
  %% Here we replaced the repetition with an `unfold` repeat.
  \repeat unfold 3 { \relative { c'4 e g r } | }
  \alternative {
\volta 1 \relative { b4 d f g | }
\volta 2 \relative { b4 d g  | }
  }
}
\fine
  }
}

\markup {
  \column {
\wordwrap  { Repeat \typewriter volta with inner repeat \typewriter unfold 
but 
 \bold { inside curly brackets }. }
\wordwrap \bold { Work as intended. }
  }
}

\score {
  {
\tempo 4 = 140
\repeat volta 2 {
  %% Here we put the `unfold` repeat inside curly braces.
  { \repeat unfold 3 { \relative { c'4 e g r } | } }
  \alternative {
\volta 1 \relative { b4 d f g | }
\volta 2 \relative { b4 d g  | }
  }
}
\fine
  }
}


bug_repeats__ok.pdf
Description: Adobe PDF document


Obscure message in Frescobaldi

2023-09-26 Thread Hajo Baess
This is not about a Lilypond problem, strictly speaking, but it is
related indirectly, and since here there are very many LilyPond users
around here, I also hope to address at least a couple of Frescobaldi
users here with an unanswered question, hoping that someone can solve
this for me:
I am localising Frescobaldi, and I am stuck with an obscure message
which I have never seen using it. It says:

Clear Grab

Since it is hard to translate something you don't understand: what is
this about? What is the context? What has been grabbed and can be
cleared? 

The message entry can be found in the messages.py file in the i18n
folder of Frescobaldi:

> _("QShortcut", "Clear Grab")

Thanks a lot for any suggestions to help me understand...



Alternating time signature with cue clef

2023-09-26 Thread Knute Snortum
TL;DR
How do I engrave an alternating time signature and an initial cue clef?

Scriabin has a prelude where he has written a time signature as alternating
5/8 and 4/8 time.  After the initial one, no other time signatures are
written. I have figured out a way to engrave this with help from a LSR
entry.

Also, the first notes in the right hand are in bass clef.  I want to
engrave the initial clef in the right hand as treble, then after the time
signature have a cue bass clef.  Lukas-Fabian Moser wrote a solution for
that (thanks!)

The problem is those two solutions don't work together. (Looking at them, I
can see why they wouldn't.)  I am not clever enough to merge the two
solutions or think of a third.  Can anyone help me?

I've attached a screenshot of what I'm trying to engrave.  Also attached is
my attempt to use the two solutions, but without success.

--
Knute Snortum
\version "2.24.2"

%%% Set queing bass clef after initial treble clef

% Append markup in the text property to the grob
#(define (append-markup grob old-stencil)
  (ly:stencil-combine-at-edge
old-stencil X RIGHT (ly:text-interface::print grob)))

trebleToBass = {
  \clef bass
  % Fake staff clef appearance
  \once \override Staff.Clef.glyph-name = "clefs.G"
  \once \override Staff.Clef.Y-offset = -1
  % Make sure any key signatures will printed with respect to
  % correct middle c position expected for treble clef
  \once \set Staff.middleCClefPosition = -6
  % Append change clef to the time signature
  \once \override Staff.TimeSignature.text = \markup {
\hspace #1.2
\raise #1
\musicglyph "clefs.F_change"
  }
  \once \override Staff.TimeSignature.stencil = #(lambda (grob)
(append-markup grob (ly:time-signature::print grob)))
}

%%% Alternating time 
#(define ((time-alternate-time upa downa upb downb) grob)
   (grob-interpret-markup grob
 (markup #:override '(baseline-skip . 0) #:number
   (#:line (
   (#:center-column (upa downa))
   (#:center-column (upb downb)))

upper = \relative {
  \trebleToBass
  \key bes \minor
  \partial 8 c'8
  \repeat unfold 4 { c8 c c c c | c c c c | }
}

lower = \relative {
  \key bes \minor
  \clef bass
  \partial 8 c8
  \repeat unfold 4 { c8 c c c c | c c c c | }
}

timeSignatures = {
  \override Score.TimeSignature.stencil = #(time-alternate-time "5" "8" "4" "8")
  \time 5/8
  \partial 8 s8
  \override Score.TimeSignature.stencil = ##f
  \repeat unfold 4 { \time 5/8 s4. s4 | \time 4/8 s2 | }
}

\score {
  \new PianoStaff <<
\new Staff \upper
\new Staff \lower
\new Devnull \timeSignatures
  >>
}

Re: shifting accidentals horizontally

2023-09-26 Thread Werner LEMBERG


> A possible solution for this could be to do a similar thing to add
> certain note columns to separate NoteCollision grobs, so they can be
> spaced independently.

I've added Valentin's solution as a new snippet to the LSR.

  https://lsr.di.unimi.it/LSR/Item?u=1=1172


Werner



Re: Is there a way to convert -- or evaluate -- a string to a pitch?

2023-09-26 Thread Valentin Petzel
Or alternatively (if you only need basepitch, not different octaves) you may 
avoid parsing and directly pull the pitch from the pitch name mapping (less 
powerful, but less chaotic and safer):

#(assoc-get (string->symbol "c") pitchnames)

or even (to avoid problems when changing language) from a specific language 
set:

#(assoc-get (string->symbol "c") (assoc-get 'nederlands language-pitch-names))

(if you need different octaves you might of course specify this one 
separately).

Evaluating strings passed from outside is a very good opportunity to allow 
injection of arbitrary code, as you can see here:

#(ly:parse-string-expression
  (ly:parser-clone)
  "#(system \"echo Doing evil stuff ...; killall lilypond\")")

Also this makes no guarantee on what type of thing you get back, it might not 
be a pitch! "c4" will evaluate to music, "(" will evaluate to a post event. 
Unexpected and malformatted stuff like "{" will result in an uncaught error.

Using

#(assoc-get (string->symbol "c") pitchnames)

on the other hand will guarantee that the result is either a pitch or #f if no 
valid pitch string was given (which then gives you the possibility of either 
falling back to a default / not applying certain things or to exit with an 
informative message.

Cheers,
Valentin

Am Sonntag, 24. September 2023, 23:09:33 CEST schrieb Jean Abou Samra:
> Try
> 
> (ly:parse-string-expression (ly:parser-clone) (getenv "FROM_KEY"))



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