Re: Conditional code in the midi block

2024-05-20 Thread David Kastrup
Jean Abou Samra  writes:

> Alternatively, you can do it more like you were envisioning, but for
> technical reasons, you have to start the Scheme code with $ , not # ,
> and you also have to include an extra \midi { } around the \context
> blocks (basically because \context outside \layout or \midi is a
> different command).


> The # vs $ issue is explained here:
> https://extending-lilypond.gitlab.io/en/extending/lily-and-scheme.html#hash-vs-dollar

No, it isn't.  What happens here is actually not as much a "technical
reason" as a design decision.  The difference between $ and # explained
in the manual entry is orthogonal to it.

Here is the rundown:

$ produces a token category based on the type of the expression.  That
means that the type of the expression can change the way the parser
parses an expression, and that can be important since the parser may use
lookahead to make its decisions, and that may mean that the type of the
token (and thus the underlying expression) may need to be known before
the previous expression is given its place in the grammar.

# does produce a single token category.  That means that the parsing can
go ahead without even knowing the value of the expression, and the
expression is only evaluated once its value is actually needed, making
for more predictable evaluation order.

That much is sort of in the manual.  But what isn't there is that
whenever # is going to be accepted, there must be an explicit rule in
the grammar accepting it, and that essentially means that when that rule
is considered applicable, the grammar is fixed.

That still is sort of in the manual.  But here is where the design
decision comes into play: Scheme may be executed for the purpose of
creating a side effect, like assigning a value to a variable.  When a
Scheme function is being called, it doesn't know whether its return
value is going to get used for anything, and a Scheme function executed
for its side effect may or may not return a meaningful value.

The most prominent side effect is a variable assignment.  So as kind of
a design rule, at any place in the grammar where you could conceivably
write an assignment, the value returned by #... is getting ignored
because the expression may only have been called for its side effect,
like an assigment.

Now $ should never be called just for a side effect (because it is kind
of a sledgehammer you should not be using unnecessarily).  Function
calls introduced by \ are explicitly declared to be of the kind where
LilyPond knows when it is supposed to be using the return value.  And
calling a variable by its name \... does not cause a side effect, so it
is safe to assume that you are not invoking its name for the purpose of
getting a side effect.

So this "I am ignoring the result in contexts where assignments may
occur" rule only is made to affect # as a way of invoking Scheme
expressions.

Where and how should we document/put this rationale so that future
contributors and power users are able to understand the current behavior
and make qualified decisions about future behavior?

I am not sold on this being the best/simplest/most logical that LilyPond
can be made to behave.  But at the current point of time, I don't know
how to do better.  And when someone wants to change it, I'd like them to
be aware of the rationale behind the current behavior.

-- 
David Kastrup



Re: Key signatures in MIDI output

2024-05-14 Thread David Kastrup
Giles Boardman  writes:

> Hello,
>
> I have figured "it" out - Cakewalk expects Key Signature to be in
> Track 0 of a Midi file and Lilypond puts it in whichever track has it
> in, which is much more sensible. I realized this while compiling the
> cry for help below, so I've left my workings out in the message, but
> that seems to be the long and short of it.

Using a tool to convert the MIDI file to format 0 (or what it was
called) might help?

-- 
David Kastrup



Re: Key signatures in MIDI output

2024-05-11 Thread David Kastrup
Giles Boardman  writes:

> You are, of course, right. Your evidence is clear. The position of the \key 
> command seems a strong candidate but I can't get it into the .MID even in the 
> simplest of snippet.
>
> As I mentioned I also have other behaviour I can't explain so it could also 
> be version related. I reinstalled the latest version I could find before the 
> release date of Windows 10, but it hasn't changed anything. I prefer to keep 
> my music-related work on a Windows 8.1 machine but that can  change .
>
> What I am trying to do is this:
>
> I have a big "library" of small, simple tunes that are variables, named for 
> their name and reference.
> I have "compiled" the library and found errors, which I have corrected.
> Now I can create medleys and audition them much more quickly than otherwise 
> possible by referring to the pieces by their variable name.
> Like this .
>
> \version "2.18.2"
> % \include "C:\[lilify]\+progress\jukeboxpart1v2.ly"
> % \include "C:\[lilify]\+progress\jukeboxpart2v1.ly"
>
> "1K002-1a-_WILLIE_SHAW" = { \mark "1K002-1a-" \time 4/4 \key d\major { \time 
> 1/8 \partial 8  g''8 \time 4/4 fis''16 d''8. b'8. d''16 a'4 fis'4 fis'16 a'8. 
> d''8. fis''16 g''16 e''8. e''8. g''16 fis''16 d''8. b'8. d''16 a'4 fis'4 
> \time 7/8 fis'16 a'8. d''8. e''16 fis''16 d''8. d''8 \bar ":|." } }
> \score {
> {
> \key d\major
> \"1K002-1a-_WILLIE_SHAW"
> }
>
>  \layout { }
>
>   \midi { }
> }

Filename: /tmp/xxx.midi
MIDI format:  1 (one or more simultaneous tracks)
Divisions:1536 per whole note
#Tracks:  2

Track 1:
Time 0:
Text:   creator: 
Text:   LilyPond 2.25.12  
Time signature: 1/8, metronome 1/8
Marker: 1K002-1a-
Tempo:  100 msec/quarter
Time 192: 
Time signature: 4/4, metronome 1/4
Time 4800: 
Time signature: 7/8, metronome 1/8
Time 6144: 
End of Track

Track 2:
Time 0:
Track name: \new:
Key signature: D major
Note on: Channel 0, G5(79)@90
Time 192: 
Note off: Channel 0, G5(79)
Note on: Channel 0, Fis5(78)@90
Time 288: 
Note off: Channel 0, Fis5(78)
Note on: Channel 0, D5(74)@90
Time 576: 
Note off: Channel 0, D5(74)
Note on: Channel 0, B4(71)@90
Time 864: 
Note off: Channel 0, B4(71)
Note on: Channel 0, D5(74)@90
Time 960: 
Note off: Channel 0, D5(74)
Note on: Channel 0, A4(69)@90
Time 1344: 
Note off: Channel 0, A4(69)
Note on: Channel 0, Fis4(66)@90
Time 1728: 
Note off: Channel 0, Fis4(66)
Note on: Channel 0, Fis4(66)@90
Time 1824: 
Note off: Channel 0, Fis4(66)
Note on: Channel 0, A4(69)@90
Time 2112: 
Note off: Channel 0, A4(69)
Note on: Channel 0, D5(74)@90
Time 2400: 
Note off: Channel 0, D5(74)
Note on: Channel 0, Fis5(78)@90
Time 2496: 
Note off: Channel 0, Fis5(78)
Note on: Channel 0, G5(79)@90
Time 2592: 
Note off: Channel 0, G5(79)
Note on: Channel 0, E5(76)@90
Time 2880: 
Note off: Channel 0, E5(76)
Note on: Channel 0, E5(76)@90
Time 3168: 
Note off: Channel 0, E5(76)
Note on: Channel 0, G5(79)@90
Time 3264: 
Note off: Channel 0, G5(79)
Note on: Channel 0, Fis5(78)@90
Time 3360: 
Note off: Channel 0, Fis5(78)
Note on: Channel 0, D5(74)@90
Time 3648: 
Note off: Channel 0, D5(74)
Note on: Channel 0, B4(71)@90
Time 3936: 
Note off: Channel 0, B4(71)
Note on: Channel 0, D5(74)@90
Time 4032: 
Note off: Channel 0, D5(74)
Note on: Channel 0, A4(69)@90
Time 4416: 
Note off: Channel 0, A4(69)
Note on: Channel 0, Fis4(66)@90
Time 4800: 
Note off: Channel 0, Fis4(66)
Note on: Channel 0, Fis4(66)@90
Time 4896: 
Note off: Channel 0, Fis4(66)
Note on: Channel 0, A4(69)@90
Time 5184: 
Note off: Channel 0, A4(69)
Note on: Channel 0, D5(74)@90
Time 5472: 
Note off: Channel 0, D5(74)
Note on: Channel 0, E5(76)@90
Time 5568: 
Note off: Channel 0, E5(76)
Note on: Channel 0, Fis5(78)@90
Time 5664: 
Note off: Channel 0, Fis5(78)
Note on: Channel 0, D5(74)@90
Time 5952: 
Note off: Channel 0, D5(74)
Note on: Channel 0, D5(74)@90
Time 6144: 
Note off: Channel 0, D5(74)
    End of Track

As you can see, the key signature is right with the content track (track
2) and right at the start.

You really need to figure out which part of your processing then loses
it.

-- 
David Kastrup



Re: Key signatures in MIDI output

2024-05-11 Thread David Kastrup
msk...@ansuz.sooke.bc.ca writes:

> On Sat, 11 May 2024, Giles Boardman wrote:
>
>> When I create MIDI output from Lilypond, if I have imported a MIDI file and
>> then resaved it with changes made in LilyPond, the output is like that, too.
>
> Lilypond as such does not import MIDI files.  I think you must be using
> some piece of software other than Lilypond, and that is relevant to the
> issues you're experiencing.
>
> On the off chance that you might be using midi2ly, I tried round-tripping
> my example code through that, and got suggestive results.

A good viewer of MIDI file content is

lilymidi --pretty

followed by the MIDI file name on the command line.

-- 
David Kastrup



Re: Key signatures in MIDI output

2024-05-11 Thread David Kastrup
Giles Boardman  writes:

> However, when I create new files, I am getting output that is as if I
> have chosen to write everything in C major, with all the flats and
> sharps shown explicitly. Nevertheless, the screen and pdf output are
> written in, for example G, with no sharps on the individual fis notes.

This is when further discussion becomes pointless without an actual
example illustrating the problem.

-- 
David Kastrup



Re: Key signatures in MIDI output

2024-05-10 Thread David Kastrup
Giles Boardman  writes:

> Hello,
>
> I am reading that I can create MIDI output which is different from the
> printed output. For example, I can unfold repeats in the midi output
> but use alternative endings and double barlines in my score. Awesome!
>
> So, I tried it and I notice that my MIDI output doesn't reflect the
> key signatures (everything is in C with accidentals) while my
> on-screen preview (even when I only have a midi block and no layout
> block) and the .pdf have sharps and flats at the beginning of the
> staff.
>
> The snippet about midi output in the documentation show the key
> signature as written in the example, but as mentioned, that doesn't
> mean it has made it into the MIDI file. Before I troubleshoot further,
> can anyone confirm what I should expect, please?

Key signatures are a facet of MIDI files, not of a live MIDI stream.  If
you play music via a sequencer, the sequencer knows the signature, the
instrument doesn't.

At least that's what I remember.

-- 
David Kastrup



Re: MIDI format and MIDI resolution

2024-05-09 Thread David Kastrup
Giles Boardman  writes:

> Is that "no, you can't tell me" or "no, it can't be done? (Just
> kidding). Thanks very much. It will save me spending time looking.

It is "it is hardwired into the source code to a degree where it would
require some really heavy lifting to make it adaptable".

It would be easier (but not trivial) to hardwire it to a different fixed
value, but then your copy of LilyPond would be incompatible with
everybody else's which is a maintenance nightmare, meaning that it
should only be attempted by people who are probably versed enough as
programmers as to be able to contribute a variable-size tick.

"it can't be done" is not a thing with Free Software.  It's more like
"if you have to ask, you may be the wrong person to do this as your
first project".

-- 
David Kastrup



Re: MIDI format and MIDI resolution

2024-05-09 Thread David Kastrup
Giles Boardman  writes:

> Hello,
> Can anyone tell me if it is possible to generate Midi format 0 files

No.

> and whether it is possible to control the resolution setting.

No.

> I have been standardising resolution for midi files from different
> sources and the value I chose is not the one output by Lilypond.

Why?  You can use MIDI processors to generate format 0 and change
resolution.

-- 
David Kastrup



Re: Markuplist and formatted text

2024-05-04 Thread David Kastrup
"Fr. Samuel Springuel"  writes:

> Okay, so then I need to break up the string to create separate markups
> (except in the critical location around the italics text:
>
> \version "2.24.3"
>
> \markuplist \wordwrap-lines { test test test test test test test test
> test test test test test test test test test test test test test test
> test test test test \concat { \italic { "italic text" }"," } test test
> test test test test test test test test test test test test test test
> test test test test test test test }
>
> I can’t seem to get \wordwrap-string to work in this context (even
> after switching \markuplist to \markup).  It barfs if \concat is
> inside of it (unrecognized escape string) and if it’s put inside
> \concat, then it only applies to the immediate string, not the
> resulting concatenated whole.

What is the actual problem you are trying to solve here?

-- 
David Kastrup



Re: Markuplist and formatted text

2024-05-04 Thread David Kastrup
"Fr. Samuel Springuel"  writes:

> Word wrapping does not appear to be functioning in this solution:
>
> \version "2.24.3"
>
> \markuplist \wordwrap-lines {\concat { "test test test test test test
> test test test test test test test test test test test test test test
> test test test test test test test test test test test test test
> "\italic { "italic text" }", test test test" }}
>
> The text just runs of the page to the right.

That is as intended.  \wordwrap-lines breaks between individual markups,
and you only have one.

You probably want \wordwrap-string (there is no \wordwrap-string-lines
though that would give you a markup list).

-- 
David Kastrup



Re: Markuplist and formatted text

2024-05-04 Thread David Kastrup
"Fr. Samuel Springuel"  writes:

> How do I get the comma (which is not italicized) attached to the
> italics text just before it?

You got your question answered by another use already, so I'll just add
that typesetters will usually tend to give punctuation the shape of the
word adjacent to it for typographical rather than logical wholesomeness.

That LilyPond makes it programmatically awkward to change shape without
intervening space is not intentional; rather it is a side effect from
punctuation usually being placed immediately adjacent to the preceding
word.

-- 
David Kastrup



Re: Trouble with concat in a markup command

2024-05-04 Thread David Kastrup
Alec Bartsch  writes:

> I'm attempting to write a markup command that, in addition to other
> formatting, strips a trailing # or b character off the end of the text
> argument and replaces it with the appropriate accidental markup. I think
> I'm super-close but stuck on the proper syntax for passing a markup list to
> the concat. Here's what I've got so far:
>
> #(define-markup-command (page-header layout props text) (markup?)
> "Page header style including optional trailing accidental"
> (let* (
> (last-char (string-ref text (1- (string-length text
> (prefix (substring text 0 (1- (string-length text
> )
> (interpret-markup layout props
> (markup #:override '(font-name . "Avenir Heavy") #:fontsize 5
> (make-concat-markup (cond
> ((char=? last-char #\#) (list prefix #:hspace 0.2
> #:fontsize -2.5 #:raise 0.6 #:sharp))
> ((char=? last-char #\b) (list prefix #:hspace 0.2
> #:fontsize -2.5 #:raise 0.6 #:flat))
> (else (list text))
> ))
> )
> )
> )
> )
>
> \markup \page-header "Key of Bb"

The markup macro is something that works so-soish.  As a macro, it
doesn't wait for its arguments to be evaluated but looks at them before
they are being evaluated.  It (hopefully) won't look inside a function
call like make-concat-markup.  #{ \markup ... #} tends to behave more
predictable if slower.  Fixing this up for your use case you'd write
something akin to

#(define-markup-command (page-header layout props text) (markup?)
"Page header style including optional trailing accidental"
(let* (
(last-char (string-ref text (1- (string-length text
(prefix (substring text 0 (1- (string-length text
)
(interpret-markup layout props
(markup #:override '(font-name . "Avenir Heavy") #:fontsize 5
(make-concat-markup (cond
((char=? last-char #\#) (list prefix (markup #:hspace 0.2
#:fontsize -2.5 #:raise 0.6 #:sharp)))
((char=? last-char #\b) (list prefix (markup #:hspace 0.2
#:fontsize -2.5 #:raise 0.6 #:flat)))
    (else (list text))
))
)
)
)
)

\markup \page-header "Key of Bb"


-- 
David Kastrup


Re: parenthesis around dot only (note value indication)

2024-05-01 Thread David Kastrup
Dirck Nagy  writes:

> Hi all
>
> I know this is highly unusual, but is there a way to add parentheses
> around the DOT ONLY after the notehead?
>
> see following image:
>
> [cid:85851784-8a26-48b0-b2b4-b9a8e03b517c]
> FYI, I have a piece with sequences of octaves.  Every instance has a
> note value of a dotted quarter-note.
>
> There is, however, one (only one!)  instance where the upper note
> cannot be held the full value, because it would be physically
> impossible to play.  I want to avoid splitting this into separate
> voices because it would clutter up the measure, (would require 4
> separate voices on one staff) and make reading more cumbersome.

Well, the "canonical" incantation expressing just what you want to do
would be

{
  4.
}

The problem is that this results in the left paren clashing with the
stem.  I haven't found a good fix for moving the dots.  Here is one
attempt at moving the parens instead:

{
  \tweak Dots.extra-spacing-width #'(.2 . .2)
  4.
}

Wish I could get the actual dots to move, but maybe someone else has an
idea for that.

-- 
David Kastrup



Re: How to manually set MIDI channel # for a staff?

2024-04-29 Thread David Kastrup
Jean Abou Samra  writes:

> Le lundi 29 avril 2024 à 06:31 -0500, Jason Yip a écrit :
>> Hi,
>> 
>> Does anyone know how to manually set the midi channel # for a staff to 
>> something other than the default of channel 0/1? Without having to 
>> create dummy staffs with just `s256` as the voice content preceding the 
>> desired staff? The staff in question usually only has one voice, so I 
>> modified the midi context as shown below simply made a bunch of dummy 
>> voices with only `s256` as the content so that they don't at least 
>> affect the graphical output:
>> 
>> ```
>>   \midi {
>>    \context {
>>  \Staff
>>  \remove "Staff_performer"
>>    }
>>    \context {
>>  \Voice
>>  \consists "Staff_performer"
>>    }
>>  }
>> ```
>
>
> You can do \set Score.midiChannelMapping = #'voice as an alternative to that.

We really need a plain simple way to set a fixed channel.  There is
enough hardware around using dedicated channels.

-- 
David Kastrup



Re: Overriding default text of \f, \p, etc.

2024-04-12 Thread David Kastrup
YTG 1234  writes:

> Hello List,
>
> I want to override the default text markup used with commands such as
> \f, \p, \mf, etc.
>
> However, trying to define f = #(make-dynamic-script ...) doesn't work
> because Lilypond interprets f as a note-name.

You could switch to Italian note names temporarily… Just kidding: the
sane solution of using quote marks has been already covered in two
replies.

-- 
David Kastrup



Re: English Note names alternatives

2024-04-06 Thread David Kastrup
"Fr. Samuel Springuel"  writes:

> I just discovered that in English, there’s a shorter way to name notes
> that would normally be specified with “-sharp” or “-flat”: “s” and
> “f”.  E.g. “f-sharp” can be written as “fs” and “b-flat” can be
> written as “bf”.
>
> However, I noticed that this is not documented in the Music Glossary:
> https://lilypond.org/doc/v2.24/Documentation/music-glossary/pitch-names. Only
> the “-sharp” and “-flat” name are mentioned there.  Is there a reason
> this behavior is not documented?  It is certainly much easier to type
> the shorter name than the longer one but I don’t want to rely on
> something that might break unexpectedly.

The glossary does not document LilyPond but common language.  It wrote
about "c-sharp" long before the English input language allowed the
spelling "c-sharp" (I think the original long name might have been
csharp).

-- 
David Kastrup



Re: Question regarding ChordNames

2024-03-13 Thread David Kastrup
John Helly  writes:

> Aloha.
>
> Here's an MWE to exhibit the issue.
>
> I have a flat note (bes) that I want to transpose down 4 half-tones to
> F#.  However, when the transpose is applied, the result is Gb.  I
> understand that a flat note was the initial value so maybe LP is
> preserving that specification?

In LilyPond there is no such thing as "transpose down 4 half-tones".
You transpose from one key to another, not by a distance.

> Nonetheless, short of re-writing the whole piece in A rather than C#,
> is there a way to specify the enharmonic representation for an F#
> rather than Gb, for example?
>
> bflat = \chordmode { bes1 }
> <<
> \transpose cis' a {
>  \new ChordNames { \bflat  }
> }
>>>

\transpose cis' a will remove 4 sharps, take -4 steps on the circle of
fifths.  If you'd rather add 8 steps on the circle of fifths (the
difference implying that the circle isn't actually a closed circle), you
need to write something like \transpose des' a instead.

-- 
David Kastrup



Re: Multiple connected slurs

2024-03-03 Thread David Kastrup
Gerardo Ballabio  writes:

> Hello,
> please what is the correct way to draw multiple slurs connected to
> each other? Look at example below to see what I mean (result
> attached).
>
> The following code does what I want but it gives multiple warnings like these:
>
> Parsing...
> slur.ly:4:3: warning: Unattached SlurEvent
> Interpreting music...
> slur.ly:4:13: warning: cannot end slur
>
> I tried using ties instead of slurs, that doesn't give warnings, but
> it doesn't look quite the same.
>
> Thanks
> Gerardo
>
> % slur.ly
> %%
> \version "2.24.1"
>
> \new Staff \relative {
>   ( c''1:32 ) | ( c1:32 ) | ( c1:32 ) | ( c4 ) r4 r2 |
> }
> %%

You need to use the correct syntax for slurs in the first place.  Both (
and ) come right after the note they connect to, and the reason for that
is exactly because it makes it easy to make properly connected adjacent
slurs.

You should not ignore syntax warnings LilyPond gives you: they indicate
a problem with your source file.

-- 
David Kastrup



Re: Adding to a tagGroup on the fly

2024-03-02 Thread David Kastrup
Simon Albrecht  writes:

> On 01.03.24 14:29, David Kastrup wrote:
>> Simon Albrecht  writes:
>>
>>> The downside of that is that I cannot add more tags to those groups on
>>> the fly, and always have to add them directly to the library file.)
>> Suggestions for a user interface to do that?
>>
>
> Interesting. Would of course require naming tag groups, right?

Just naming an existing member should be enough since taggroups are
exclusive.

-- 
David Kastrup



Re: extracting a single “vocal line” (including lyrics) from multiple variables

2024-03-01 Thread David Kastrup
Simon Albrecht  writes:

> The downside of that is that I cannot add more tags to those groups on
> the fly, and always have to add them directly to the library file.)

Suggestions for a user interface to do that?

-- 
David Kastrup



Re: extracting a single “vocal line” (including lyrics) from multiple variables

2024-02-29 Thread David Kastrup
Simon Albrecht  writes:

> This could be preferable if you can delineate the sections
> well. Trying out \partcombine quickly made me avoid it until
> absolutely necessary, but maybe it becomes manageable with clever and
> experienced use of \partCombineApart and friends. In choral pieces, I
> often use a single variable that contains all the lyrics, tagged
> depending on who does and doesn’t use which part and then filtered in
> the score setup. I believe that it makes a key difference to use both
> \keepWithTag _and_ \removeWithTag like this:
>
> 
> text = \lyricmode {
>   \tag A { on -- ly al -- to }
>   \tag nA { ev’ -- ry -- one ex -- cept al -- to }
> }
>
> \score {
> <<
> %{ simultaneous music expression with everything for soprano part %}
> \keepWithTag A \removeWithTag nA <<
>   \variableThatContainsAltoNotes
>   \addlyrics \text
>>>

I'd rather use

\tagGroup alto,non-alto

\lyricmode {
  \tag alto { on -- ly al -- to }
  \tag non-alto { ev’ -- ry -- one ex -- cept al -- to }
}

\keepWithTag alto ...
\keepWithTag non-alto ...

But one would need to look at the rest to see whether this kind of tag
group would end up problematic.

-- 
David Kastrup



Re: define-music-function with afterGrace and {}

2024-02-23 Thread David Kastrup
jca...@web.de writes:

> Good day,
>
> following snippet I need very frequently (with different notes instead
> of c4 and e4):
>
>\afterGrace c4 \glissando {\once \hide Stem \parenthesize e4}
>
>
> That's why I wanted to create a music function to shorten the
> expression. My previous attempt:
>
>graceGliss =
>#(define-music-function
>   (starttone endtone)
>   (ly:music? ly:music?)
>   #{
>     \afterGrace #starttone \glissando {\once \hide Stem
>\parenthesize #endtone}
>   #})
>
>
> doesn't work, Return Code 1.
>
> In order to test the general functioning of define-music-function, I tried:
>
>graceGliss =
>#(define-music-function
>   (starttone endtone)
>   (ly:music? ly:music?)
>   #{
>     \afterGrace #starttone #endtone
>   #})
>
>
> which works, what leads me to believe that the error must have something
> to do with the curly brackets {} …
>
>
> For some help I'd be very grateful!

Kind of stupid, but Scheme syntax is very simplistic (almost anything
except for parentheses needs to be space-separated) and your problem
here is that # goes into Scheme.

So you call upon one Scheme variable endtone} which does not exist.  Put
a space before the closing brace.

-- 
David Kastrup



Re: 5th anniversary conference? :)

2024-02-13 Thread David Kastrup
Kieren MacMillan  writes:

> Hello, Pond!
>
> I was just waxing nostalgic about that fabulous Salzburg conference in
> 2020, and noted that in Jan 2025 — just under a year from now! — it
> will have been five years since we got together, talked
> music/notation, and raised [more than] a few pints together.
>
> Any chance for a repeat? :)
>
> Just throwing it out into the Universe.

I'm just throwing out that my subletter has bought a house elsewhere and
moves out end of April.  The owner has let me know that I can stay here
till the end of June (he gets some rent and someone who feeds the horses
on most days).

I'm still looking for a new place, and it's not quite clear how long
I'll need.

That would not be a university setting.  It would also not be the first
time, though there is little personal overlap.

<https://web.archive.org/web/20130304040840/http://news.lilynet.net/?The-LilyPond-Report-28#impressions_from_the_waltrop_meeting>

There would be enough room to throw down sleeping bags.

Near Dortmund, within about 1.5hr of train distance from Düsseldorf and
Cologne.

It reeks like a foolish idea, for sure.  If your question hadn't had
this impeccable timing, I'd not have mentioned it.

Talk about waxing nostalgic!

-- 
David Kastrup



Re: Rest space in between fugue's voices

2024-02-10 Thread David Kastrup
Kieren MacMillan  writes:

> Hi George,
>
> [n.b. I’ve cc'ed the list, as per standard practice in the Lilypond 
> community.]
>
>> Thank you very much! It worked perfectly just by inserting "\tweak
>> X-offset #1" before the 16th rest in my original code
>
> Oh, great! I didn’t think to try only that tweak.
>
>> I didn't quite understand the reasons for changing \voiceFour and \voiceOne 
>> in the tenor part
>
> Lilypond’s \voiceX commands automatically set a lot of parameters
> (default stem/tie/slur direction, etc.) according to where the voice
> “sits” on the staff; the odd-numbered voices (\voiceOne, \voiceThree,
> etc.) act as if they are “on top” (so stems/ties/slurs go up), while
> even-numbered voices (\voiceTwo, \voiceFour, etc.) act as if they are
> “underneath” (stems/ties/slurs down, etc.).
>
> When the tenor voice is in the lower staff, it is on top, so \voiceOne
> makes the most sense (because there are only two voices); when it
> moves to the upper staff, it is (at least in your example) on the
> bottom, so \voiceFour makes the most sense (because \voiceTwo is
> already taken by the alto).

\voiceTwo is for the outermost low voice, so the alto may be better off
\voiceFour ?

-- 
David Kastrup



Re: Nested Keep_alive_together_engraver

2024-02-10 Thread David Kastrup
Julian Santander  writes:

> For the record, I believe I finally solved all my problems (with this
> particular score).
>
> About the problem I asked in my previous e-mail.
>
> The way Keep_alive_together_engraver works with the "remove-layer" property
> is confusing as it is used for two contradictory purposes removing layers
> and keeping layers and, in my case, I wanted to remove some layers but keep
> others.

For the record: remove-layer was designed as a low-level mechanism, not
a user interface.  As such, the focus was on making it versatile, not
simple to use.

But nobody has bothered defining particular use cases and giving them a
simple user interface.

-- 
David Kastrup



Re: Is this a sensible interface for temporary multiple clefs?

2024-02-05 Thread David Kastrup
Valentin Petzel  writes:

> Hello David,
>
> if I understand this correctly the intent here is to have different staff 
> behaviour in one staff. I believe that there might be a more general concept 
> here. Instead of creating a new context and mechanic to set additional clefs, 
> maybe it would make sense to have a more general concept of say sub staves, 
> which would allow us to do the same thing for a more general set of staff 
> features? So instead of
>
> \extraClef #-3 "bass" ...
>
> one could have
>
> \new SubStaff {
>   \override SubStaff.Clef.Y-offset = #-3
>   \clef "bass"
>   ...
> }
>
> This should then allow for similar things such as multiple individual 
> handlings of Accidentals, multiple bar lines, key signatures, lines and 
> brackets, ...

Have you ever seen any of those?

At the same point of time, a lot more needs to be done for an extra clef
than setting the Y-offset .  In terms of implementation, it would be
possible to split much of the work into a neutral "SubStaff" and context
mod, like doing

\new SubStaff \with \ExtraClef #-3 "violin"

but this still does not deal with reseating the current Voice to the
SubStaff and back afterwards, necessary for keeping beams and slurs
operative.  So there would need to be separate commands for that.

So instead of a targeted end-user feature limited to clefs, we are
talking about some fuzzy generic framework requiring an expert to cater
for the particular common use case.

There is something to be said for a more generic name/feature such as
SubStaff in terms of the context hierarchy, moving the necessary fixed
mods into a context mod.

-- 
David Kastrup



Is this a sensible interface for temporary multiple clefs?

2024-02-05 Thread David Kastrup
\version "2.25.10"

\header {
  tagline = ##f
}

\layout {
  \context {
\Staff
\accepts ExtraClefStaff
  }
  \context {
\name ExtraClefStaff
\type Engraver_group
\alias Staff
\accepts Voice
\consists Clef_engraver
\override Clef.font-size = #-4
%% The break-align-symbol stacks the extra clef to the right of
%% the normal clef
\override Clef.break-align-symbol = #'cue-clef
%% This break-visibility repeats the extra clef every bar.  Should
%% this be the actual default?  Or should the default just be
%% the normal #begin-of-line-visible ?
\override Clef.break-visibility = #end-of-line-invisible
%% different size for first clef in line is uncalled for
firstClef = ##f
  }
}

\midi {
  \context {
\Staff
\accepts ExtraClefStaff
  }
  \context {
\name ExtraClefStaff
\type Performer_group
\alias Staff
\accepts Voice
  }
}

extraClef =
#(define-music-function (offset clef-type) ((number?) string?)
  #{ \new ExtraClefStaff = "extraclef" { }
 \change Staff = "extraclef"
 #(if offset #{ \override Staff.Clef.Y-offset = #offset #})
 \clef #clef-type
 #})

all-clef-properties =
#(map (lambda (x) (ly:music-property x 'symbol))
  (extract-named-music (make-clef-set "treble_(8)") 'PropertySet))

extraClefEnd =
#(context-spec-music
  (make-apply-context
   (lambda (ctx)
 ;; Should be a given in context-spec-music
 (if (eq? (ly:context-name ctx) 'ExtraClefStaff)
	 (begin
	   ;; revert clef-specific settings in case some clef is still
	   ;; issued before the context dies: in that case it should
	   ;; correspond to the supervening Staff clef.
	   (for-each (lambda (p) (ly:context-unset-property ctx p))
		 all-clef-properties)
  	   ;; All children of the ExtraClefStaff are reseated to its
	   ;; parent context, removing it from the hierarchy
	   (let ((switch (ly:make-stream-event
			  (ly:make-event-class 'ChangeParent)
			  `((context . ,(ly:context-parent ctx))
	 (for-each
	  (lambda (x)
		(ly:broadcast (ly:context-event-source x) switch))
	  (ly:context-children ctx
	 (ly:programming-error "Not in ExtraClefStaff"
  'ExtraClefStaff)


\score {
\new Staff = "lower" {
\key d \minor
\numericTimeSignature
\time 3/4
\clef bass
\relative c' {
  \voices 1,""
<<
{
s2. r4 r8. \clef treble
\tuplet 3/2 16 { g'32 (a bes }
c8.) c16--
c16-- bes g a
g8. 
\omit TupletBracket
\tuplet 3/2 16 { f32 (g a }
bes8.) bes16
  } \\
{
  d,,,8.-- d16-- d2--~ 2.~
  \extraClef #-3 "bass"
  \voiceTwo
  2.~ \break 2.~2.
  \oneVoice
		  \extraClefEnd
		  c''2.
}
>>
}
}
}

If made built-in, it would affect several files and introduce a new
default context type.

I don't think it covers multiple simultanous main clefs (like sometimes
seen in compact mensural notation).  I am not sure that there'd be a
sensible common interface including this use case.

-- 
David Kastrup


Re: Compute \tempo from variables

2024-02-01 Thread David Kastrup
David Hobach  writes:

> Hi all,
>
> I'd like to compute the \tempo directive from variables, but couldn't
> yet figure out how to do it.
>
> For example, let's say I have two variables such as
> myTempoBase = 4
> myTempo = 80
>
> Then I'd like to do something such as
> global = {
>   \key c \major
>   \time 4/4
>   \tempo \myTempoBase = \myTempo
> }
>
> I'd expect it to resolve to \tempo 4 = 80. The above code however fails on 
> 2.24.1.
>
> Any ideas?

in \tempo 4 = 80 , the 4 is not a number but a duration.  This works
when writing

myTempoBase = ##{ 4 #}
myTempo = 80

global = {
\key c \major
\time 4/4
\tempo \myTempoBase = \myTempo
}

because ##{ 4 #} resolves to a duration rather than a number.

-- 
David Kastrup



Re: Numérotation des versets

2024-01-27 Thread David Kastrup
Silvain Dupertuis  writes:

> Thanks for the suggestion.
>
> This does provide a nice automatic numbering ...
> but does not repeat the verse number on subsequent lines.
>
> But I did recycle your suggestion using a modified function with one paramater
>
> #(define nextcountstanza
>    (let  ((counter 0))
>  (lambda (x)
>    (set! counter (+ x counter))
>    (string-append ( number->string counter)"."
>
> so that I can copy-paste these expressions instead of manually putting the 
> right number

Will only work for a single voice in a single piece as it uses a global
counter.

-- 
David Kastrup



Re: Incipit with default noteheads possible?

2024-01-24 Thread David Kastrup
Hajo Baess  writes:

> This works for the note heads, but if there happen to be accidentals
> around (in my project this is the case), they remain mensural style. Is
> there another override for this, too?
>
> Am Mittwoch, dem 24.01.2024 um 16:14 +0200 schrieb YTG 1234:
>> > I have tried an override ( \override
>> > Staff.NoteHead.style = #'default )
>> 
>> Note heads are drawn in Voice, so you can just omit the context name.
>> \override NoteHead.style = #'default
>> 
>> The more fundamental issue here, though, is that \incipit is
>> hardcoded 
>> to create a MensuralStaff context. Does anyone know how to replicate
>> its 
>> effect with a normal Staff, short of just substituting in its source
>> code?

How about this?

\version "2.24.2"

incipit =
#(define-music-function (incipit-music) (ly:music?)
  (_i "Output @var{incipit-music} as an incipit.

@var{incipit-music} is typeset within a @code{MensuralStaff} context; the result
is positioned before the main staff (as part of an @code{InstrumentName} grob)
to indicate the music's original notation.")
  #{
\once \override Staff.InstrumentName.stencil =
#(lambda (grob)
   (let* ((instrument-name (ly:grob-property grob 'long-text))
  (align-x (ly:grob-property grob 'self-alignment-X 0))
  (align-y (ly:grob-property grob 'self-alignment-Y 0)))

 (unless (and (music-is-of-type? incipit-music 'context-specification)
  (assq (ly:music-property incipit-music 'context-type)
(ly:output-find-context-def (ly:grob-layout grob) 'Staff)))
   ;; not a staff-like context
   (set! incipit-music (context-spec-music incipit-music 'MensuralStaff)))
 (set! (ly:music-property incipit-music 'create-new) #t)
 (set! (ly:music-property incipit-music 'property-operations)
   (append (ly:music-property incipit-music 'property-operations)
   `((push InstrumentName ,align-x self-alignment-X)
 (push InstrumentName ,align-y self-alignment-Y)
 (assign instrumentName ,instrument-name
 (set! (ly:grob-property grob 'long-text)
   #{ \markup \score { #incipit-music   
   \layout {
$(ly:grob-layout grob)
 indent-incipit-default = 15\mm
 line-width = #(primitive-eval
'(or (false-if-exception indent)
 indent-incipit-default))
 indent = #(primitive-eval
'(or (false-if-exception (- line-width incipit-width))
 (* 0.5 line-width)))
 ragged-right = ##f
 ragged-last = ##f
 system-count = 1
 }
   }
  #})
 (set! (ly:grob-property grob 'self-alignment-Y) #f)
 ;; Do 'self-alignment-X RIGHT only for the first InstrumentName, which
 ;; actually is the incipit. Otherwise self-alignment-X for the
 ;; shortInstrumentName is not longer settable.
 (let ((parts (ly:spanner-broken-into (ly:grob-original grob
   (if (and (pair? parts) (equal? grob (car parts)))
   (ly:grob-set-property! grob 'self-alignment-X RIGHT)))
 (system-start-text::print grob)))
#}
  )

\language "deutsch"

Incipit = \relative c'' {
	\clef treble \time 4/4
	\omit Staff.TimeSignature
	\hide Stem
	%\mark "A D FIS CIS"
	< a, d fis cis' >

}

noten =  \relative c'' {
	\clef treble \key f \major \time 4/4
	c4 d e f \bar "|."
}

\score {

	\new Staff
	<<
		\incipit \new Staff \Incipit
		\set Staff.instrumentName = "Violino discordato"
		\noten
	>>


	\layout {
		indent = 4\cm
		incipit-width = 1\cm
	}
}


-- 
David Kastrup


Re: Incipit with default noteheads possible?

2024-01-24 Thread David Kastrup
YTG 1234  writes:

>> I have tried an override ( \override
>> Staff.NoteHead.style = #'default )
>
> Note heads are drawn in Voice, so you can just omit the context
> name. \override NoteHead.style = #'default
>
> The more fundamental issue here, though, is that \incipit is hardcoded
> to create a MensuralStaff context. Does anyone know how to replicate
> its effect with a normal Staff, short of just substituting in its
> source code?

I think there might be a point in modifying incipit such that if it is
called as

\incipit \new staff-like-context ...

that it will not do a \new MensuralStaff but just take what is given,
add its specific context creation mods to any that might already be
there, and work with that.

-- 
David Kastrup



Re: { } not sounding right.

2024-01-19 Thread David Kastrup
Werner LEMBERG  writes:

>> I have a branch (from a few years ago) where I changed LilyPond's MIDI
>> microtonality from using Pitch Bends (which is a bad idea when using
>> chords) to using MIDI 1.0 tuning information. This works fine IIRC as
>> long as you don't construct chords containing really close notes
>> (e.g. c and c+5 cents).
>
> Sounds great.  Given that MIDI 2.0 is still rather new it probably
> makes sense to go this route.

Well, to put LilyPond into a bit more of a perspective, we are at GM1
level.  Supporting GM2 would mean fast-forwarding all the way into the
distant year 1999 (for GM2 v1.2a, even to 2007).

I actually use MIDI devices regularly that don't do GM2.

MIDI 2.0, in contrast, is from 2020.  It would be overoptimistic to
expect the average established musician to work with devices developed
as recent as that.  And it's not unreasonable to assume that many of
those interested in using the kind of workflow LilyPond offers would
pass as "old-school" and have a leaning towards old-school devices,
regardless of what biological age their ID might pronounce.

So in my book, offering support for GM2 _and_ other instrument/patch
schemes beyond GM1 would be more of a priority over going MIDI 2.0.

-- 
David Kastrup



Re: Drum notation and style

2024-01-19 Thread David Kastrup
Adrian  writes:

> Thanks for the reply, and apologies for not replying to all. However,
>
> \override Lyrics.LyricsText.font-name = "Font Name"
>
> returns the following warning:
>
> warning: not a grob name, `LyricsText'
>
> and doesn't alter the font.

It's actually LyricText .

-- 
David Kastrup



Re: chord

2024-01-18 Thread David Kastrup
Leo Correia de Verdier  writes:

> <\tweak duration-log 3 e, b, g e’>2

How about

apparent =
#(define-music-function (note) (ly:music?)
  (let ((duration (ly:music-property note 'duration)))
(tweak '(Dots dot-count) (ly:duration-dot-count duration)
(tweak '(duration-log) (ly:duration-log duration) note

{ <\apparent e,4 b, f e'>2 }

Of course it doesn't work to change the dotcount when the chord as such
has no dots scheduled.  I am also not convinced that this interface is
the best approach.

-- 
David Kastrup



Re: Error/warning when creating a piano reduction with lilypond 2.25.7 and frescobaldi 3.3.0

2024-01-15 Thread David Kastrup
Knute Snortum  writes:

> On Mon, Jan 15, 2024 at 5:28 AM David Kastrup  wrote:
>
>> Bernhard Kleine  writes:
>>
>> > Dear David,
>> >
>> > the file was created this morning from frescobaldi with the
>> > Partitur-Assistent and the pre-set version of Lilypond was 2.25.7.
>> > Nothing was done be myself apart from wrinting notes and lyrics.
>>
>> If the "Partitur-Assistent" creates those overrides, it needs to get fixed.
>>
>
> It has been:
>
> https://github.com/frescobaldi/frescobaldi/commit/fb79df399056ddd8ce2fa2b48ac36fc37bdc0588

Well, it's a start.  See my note about

git grep "override[^=]*#'[a-z]"

I get

TODO:  * drag an object to e.g. create an \override #'extra-offset command
frescobaldi_app/fonts/templates/musicfont-glyphs.ly:\override 
DynamicLineSpanner #'staff-padding = #2.0
frescobaldi_app/fonts/templates/musicfont-glyphs.ly:  \override 
BreathingSign #'text = \markup { \musicglyph #"scripts.rvarcomma" }
frescobaldi_app/fonts/templates/musicfont-glyphs.ly:  \override 
TrillSpanner #'direction = #DOWN
frescobaldi_app/fonts/templates/musicfont-glyphs.ly:  \override 
BreathingSign #'text = \markup { \musicglyph #"scripts.caesura.curved" }
frescobaldi_app/fonts/templates/musicfont-glyphs.ly:  \override 
BreathingSign #'text = \markup { \musicglyph #"scripts.caesura.straight" }
frescobaldi_app/fonts/templates/musicfont-glyphs.ly:  \override 
BreathingSign #'text = \markup { \musicglyph #"scripts.tickmark" }
frescobaldi_app/fonts/templates/musicfont-realbook.ly:\override Score.Clef 
#'break-visibility = #'#(#f #f #f)
frescobaldi_app/fonts/templates/musicfont-realbook.ly:\override 
Score.KeySignature #'break-visibility = #'#(#f #f #f)
frescobaldi_app/fonts/templates/musicfont-realbook.ly:\override 
Score.SystemStartBar #'collapse-height = #1
frescobaldi_app/scorewiz/scoreproperties.py:
ly.dom.Line(r"\override Staff.TimeSignature #'style = #'()", node)
frescobaldi_app/symbols/arpeggio_defaults.ily:\override StaffSymbol 
#'transparent = ##t
frescobaldi_app/symbols/arpeggio_defaults.ily:\override StaffSymbol #'width 
= #4
frescobaldi_app/symbols/arpeggio_defaults.ily:\override NoteHead 
#'no-ledgers = ##t
frescobaldi_app/symbols/arpeggio_defaults.ily:\override NoteHead #'stencil 
= #empty-stencil
frescobaldi_app/symbols/arpeggio_defaults.ily:\override Stem #'stencil 
=#empty-stencil
frescobaldi_app/symbols/bar_defaults.ily:\override StaffSymbol #'width = #'4
frescobaldi_app/symbols/bar_defaults.ily:\override StaffSymbol #'thickness 
= #1.2
frescobaldi_app/symbols/bar_kievan.ly:\override StaffSymbol #'width = #1.44
frescobaldi_app/symbols/bar_repeat_angled_double.ly:\override StaffSymbol 
#'width = #5.5
frescobaldi_app/symbols/bar_repeat_angled_end.ly:\override StaffSymbol 
#'width = #5.5
frescobaldi_app/symbols/bar_repeat_angled_start.ly:\override StaffSymbol 
#'width = #5.5
frescobaldi_app/symbols/bar_segno.ly:\override StaffSymbol #'width = #7
frescobaldi_app/symbols/bar_tick.ly:\override StaffSymbol #'staff-space = 
#(/ 7 8)
frescobaldi_app/symbols/clef_defaults.ily:\override StaffSymbol #'width = #4
frescobaldi_app/symbols/clef_tab.ly:\override StaffSymbol #'width = #4
frescobaldi_app/symbols/clef_tab.ly:\override StaffSymbol #'staff-space = #1
frescobaldi_app/symbols/clef_tab.ly:\override Clef #'font-size = #-3.5
frescobaldi_app/symbols/glissando_defaults.ily:\override StaffSymbol 
#'transparent = ##t
frescobaldi_app/symbols/glissando_defaults.ily:\override StaffSymbol 
#'width = #4
frescobaldi_app/symbols/glissando_defaults.ily:\override NoteHead #'stencil 
= #empty-stencil
frescobaldi_app/symbols/glissando_defaults.ily:\override Stem #'stencil = 
#empty-stencil
frescobaldi_app/symbols/glissando_defaults.ily:\override Stem #'length = #0
frescobaldi_app/symbols/glissando_defaults.ily:\override Glissando 
#'bound-details = #
frescobaldi_app/symbols/glissando_defaults.ily:  \override Glissando 
#'style = $style
frescobaldi_app/symbols/glissando_dotted.ly:\override Glissando #'thickness 
= #1.5
frescobaldi_app/symbols/spanner_beam16.ly:  \override NoteHead 
#'extra-spacing-width = #'(0 . 1.3)
frescobaldi_app/symbols/spanner_defaults.ily:\override StaffSymbol #'width 
= #4.4
frescobaldi_app/symbols/spanner_defaults.ily:\override StaffSymbol 
#'transparent = ##t
frescobaldi_app/symbols/spanner_melisma.ly:  \override Stem #'length = #3
frescobaldi_app/symbols/spanner_melisma.ly:  \override VerticalAxisGroup 
#'nonstaff-relatedstaff-spacing =
frescobaldi_app/symbols/spanner_phrasingslur.ly:\override Stem #'length = #0
frescobaldi_app/symbols/spanner_phrasingslur.ly:\override Stem #'direction 
= #DOWN
frescobaldi_app/symbols/spanner_phrasin

Re: Error/warning when creating a piano reduction with lilypond 2.25.7 and frescobaldi 3.3.0

2024-01-15 Thread David Kastrup
Bernhard Kleine  writes:

> Am 15.01.2024 um 14:28 schrieb David Kastrup:
>> Bernhard Kleine  writes:
>>
>>> Dear David,
>>>
>>> the file was created this morning from frescobaldi with the
>>> Partitur-Assistent and the pre-set version of Lilypond was 2.25.7.
>>> Nothing was done be myself apart from wrinting notes and lyrics.
>> If the "Partitur-Assistent" creates those overrides, it needs to get fixed.
>
> It does create them. Any idea how to get is fixed in this particular case?

Calling

git grep "override[^=]*#'[a-z]"

in the current Frescobaldi source tree delivers _way_ too many hits.  I
don't consider it sane that the current Frescobaldi will pump out
pre-2.18 syntax in droves in its templates.

And I suspect that it also splits overrides into multiple lines, making
it harder to recognize them.

-- 
David Kastrup



Re: Error/warning when creating a piano reduction with lilypond 2.25.7 and frescobaldi 3.3.0

2024-01-15 Thread David Kastrup
Bernhard Kleine  writes:

> Dear David,
>
> the file was created this morning from frescobaldi with the
> Partitur-Assistent and the pre-set version of Lilypond was 2.25.7.
> Nothing was done be myself apart from wrinting notes and lyrics.

If the "Partitur-Assistent" creates those overrides, it needs to get fixed.

-- 
David Kastrup



Re: Error/warning when creating a piano reduction with lilypond 2.25.7 and frescobaldi 3.3.0

2024-01-15 Thread David Kastrup
Bernhard Kleine  writes:

> The following MWE gave a warning
>
> C:/Users/bk/AppData/Local/Temp/frescobaldi-n7fp9iem/tmp_isr57mt/document.ly:52:25:
> Warnung: deprecated: missing `.' in property path StaffSymbol.staff-space
>
> I think maybe the frescobaldi is not aware of changes to this lilypond
> version. What do I have change to make the score compile without this
> warning?
>
> Kind regards
>
> Bernhard
>
> \version "2.25.7"

Do _NOT_ update the version header by hand.  That is the job of
convert-ly when it also updates the syntax of your file to a newer
version.

-- 
David Kastrup



Re: zero-duration s to hold marks

2024-01-15 Thread David Kastrup
Raphael Mankin  writes:

> As a more general response to this thread, I feel that the reference
> manual needs to have more cross references. I frequently get a bit
> lost trying to find a suitable construct, or discovering what a
> construct means.
>
> This thread has already shown that 1.2.2, 1.3.* and 1.5.* need to
> cross-reference each other.

Fortunately, this is Free Software.  If you feel there is a deficiency
in code or manual, you can contribute a patch to address it, and it is
likely to get accepted since volunteers contributing changes is actually
the only way in which LilyPond is getting improved.

-- 
David Kastrup



Re: zero-duration s to hold marks

2024-01-12 Thread David Kastrup
Raphael Mankin  writes:

> On 10/01/2024 10:35, msk...@ansuz.sooke.bc.ca wrote:
>> On Wed, 10 Jan 2024, Raphael Mankin wrote:
>> 
>>> That strikes me as being a programmer's response, and I speak as a 
>>> programmer
>>> for over 50 years. Using <> works, but it is unintuitive. If s0 is more
>>> intuitive then that should be considered for future inclusion.
>> It's intuitive to me that s0 means a spacer rest of infinite
>> duration,
>> because it's one whole note divided by zero.  And it opens the door
>> to using 0 as a duration denominator for other things than "s", as in "c0"
>> and "0", let alone constructions like "s0." which would seem to be
>> a spacer of one and one half times infinite duration.  I don't think it's
>> a good idea to open those doors.  There doesn't seem to be any way to
>> allow zero as the duration denominator except as a unique exception; it
>> cannot be done in a way that's consistent with other syntax.
>> 
> I agree that 0 as a denominator would seem to indicate an infinite
> duration, and allow the rest of your argument. However <> still seems
> unintuitive.

Well, there's been discussion about using z but then what would z with a
duration mean, and z is not just unintuitive in that you would not think
of writing it without knowing it but also unintuitive because you have
no way to know what it is when reading it.

<> at least is comprised of known elemeents.

-- 
David Kastrup



Re: zero-duration s to hold marks

2024-01-10 Thread David Kastrup
Jean Abou Samra  writes:

> Raphael:
>> That strikes me as being a programmer's response, and I speak as a
>> programmer for over 50 years. Using <> works, but it is unintuitive. If 
>> s0 is more intuitive then that should be considered for future inclusion.
>
> s1*0 works and is more or less equivalent to <> .

The counterexample is

\new Voice { c'4\< g' c'2 s1*0\! }
\addlyrics { What is this? }

This works when using <> instead.

-- 
David Kastrup



Re: Help with correct pitch after function call within \relative

2024-01-08 Thread David Kastrup
Artur Dobija  writes:

> Dear Experts,
>
> I am working on writing my own function which combines several notes into
> one custom symbol (ligature).
> (For the context, I now about Mensural_ligature_engraver, but I want to
> create something that will allow for more flexibility, as I try to engrave
> symbols as close to one of different manuscripts from different eras and by
> different hands)
>
> My code is like:
> \relative { a \customLigatura { b c d } f }
>
> In my approach, I want to remove all the notes except the first, which will
> receive the ligature stencil.

I can't figure out your function details, but assuming you have
sequential music mus that should (in \relative) follow relative rules
but only have the first note affect the sequence, you would wrap it in

(make-relative (mus) (make-music 'EventChord mus)
  ...)

This works by casting the expression to an EventChord before running it
through the \relative wringer (in case this occurs in \relative) but
making the permanent effect on \relative come from the first element.

The ... itself is never seen by \relative, only the EventChord is.  The
result can, of course, end up something that isn't a valid chord but it
is only used for passing through \relative and then thrown away.


-- 
David Kastrup



Re: Help with correct pitch after function call within \relative

2024-01-08 Thread David Kastrup
Artur Dobija  writes:

> Dear Lilypond-user,
> I sent this mail to the wrong mail, I should have send it to
> lilypond-user-requ...@gnu.org ! Sorry!

No, you sent it to the right address.  lilypond-user-request is the
address for sending list server commands.  Send it an Email with "help"
in the body and it will tell you what it can do for you.

-- 
David Kastrup



Re: Help using a Scheme variable in a function

2024-01-06 Thread David Kastrup
David Kastrup  writes:

> David Kastrup  writes:
>
>> Matthew Fong  writes:
>>
>>> I tried the following inside the function, and all generate errors. I would
>>> like to use the value of rubricsWidthSU in this override.
>>>
>>> \override #'(line-width . \rubricsWidthSU)
>>> \override #'(line-width . #rubricsWidthSU)
>>> \override #'(line-width . ,rubricsWidthSU)
>>
>> The third one is perfect once you fix the difference between ' ("quote")
>> and ` ("backquote").  , ("comma") is only heeded within a backquote.
>
> Oops, sorry.  The nomenclature is , ("unquote") rather than , ("comma").

Sigh.  And while I am at it: ` ("quasiquote") rather than ` ("unquote").

-- 
David Kastrup



Re: Help using a Scheme variable in a function

2024-01-06 Thread David Kastrup
David Kastrup  writes:

> Matthew Fong  writes:
>
>> I tried the following inside the function, and all generate errors. I would
>> like to use the value of rubricsWidthSU in this override.
>>
>> \override #'(line-width . \rubricsWidthSU)
>> \override #'(line-width . #rubricsWidthSU)
>> \override #'(line-width . ,rubricsWidthSU)
>
> The third one is perfect once you fix the difference between ' ("quote")
> and ` ("backquote").  , ("comma") is only heeded within a backquote.

Oops, sorry.  The nomenclature is , ("unquote") rather than , ("comma").

-- 
David Kastrup



Re: Help using a Scheme variable in a function

2024-01-06 Thread David Kastrup
Matthew Fong  writes:

> I tried the following inside the function, and all generate errors. I would
> like to use the value of rubricsWidthSU in this override.
>
> \override #'(line-width . \rubricsWidthSU)
> \override #'(line-width . #rubricsWidthSU)
> \override #'(line-width . ,rubricsWidthSU)

The third one is perfect once you fix the difference between ' (quote)
and ` (backquote).  , (comma) is only heeded within a backquote.

-- 
David Kastrup



Re: build a specific stable lillypond version with git

2024-01-04 Thread David Kastrup
CX  writes:

> Is it possible to build a specific stable lillypond version with sources
> retrieved by git clone instead of a source tarball download?
> If it is possible how can you do this (because I can not find the
> documentation to do it)?

The README in the repository references
<http://lilypond.org/doc/v2.25/Documentation/contributor/compiling>

Have you checked it?

In particular, setting it up from a clone appears to be described in
<http://lilypond.org/doc/v2.25/Documentation/contributor/configuring-make>

-- 
David Kastrup



Re: Voices, shifting and stem direction

2023-12-16 Thread David Kastrup
Jakob Pedersen  writes:

> Greetings!
>
> I've always struggled with multiple voice and getting things to align
> correctly. I assume there's some basic truth I'm missing.

\voiceOne is the topmost voice.  \voiceTwo is the bottommost voice.
\voiceThree is the voice below \voiceOne.  \voiceFour is the voice above
\voiceTwo.

The voices from the top (stem up) are counted 1, 3, 5, ...  The voices
from the bottom (stem down) are counted 2, 4, 6, ...

For anything exceeding two voices, this is not exactly intuitive.

-- 
David Kastrup



Re: Hide a note inside a drumscore

2023-12-13 Thread David Kastrup
Sebastien Richard  writes:

> Hello,
>
> How can I hide a note inside a drum score ? I tried following the doc here 
> https://lilypond.org/doc/v2.23/Documentation/notation/visibility-of-objects 
> but I did not managed to make it work
>
> Here is an example where I want to hide the snare :
>
> \version "2.24.2"
> up = \drummode {
>   \slurDown \grace {sn16 sn(} 4
> }
> \score {
>   \new DrumStaff
>   << \new DrumVoice { \voiceOne \up } >>
>   \layout {}
> }

You are thinking too complicated.

\version "2.24.2"
up = \drummode {
  \slurDown \grace {sn16 sn(} 4
}
\score {
  \new DrumStaff
  << \new DrumVoice { \voiceOne \up } >>
  \layout {}
}

But I consider it very likely that you actually don't want a slur but a
tie:

\version "2.24.2"
up = \drummode {
  \grace {sn16 sn_~} 4
}
\score {
  \new DrumStaff
  << \new DrumVoice { \voiceOne \up } >>
  \layout {}
}

-- 
David Kastrup



Re: lilypond "preprocessor"?

2023-12-12 Thread David Kastrup
Aaron Hill  writes:

> On 2023-12-12 1:04 pm, David Kastrup wrote:
>> Aaron Hill  writes:
>>> 
>>> #(define (add-midi-to-score score)
>>>   (define (has-midi? score)
>>> (any (lambda (x) (ly:output-def-lookup x 'is-midi))
>> Wouldn't that need to be (ly:output-def-lookup x 'is-midi #f) ?
>
> The default is to return '() which I thought was falsey.

In LISP it would be.  In Scheme, it isn't.  `any' is a Scheme function.

-- 
David Kastrup



Re: lilypond "preprocessor"?

2023-12-12 Thread David Kastrup
Aaron Hill  writes:

> On 2023-12-12 12:06 pm, Stefano Antonelli wrote:
>> On Tue, 2023-12-12 at 02:31 -0800, Aaron Hill wrote:
>>> Would this not work?
>>> 
>>> #(define (add-midi-to-score score)
>>>#{ \score { $score \midi {} } #})
>>> toplevel-score-handler =
>>> #(lambda (score)
>>>(collect-scores-for-book (add-midi-to-score score)))
>>> 
>> Indeed it does!
>> Without a \midi block one midi file is produced.
>> However, if there is already a \midi block, two midi files are
>> produced.  I'm not sure if that's going to be a problem aside from the
>> extra processing time.
>
> Any better?
>
> 
> #(define (add-midi-to-score score)
>   (define (has-midi? score)
> (any (lambda (x) (ly:output-def-lookup x 'is-midi))

Wouldn't that need to be (ly:output-def-lookup x 'is-midi #f) ?

>  (ly:score-output-defs score)))
>   (if (has-midi? score) score
> #{ \score { $score \midi {} } #}))

-- 
David Kastrup



Re: right enharmonic spelling

2023-12-09 Thread David Kastrup
Stefan Thomas  writes:

> Dear community,
> I'm using a lot frescobaldi with MIDI input. I would like to know is how
> could I achieve automatically the right enharmonic spelling. e.g. when I
> want to get bis instead of c'?

If I remember correctly, the MIDI entry box allowed you to set the key
it was working with.  Just bump the number of sharps until you like the
enharmonic spelling.

-- 
David Kastrup



Re: accessing current file name in markup function

2023-12-06 Thread David Kastrup
Valentin Petzel  writes:

> Am Mittwoch, 6. Dezember 2023, 23:10:11 CET schrieb Jean Abou Samra:
>> \version "2.24.2"
>> 
>> #(define-markup-command (foo layout props loc-provider) (ly:music?)
>>(display (ly:input-file-line-char-column (ly:music-property loc-provider
>> 'origin))) empty-stencil)
>> 
>> \markup \foo {{}}
>
> Maybe a bit less esoteric:
>
> \version "2.24.2"
>
> locationOf =
> #(define-scheme-function (which) (ly:music?)
>(apply format #f "~a:~a:~a:~a" (ly:input-file-line-char-column 
> (ly:music-property which 
> 'origin
>
>
> \markup { \locationOf {} }

Or even less esoteric:

\version "2.24.2"

locationOf =
#(define-scheme-function () ()
   (apply format #f "~a:~a:~a:~a" (ly:input-file-line-char-column (*location*


\markup { \locationOf }


-- 
David Kastrup


Booth on Chemnitzer Linuxtage 2024

2023-12-05 Thread David Kastrup


Hi,

if you think you'd like to help providing a booth on the Chemnitzer
Linuxtage 2024 (happening on the weekend March 16/17), please checkout
the CfP at
<https://chemnitzer.linux-tage.de/2024/en/programm/anmeldung/live>.

Note that companies but not community projects are charged for booths.
We'd need 2–4 persons manning the booth and prepare suitable
presentation material, and help people with questions and showcase
working on music and performance material.

If we have suitable people and can figure out a suitable goal, we could
think about offering a workshop.  I am not sure we'd get a talk slot
since I just held a LilyPond talk this year.  I'd probably try to land a
Shotcut video editor talk (I've not yet talked about key frames in
Shotcut which allow to the "smooth scrolling" stuff in videos like
<https://youtu.be/spAP7ODPCyg>).  Particularly if I get that talk in, it
would be good to have at least two more people for the booth.

There is a yearly bus organized from the Ruhr area if that helps.  The
conference is the largest in Germany with a similar theme (typically
about 2500 to 3000 visitors).

Interest?  The conference is a friendly meeting place, and presenters
get a nice social event on Saturday with catering.

-- 
David Kastrup



Re: Slur within a slur?

2023-12-03 Thread David Kastrup
Knute Snortum  writes:

> On Sat, Dec 2, 2023 at 6:44 AM Peter Mayes  wrote:
>
>> Here is a fragment of something I am engraving.
>>
>>   e( dis e ais, b g |
>>   e8) r \afterGrace d'!(\trill { cis32 d }  |
>>   c'!16) b^. a^. g^. fis^. e^. |
>>
>> The D following the \afterGrace is slurred up to the C at the beginning of
>> the following bar.
>>
>> I would also like the "{ cis32 d }" grace notes to be slurred, but if I
>> put "{ cis32( d) }", I get a "Warning: already have slur".
>>
>> Is there a way to get a "slur within a slur"?
>>
> When we ask for a MWE, the "w" stands for "working".  That is, you should
> be able to copy and paste the LilyPond source and get it to engrave.  You
> can't do that with your code, thus David Kastrup's reply.

It was probably easy to overlook, but my reply did contain the requested
functionality.  The output was not exactly pretty in most other regards.
I was both answering the question as well as making a point about the
example code.

Sometimes I don't answer questions at all because I am not in the mood
to write a complete example myself for the sake of someone else.  In
this case, I decided to just go with what was given and in that manner
show that a better prepared question would have made for a better
recognizable answer.

The actual recipient of the answer did get the solution.  It just
appears that I confused other readers.

Sorry for that.

-- 
David Kastrup



Re: Slur within a slur?

2023-12-02 Thread David Kastrup
Peter Mayes  writes:

> Here is a fragment of something I am engraving.
>
>   e( dis e ais, b g |
>   e8) r \afterGrace d'!(\trill { cis32 d }  |
>   c'!16) b^. a^. g^. fis^. e^. | 
>
> *
>
> The D following the \afterGrace is slurred up to the C at the beginning of the
> following bar.
>
> I would also like the "{ cis32 d }" grace notes to be slurred, but if I put 
> "{ cis32( d) }", I
> get a "Warning: already have slur".
>
> Is there a way to get a "slur within a slur"?
>
> Thanks in advance

Writing

{
  e( dis e ais, b g |
  e8) r \afterGrace d'!(\trill { cis32\=1( d\=1) }  |
  c'!16) b^. a^. g^. fis^. e^. | 
}

gives me


and a bar check warning.

-- 
David Kastrup


Re: suggestion for slur?

2023-11-24 Thread David Kastrup
Mario Bolognani  writes:

>\override TrillSpanner.bound-details.left.text = #'()
>   \startTrillSpan
>  works for 2.24 
>
> This is an acceptable result :

What piece of standalone code got you get this output?  Without
providing any code to experiment with, you easily require 10-fold the
amount of work for anybody willing to help you.  That decreases your
chances of finding volunteers to make useful suggestions.

-- 
David Kastrup



Re: Emacs Mode Problem with includes

2023-11-14 Thread David Kastrup
Laurie Savage  writes:

> Thanks David,
>
> I think I'll stay with Frescobaldi! Emacs doesn't seem to edit .ly files
> any more easily so there isn't much advantage in tweaking it to behave with
> my customised Include files. As for your question about where I found the
> documentation for the location of my Includes: Options > Customise Emacs ->
> All Settings Matching > "lilypond".
>
> It's a shame, I found Emacs to be the best LaTeX editor I tried.

Yes, there is really no comparison.

Emacs has better MIDI recognition than Frescobaldi, and editing
Scheme-only files is nicer.  And it blows the socks off anything as a
viewer for Lilypond's Info documentation.

I use Emacs for editing LilyPond because I am used to working with Emacs
for everything.  But the LilyPond mode is really not holding a candle to
what Frescobaldi offers.

-- 
David Kastrup



Re: top-level `\midi` doesn't work as expected

2023-11-12 Thread David Kastrup
Werner LEMBERG  writes:

> +A @code{@bs{}midi} block outside of @code{@bs{}score} does
> +@emph{not} create a MIDI file.}

MIDI settings can be changed globally (or in a book or bookpart), but
the generation of an actual MIDI file is only triggered when a \midi
block is encountered inside of a \score .

Something like that.  It doesn't help the user as much when you tell
them what doesn't create a MIDI file: after all, they will rather be
looking at how to create one.

-- 
David Kastrup



Re: Cent rit between staves

2023-11-09 Thread David Kastrup
Robin Bannister  writes:

> Will Turner wrote:
>> Thank you. I've been using Lilypond for only a couple weeks. 
>
> This automatic conversion will give you the wrong impression about how
> readable Lilypond code can be.
>
>
>
> I thi[nk] this is
>> the text I should insert:
>> \new Dynamics{
>> s93-"rit." |
>> }
>
> But this code will start the rit when the s93 starts.
> To start the rit when the s93 has finished, insert an empty chord
>{ s93 <>-"rit." }

No such thing as s93.  Maybe s1*93 was meant instead?

-- 
David Kastrup



Re: Two small issues

2023-11-02 Thread David Kastrup
Peter Mayes  writes:

> Ideally what I want is the first version, but with the stave extending
> just enough to go through the key signature.

Could you live with the following?

{
  \key c\minor
  c'1
  \key c\major
  \once\override Score.BreakAlignment.break-align-orders =
  #(grob-transformer 'break-align-orders
(lambda (grob break-align-orders)
 (vector
  (vector-ref break-align-orders 2)
  (vector-ref break-align-orders 1)
  (vector-ref break-align-orders 2
  \bar "||"
}
It tells LilyPond to end the line formatted in a way as if it continued
to the next line.  This puts the key cancellation _before_ the bar line.

-- 
David Kastrup


Re: Show TacetStaff when StaffGroup empty

2023-11-01 Thread David Kastrup
Jeff Olson  writes:

> On 11/1/2023 6:37 AM, David Kastrup wrote:
>> <https://events.williams.edu/event/viennese-bass-lecture-demo-bret-simner/>
>
> Thanks, David. Now I'm really smiling to have learned something new!
> Your knowledge is more encyclopedic than Wikipedia.

That claim is more of a stretch than a gut string, I am afraid.

-- 
David Kastrup



Re: Show TacetStaff when StaffGroup empty

2023-11-01 Thread David Kastrup
Jeff Olson  writes:

> On 11/1/2023 6:37 AM, David Kastrup wrote:
>> <https://events.williams.edu/event/viennese-bass-lecture-demo-bret-simner/>
>
> Thanks, David. Now I'm really smiling to have learned something new!
> Your knowledge is more encyclopedic than Wikipedia.
>
> I once mail-ordered a fretted u-bass but exchanged it for the fretless
> style, which I find easier to play (lighter touch) and more
> expressive.  Intonation can even be better on fretless as the strings
> can develop nonuniformities in density. Wonder if that's why those
> fretted basses from the 1770's died out?

I think it is more likely due to vibrato having become a tenet of string
sound (partly because it hides the fundamental problem of intonation)
and frets considerably reduce the amount and change the character of
vibrato (I know that you can bend the pitches of the sitar a whole lot,
but the character of its frets is quite different).

Viols were used much more polyphonically than modern bowed strings, so
vibrato wasn't really an option and the frets improved intonation more
than they deteriorated it.

For plucked/hammered/struck strings, the mathematical time/frequency
unsharpness relation makes the intonation stand out less because of the
tone decay (for example, few people notice that pizzicato strings sound
higher than when they are bowed).

-- 
David Kastrup



Re: Show TacetStaff when StaffGroup empty

2023-11-01 Thread David Kastrup
Jeff Olson  writes:

> The only reason I cc'd Harm was that he was one of five listed under
> Documentation in http://lilypond.org/authors.html, and in previous
> posts he had identified himself as a [fellow] classical guitarist.  So
> I imagined he might smile, as I did, at seeing the double bass listed
> among fretted instruments.

<https://events.williams.edu/event/viennese-bass-lecture-demo-bret-simner/>

-- 
David Kastrup



Re: Show TacetStaff when StaffGroup empty

2023-10-31 Thread David Kastrup
Jean Abou Samra  writes:

> Le mardi 31 octobre 2023 à 20:40 +0100, David Kastrup a écrit :
>
>> > I'm not the OP but that is excellent documentation, save for one word:
>> > 
>> > 
>> > "In the following example, staves devoted to wind instruments are
>> > removed in the second system; however, the double bass is not,
>> > because it is part of the larger group of *fretted* strings, which
>> > is playing."
>> > 
>> > 
>> > That larger group in the example consists of Violin I, Violin II,
>> > Alto, Cello, Double bass.
>> > 
>> > 
>> > Nothing to fret about, unless you're in documentation, eh Harm?
>> 
>> I know Harm as a pretty good fretted string instrument player.  Probably
>> this should just be "strings" which it typically associated with the
>> kind of instruments listed there and has the advantage that you don't
>> get into trouble for a) pizzicato (which is weird for "bowed strings")
>> or b) viol (which is both bowed and fretted and may be used in a string
>> section for nostalgically informed practice).
>
>
> Why is the blame being put on Harm here?
>
>
> ```
> commit 8c166ecb8d1049c3c54f0488dbcbe22de6eb6a51
> Author: Jean Abou Samra 
> Date:   il y a 3 ans et 5 mois
>
>
> Add dynamic-interface to keepAliveInterfaces
> 
> This will prevent \Remove[All]EmptyStaves from removing
> Dynamics contexts containing dynamics attached to spacer
> rests but no actual notes (the standard use case
> for a Dynamics context). Also improve the documentation
> about \RemoveEmptyStaves and \RemoveAllEmptyStaves.
> ```
>
>
>
> (That was my first patch.)
>
>
> Given that I was way less comfortable with English at the time
> than I am today, it is possible that I fell into the trap of a
> false cognate: the French "cordes frottées" sounds similar to
> "fretted strings" but in fact means "bowed strings".

Well, maybe I had the wrong reading of the posts here.  Hopefully not
the wrong writing.

<https://gitlab.com/lilypond/lilypond/-/merge_requests/2158>

-- 
David Kastrup



Re: Show TacetStaff when StaffGroup empty

2023-10-31 Thread David Kastrup
Jeff Olson  writes:

> On 10/30/2023 11:27 AM, Michael Werner wrote:
>> This is based on
>> http://lilypond.org/doc/v2.25/Documentation/notation/hiding-staves
>
> I'm not the OP but that is excellent documentation, save for one word:
>
>"In the following example, staves devoted to wind instruments are
>removed in the second system; however, the double bass is not,
>because it is part of the larger group of *fretted* strings, which
>is playing."
>
> That larger group in the example consists of Violin I, Violin II,
> Alto, Cello, Double bass.
>
> Nothing to fret about, unless you're in documentation, eh Harm?

I know Harm as a pretty good fretted string instrument player.  Probably
this should just be "strings" which it typically associated with the
kind of instruments listed there and has the advantage that you don't
get into trouble for a) pizzicato (which is weird for "bowed strings")
or b) viol (which is both bowed and fretted and may be used in a string
section for nostalgically informed practice).

-- 
David Kastrup



Re: Formatting for a tie

2023-10-29 Thread David Kastrup
Jean Abou Samra  writes:

> Le samedi 28 octobre 2023 à 21:21 -0400, Samuel Sloniker a écrit :
>> How can I format this tie in Lilypond? I'm writing a Lilypond file for an
>> existing song; this image is from a scan of a hymnal.
>
>
> If you are having trouble finding the answer to this in the
> documentation or Web searches, it's because the term for this bow is “
> slur” (not “tie”). A tie is between two notes having the same pitch,
> and makes the second silent so that the first one is effectively
> prolonged.

Not every instrument is purely percussive, and even most percussive
instruments have some way of ending a note and/or providing for letting
it decay naturally.  Your description makes it sound as if there is no
difference between a rest and a note continued by a tie.

-- 
David Kastrup



Re: Pickup measure

2023-10-28 Thread David Kastrup
Hans Aikema  writes:

> @David Actually my results (MacPorts lilypond 2.24.2 and 2.25.8) differ from 
> what you report..
>
> PartPOneVoiceOne =  \relative fis' {
> \clef "treble" \time 3/4 \key d \major | % 1
> \tempo "Prayerfully" 4=69 \stemUp fis4 s2 ^\markup{ \bold\large
> {Abide with Me; ’Tis Eventide} } ^\markup{ \bold\large { } } ^
> "Hymn 165" | % 2
>
> The s2 gets inserted for me by musicxml2ly

Ah, you are right.  What musicxml2ly doesn't do, however, is inserting
any \partial.  So the rhythm does not go bonkers because there isn't a
partial measure to start with.

I am not able to properly judge this from the MusicXML: how does this
appear to Finale?  In particular, where does measure 1 start?  With the
"partial" measure or the first full measure?

-- 
David Kastrup



Re: Pickup measure

2023-10-28 Thread David Kastrup
Will Turner  writes:

> Thank you, David. Attached is the Musicxml file. I also need to find a way
> for Frescobaldi to import this file as a choirstaff rather than a piano
> staff.. This is so that the cross-staff bar lines are hidden. If you have
> suggestions for that, please let me know. Otherwise, I'll submit a new
> request for help.

Well, musicxml2ly converts the rhythmic structure just fine.  Headers
and footers look somewhat messy, and there is an extraordinary amount of
power chords (essentially, everything that isn't a seventh chord) that I
consider suspect.

I think Frescobaldi has its own MusicXML converter: if that is what you
have been using, you should file a problem report with Frescobaldi
rather than LilyPond.

-- 
David Kastrup



Re: Pickup measure

2023-10-28 Thread David Kastrup
Will Turner  writes:

>> On Sat, Oct 28, 2023 at 4:26 AM David Kastrup  wrote:
>>
>>> Will Turner  writes:
>>>
>>> > Here is my code:
>>> > PartPOneVoiceOne =  {
>>> > \clef "treble" \time 3/4 \key d \major | % 1
>>> > \tempo "Prayerfully" 4=69 \stemUp \partial 4 fs'4 s2
>>> >
>>> > And that gives me the problem I described.
>>>
>>> What's the s2 at the end supposed to be for?
>
> I imported this from a Musicxml file that I exported from Finale.

That's sort of important information that you omitted.

> So, Finale put the s2 at the end, but I don't know why.

Or Finale didn't, and musicxml2ly made a mistake.  In which case this
would warrant fixing.  Do you have the MusicXML available?

> Y'all are my heroes. I removed the s2 from the first measure in both
> clefs, and it solved my problem.  Where do I send the check? ;)

My bank actually refuses cashing foreign country checks these days, so
I cannot avail myself of this particular offer.  While I like the
prospect of a simple recurring source of income, I think it would be
more desirable in the long run to make sure that pickup measures travel
with some reliability from Finale into LilyPond.

So it would be good to take a look at the involved MusicXML.

-- 
David Kastrup



Re: Pickup measure

2023-10-28 Thread David Kastrup
Will Turner  writes:

> Here is my code:
> PartPOneVoiceOne =  {
> \clef "treble" \time 3/4 \key d \major | % 1
> \tempo "Prayerfully" 4=69 \stemUp \partial 4 fs'4 s2
>
> And that gives me the problem I described.

What's the s2 at the end supposed to be for?

-- 
David Kastrup



Re: Pickup measure

2023-10-27 Thread David Kastrup
Will Turner  writes:

> I imported a Musicxml file of a hymn. The first measure is a pickup measure
> but it imports as a full measure 3/4 with only a quarter note in it. You
> can see that the measure appears to contain room for 3 beats instead of
> one. When I play this in Musescore, it plays as a pickup measure, and the
> measure doesn't have all that space in it.
>
> [image: image.png]
>
> Using \partial 4 on the first measure, I'm trying to make the existing
> first measure look like a pickup measure and, if possible, actually be a
> pickup measure. The result I get looks like this. It redistributes the
> other measures and the end of every line is now a pickup measure. How do I
> make only the first measure a pickup measure?
>
> [image: image.png]

I suspect you write something like

{ \time 3/4 c'4 \partial 4 ...

when you would need to write

{ \time 3/4 \partial 4 c'4 ...

Namely, you need to write \partial 4 _before_ the partial measure, not
after it.

-- 
David Kastrup



Re: Tuplet brackets too short?

2023-10-20 Thread David Kastrup
Mark Knoop  writes:

> At 05:33 on 20 Oct 2023, Werner LEMBERG wrote:
>>> Shouldn't both tuplet brackets span every notecolumn within the
>>> purview of the last note's duration?
>
>> Yes, at least according to Gould.  Using `tupletFullLength` helps, but
>> now tuplet brackets are too long:
>
> Since 2.25 there is also:
>
>   \override TupletBracket.span-all-note-heads = ##t
>
> which I think does the right thing, at least in the Gould
> "old-style".

Not with regard to the problem I describe.

> Surely this should be the default?

Different problem, different question.

-- 
David Kastrup



Tuplet brackets too short?

2023-10-19 Thread David Kastrup

If I write

\new Staff
{ \time 2/4
  << \tuplet 3/2 { c''4 d'' c'' } \\ \tuplet 3/2 { g'4 a'2 } >>
}

the results look awful:


Shouldn't both tuplet brackets span every notecolumn within the purview
of the last note's duration?  I think this might also apply if the upper
voice contained 4 eighths instead of the three triplets:



-- 
David Kastrup


Re: Where is my tuplet bracket?

2023-10-17 Thread David Kastrup
Werner LEMBERG  writes:

>> \new Staff {
>>   \key c \minor
>>   < es' g' > < bes' d''~ >2. |
>>   \tuplet 3/2 \voices "",2 << { \voiceOne d''4 c'' es'' \oneVoice } \\
>>{ g'4 as'2 } >>
>>   < f' as' >4  |
>> }
>
> Looks like a bug, so please file a report.

The problem is that I don't know where to locate the bug.  The
difference appears to be that \voices creates a \context Staff wrapper
around the parallel construct.  I suspect that the idea is to help with
continuing voices, like if you compare the outputs of

{ << { \voiceOne e'2~ \oneVoice } \new Voice { \voiceTwo c'2 } >> e'2 }

{ \voices "",2 << { \voiceOne e'2~ \oneVoice } \\ c'2 >> e'2 }

The second clearly looks more sensible, but if you look closely, there
still isn't a tie, so the voice does not actually continue in this
situation.  So this situation still is not helped in any manner, and the
one thing \voices has over unadorned << \\ >> is that it takes named
contexts.

Clearly this discrepancy is worth removing; I just don't know right now
why it exists in the first place.  I must have been thinking something.™

Now independent from the two constructs differing by a \context Staff
wrapper (added in voicify-music in scm/music-functions.scm).

What is additionally puzzling is that either change is accomplished by
voicify-music, so why is one use affected and the other not?  Or does
this happen when voicify-music is applied multiple times (the second
time during scorification)?

All this appears mostly unrelated to \tuplet tripping over one but not
the other incantation.

-- 
David Kastrup



Re: Where is my tuplet bracket?

2023-10-16 Thread David Kastrup
William Rehwinkel  writes:

>> On 10/16/23 19:09, David Kastrup wrote:
>>> William Rehwinkel  writes:
>>> 
>>>> Dear David,
>>>>
>>>> This seems like an improper/unintended use of \tuplet.
>>> How so?
>>> How is
>>>\tuplet 3/2 \voices "",2 << { \voiceOne d''4 c'' es'' \oneVoice }
>>> \\
>>>   { g'4 as'2 } >>
>>> improper while
>>>\tuplet 3/2  << { \voiceOne d''4 c'' es'' \oneVoice }
>>> \new Voice { \voiceTwo g'4 as'2 } >>
>>> isn't?  Either one does not create a new voice context for the upper
>>> line, as the tie reaching into the upper voice (here omitted) proves.
>> 
>
>
> I don't know, but what I meant to say is that this use of \tuplet
> outside of \voices or a split into multiple voices seems to me to be
> "undefined behavior" ("unspecified"?).

Says who?  Are you saying that your proposed variant is wrong as it does
not differ in that regard?

-- 
David Kastrup



Re: Where is my tuplet bracket?

2023-10-16 Thread David Kastrup
William Rehwinkel  writes:

> Dear David,
>
> This seems like an improper/unintended use of \tuplet.

How so?

How is

  \tuplet 3/2 \voices "",2 << { \voiceOne d''4 c'' es'' \oneVoice } \\
  { g'4 as'2 } >>

improper while

  \tuplet 3/2  << { \voiceOne d''4 c'' es'' \oneVoice }
\new Voice { \voiceTwo g'4 as'2 } >>

isn't?  Either one does not create a new voice context for the upper
line, as the tie reaching into the upper voice (here omitted) proves.

-- 
David Kastrup



Where is my tuplet bracket?

2023-10-16 Thread David Kastrup
\new Staff {
  \key c \minor
  < es' g' > < bes' d''~ >2. |
  \tuplet 3/2 \voices "",2 << { \voiceOne d''4 c'' es'' \oneVoice } \\
			  { g'4 as'2 } >>
  < f' as' >4  |
}

Admittedly, this is still better than the warning and crash an earlier
version rather than current master puts out.

But now there is neither warning nor crash.

-- 
David Kastrup


Re: Is there a glyph? (or something) to indicate a clap in a vocal piece?

2023-10-16 Thread David Kastrup
Kenneth Wolcott  writes:

> Hi;
>
>   On a related note (pun not intended!) I have seen a Tuba solo score
> where there is a notation to "slap" the instrument, shown as literally
> a "slap" like a "rit." or ".cresc.". I was wondering how to engrave
> that...other than the obvious...

For tuba solo I think it would be important to indicate that one is
supposed to slap the instrument rather than the player.

-- 
David Kastrup



Re: Is there a glyph? (or something) to indicate a clap in a vocal piece?

2023-10-16 Thread David Kastrup
Kevin Cole  writes:

> On Mon, Oct 16, 2023 at 8:33 AM David Kastrup  wrote:
>>
>> Kevin Cole  writes:
>>
>> > I'm transcribing a pub song, and at one point, there's a lyric
>> > "(clap)(clap)" with "X X" on the staff.
>> >
>> > I've seen that one can have a "\drum {hc4 hc4}" but I want something like a
>> > layout of "| e4. a4. | X X g8 |" in 6/8 time all on one staff -- which I
>> > guess in MIDI would probably be something like "r8 hc8 r8 hc8 r4" in a drum
>> > track (voice?) for that measure with the claps...
>>
>> Something like
>>
>> \new OneStaff {
>>   \new Staff {
>> \time 6/8
>> e4. a4. |
>> \drums \with { \omit TimeSignature } { r8 hc8 r8 hc8 r4 } |
>> a2.
>>   }
>> }
>>
>> maybe ?
>
> Thanks. A step in the right direction, but now I have the lyrics in
> the center of the staff, and the "(clap) (clap)" in the lyrics
> skipping over the drum claps. See attached PNG. (Oh, I'm using "s8" in
> place of "r8" too, but I'm thinking that isn't a mistake, since I
> don't want rests to show up.) The minimum [non]-working example:
>
> %
> \score {
>   \new OneStaff {
> <<
>   \new Staff {
> \new Voice = "mel" { \melody }
>   }
>   \new Lyrics \lyricsto mel \words
> >>
>   }
> }
> %

Frankly, I must have completely misinterpreted your request.  It sounded
to me like you were talking about drum-style notes.  A OneStaff context
is for putting several contexts which usually would have their own lines
("vertical axis") into one.

Maybe you want to show a hand-drawn sketch of what you want because at
least I have no idea what we are talking about at this point of time.

-- 
David Kastrup



Re: Is there a glyph? (or something) to indicate a clap in a vocal piece?

2023-10-16 Thread David Kastrup
Kevin Cole  writes:

> I'm transcribing a pub song, and at one point, there's a lyric
> "(clap)(clap)" with "X X" on the staff.
>
> I've seen that one can have a "\drum {hc4 hc4}" but I want something like a
> layout of "| e4. a4. | X X g8 |" in 6/8 time all on one staff -- which I
> guess in MIDI would probably be something like "r8 hc8 r8 hc8 r4" in a drum
> track (voice?) for that measure with the claps...

Something like

\new OneStaff {
  \new Staff {
\time 6/8
e4. a4. |
\drums \with { \omit TimeSignature } { r8 hc8 r8 hc8 r4 } |
a2.
  }
}

maybe ?

-- 
David Kastrup



Re: skip of defined length in lyrics?

2023-10-13 Thread David Kastrup
Graham King  writes:

> I'm setting a verse anthem, in which certain voices are instrument-only
> until the chorus, at which point they are doubled by singers.
>
> How can I include a skip of defined duration in the lyrics?  \skip
> counts notes or syllables,

It doesn't.  It corresponds to one syllable/note whatever the duration.

> but I'd like to count breves and minims, to avoid the lyrics-alignment
> containing a magic number that is sensitive to subsequent editing of
> the preceding music.
>
> I've seen a reference somewhere to #skip-of-length but can't find any
> documentation.

You can just use \skip \music but you have to forego rhythmic alignment
using \lyricsto .

> % ~~
> \version "2.25.7"
>
> notes = { \repeat unfold 12 c'4 }
>
> words = \lyricmode { 
>   \repeat unfold 2 { \skip 1 }  % Lyrics to start at bar 3.
>   one two three four 
> }
>
> { << \new Voice = "cantor" \notes
>  \new Lyrics \lyricsto cantor { \words } 
>   >>
> }
> % ~~

Check out
% ~~
\version "2.25.7"

notes = { \repeat unfold 12 c'4 }

words = \lyricmode { 
  \skip 1*2  % Lyrics to start at bar 3.
  one4 two three four 
}

{ << \new Voice = "cantor" \notes
 \new Lyrics \with { associatedVoice = "cantor" } { \words } 
  >>
}
% ~~
  
Note that the associatedVoice may seem irrelevant when the timing isn't
derived from it, but it is required for a few things like proper
placement of syllable extenders.

Also note how the syllable "one" gets an explicit length of a quarter.
In real music, you'll get a lot more note lengths in the lyrics.

This will look uglier in the source, but it tends to be quite more
robust against music edits not affecting the syllable positions.  And of
course, skips become quite easier to accommodate.

-- 
David Kastrup


Re: Anything similar to to-barline for extender lines of cresc/dim?

2023-10-10 Thread David Kastrup
Mats Bengtsson  writes:

> Hi,
>
> Is there anything analogous to Hairpin.to-barline = #t that applies to
> the extender line of textual dynamics like \cresc or \dim?
>
> Unfortunately, I don't have a copy of Gould, but to me all the options
> I tried below look worse than having an extender line that ends
> exactly below the bar line.
>
> \version "2.25.9"
>
> \fixed c' {
> <>^"Extending into next bar"
> c4 \cresc d e f |
> g \f f g a |
> g4 \dim f e d |
> c \mf  d c b, |
> <>^"Especially ugly at line breaks"
> c4 \cresc d e f |
> g \f f g a |
> g4 \dim f e d | \break
> c1 \mf |
> <>^"Ended (too early) before the bar"
> c4 \cresc d e f \! |
> g \f f g a |
> g4 \dim f e d \! |
> c \mf d c b, |
> <>^\markup\column{"Still too early" "adjusting bound-details" }
> \override DynamicTextSpanner.bound-details.right.attach-dir = #RIGHT
> c4 \cresc d e f \! |
> g \f f g a |
> g4 \dim f e d \! | \break
> c1 \mf |
>
> }
>
> Any ideas, or should I file it as a feature request?

Have you tried not "anything like to-barline" but rather _exactly_
to-barline ?

Like

c -\tweak to-barline ##t \cresc

and its ilk?

-- 
David Kastrup



Re: Still failing to operate lilypond 2.20.0 64-bit version.

2023-10-06 Thread David Kastrup
David Kastrup  writes:

> msk...@ansuz.sooke.bc.ca writes:
>
>> On Fri, 6 Oct 2023, Werner LEMBERG wrote:
>>
>>> Thanks.  I think it's ghostscript – there are no pre-built packages
>>> available either.  While LilyPond doesn't link to it in normal builds,
>>> gs is needed for converting LilyPond's EPS output files to PDF.  In
>>> other words, a MacPorts user still needs a compiler...
>>
>> If LilyPond doesn't link to gs but only execs it, then gs having an
>> incompatible version of GPL from LilyPond's version should not render
>> either binary undistributable, even together.  GNU's position seems to
>> be that exec is a boundary across which it's not necessary for
>> licenses to be compatible.
>
> GNU has no position, the FSF has.

Post Scriptum: of course in this case, the relevant interpretation (in
terms of whether one lands before court) would be that of Artifex as the
Ghostscript copyright holder.  I don't think that they'd go to court
over LilyPond using a separately distributed Ghostscript that is not
just usable by LilyPond.

The other way round we are talking about LilyPond copyright holders
going to court because of Ghostscript being called by LilyPond.  This
would only make sense for copyright holders before the time that
Ghostscript became a fixture for graphics processing and TeX was used
instead, so we are talking about copyright holders from LilyPond version
1.x and earlier.  At that time, however, LilyPond was licensed under
GPLv2+.

It just doesn't come together as something that I can see as a viable
threat scenario.

-- 
David Kastrup



Re: Still failing to operate lilypond 2.20.0 64-bit version.

2023-10-06 Thread David Kastrup
msk...@ansuz.sooke.bc.ca writes:

> On Fri, 6 Oct 2023, Werner LEMBERG wrote:
>
>> Thanks.  I think it's ghostscript – there are no pre-built packages
>> available either.  While LilyPond doesn't link to it in normal builds,
>> gs is needed for converting LilyPond's EPS output files to PDF.  In
>> other words, a MacPorts user still needs a compiler...
>
> If LilyPond doesn't link to gs but only execs it, then gs having an
> incompatible version of GPL from LilyPond's version should not render
> either binary undistributable, even together.  GNU's position seems to
> be that exec is a boundary across which it's not necessary for
> licenses to be compatible.

GNU has no position, the FSF has.  And it is sort of fuzzier: after all,
dynamic libraries are also some kind of boundary.  The principal
differentiation is whether that boundary is artificial and the separate
parts operate as a single unseparable unit.

Ghostscript works with PostScript as a generic interface, it has lots of
other uses, and LilyPond can work without using Ghostscript (it can
produce PostScript files instead).

I think that puts enough of a conceptual barrier between the two.  Using
the Ghostscript API would be different: I'd expect distributions to
avoid that without explicit non-trivial user action.

> Of course, whether MacPorts's automated determination of
> distributability can capture this distinction, is another question.

-- 
David Kastrup



Re: Lyrics above staff

2023-10-06 Thread David Kastrup
Jean Abou Samra  writes:

> 
>
>
>> Le 6 oct. 2023 à 15:47, David Kastrup  a écrit :
>> \new Staff = "staff" {
>>  c'1
>> } \addlyrics \with { alignAboveContext = "staff"} { Om }
>
>
> OMG! I didn't know that syntax at all. It looks undocumented.

<https://gitlab.com/lilypond/lilypond/-/issues/4537>

>From the issue description:

I am actually having problems finding any suitable place to document
this: use of \with ... with anything but \new ... does not seem
documented.

This would likely mean \chords \with ..., \lyrics \with ... and those.

-- 
David Kastrup



Re: Lyrics above staff

2023-10-06 Thread David Kastrup
Dimitrios Sykias  writes:

> Is it possible to place lyrics above staff using \addlyrics? I tried
> “\addlyrics { \with { alignAboveContext = "staff" }” but it didn’t
> work. Thanks!

It does here.

\new Staff = "staff" {
  c'1
} \addlyrics \with { alignAboveContext = "staff"} { Om }

Maybe you are not clear about what the name behind alignAboveContext
signifies?  You need to have a VerticalAxis carrying context at the same
level with the given _name_, not with a particular _type_.

-- 
David Kastrup



Re: Overwrite key signature with numbers

2023-10-03 Thread David Kastrup
Valentin Petzel  writes:

> Damn it, turns out the key engraver has an hardcoded path to always create 
> Key 
> Cancellations for keys with no alteration.
>
> So one would need to do
>
> \override KeyCancellation.stencil = ##f
>
> which is of course a bit wonky as compared to telling Lilypond to not create 
> Cancellations in the first place (not that it matters), which is why I went 
> extra mile to use
>
> printKeyCancellation = ##f
>
> Well, thank you for pointing it out!

If you want to go the extra mile, you'd only print ♮ in key cancellation
messages grobs and would precede them with the _previous_ number of
sharps/flats.  So switching from E major to B♭ major would print 4♮2♭.

You would not get 0♮ however (not as a main signature, not as a
cancellation signature).

This may or may not be what the OP wants.  But it would be one
semi-consistent way of doing this.

-- 
David Kastrup



Re: Overwrite key signature with numbers

2023-10-03 Thread David Kastrup
Robert Mengual  writes:

> Oh David's right, if the music ends with no alterations it is printing the
> key cancellation, even when it has been explicitely set to false.[image:
> image.png]
> What can I do in this case? I would like to keep the number+alteration but
> remove the 7 natural signs before that.

Just add

\omit KeyCancellation

into the context amendment for \Staff in the \layout block.

-- 
David Kastrup



Re: Overwrite key signature with numbers

2023-10-02 Thread David Kastrup
Valentin Petzel  writes:

> Hi Robert,
>
> you could do it like this:
>
> \version "2.23.6"
>
> \layout {
>   \context {
> \Staff
> \override KeySignature.text =
> #(lambda (grob)
>(let* ((alt (ly:grob-property grob 'alteration-alist))
>   (alts (map cdr alt))
>   (tot (* 2 (apply + alts)))
>   (acc (cond ((= tot 0) (markup #:musicglyph 
> "accidentals.natural"))
>  ((> tot 0) (markup #:musicglyph "accidentals.sharp"))
>  (else (markup #:vcenter #:musicglyph 
> "accidentals.flat")
>  (markup #:vcenter #:number (number->string (abs tot)) acc)))
> \override KeySignature.stencil = #ly:text-interface::print
> printKeyCancellation = ##f
>   }
> }
>
> expt = { \key c \major c d e f }
>
> {
>   \clef bass
>   \expt
>   \transpose c cis \expt
>   \transpose c des \expt
>   \transpose c d \expt
>   \transpose c dis \expt
>   \transpose c es \expt
>   \transpose c e \expt
>   \transpose c f \expt
>   \transpose c fis \expt
>   \transpose c ges \expt
>   \transpose c g \expt
>   \transpose c gis \expt
>   \transpose c as \expt
>   \transpose c a \expt
>   \transpose c ais \expt
>   \transpose c bes \expt
>   \transpose c b \expt
> }
>
> Cheers,
> Valentin

To pour some rain on your parade, end the music with a final \expt ...
My revenge for you beating me to the punch line.

-- 
David Kastrup



Re: Initial rests in MIDI not included?

2023-09-28 Thread David Kastrup
David Wright  writes:

> Yes, like lilymidi --pretty, the evidence that there was silence
> at the beginning of the file is circumstantial, necessitating that
> the OP believed I sat through the 160 seconds of silence before
> any notes were played.
>
> BTW where is the output of lilymidi documented?

A quick `git grep lilymidi` confirms that there is is no documentation
for lilymidi.  Zero, zilch, nada.

It is installed with other binaries and is used by
elisp/lilypond-song.el (but what for?).  I'd have expected it to be used
as part of 'make check' for comparing MIDI outputs, but that doesn't
appear to be the case, either.

So I don't really know how I know about it: probably by typing

lily 

and getting curious about the completions.  It is a rather handy
checking tool for which I found no obvious substitute in the boxes of
MIDI tools available on a typical GNU/Linux installation.

-- 
David Kastrup



Re: Initial rests in MIDI not included?

2023-09-27 Thread David Kastrup
Kevin Cole  writes:

> On Wed, Sep 27, 2023 at 8:28 AM Jean Abou Samra  wrote:
>
>> Le mercredi 27 septembre 2023 à 08:22 -0400, Kevin Cole a écrit :
>> > And... we have a winner! It's a timidity problem!
>>
>> From what I can read, it is the expected behavior of timidity, but there
>> is a --preserve-silence option to change it.
>>
>
> Yeah, I was getting to that. ;-) Once it became a timidity issue, I
> suspected there would be an option to alter that behavior. It just
> hadn't occurred to me that timidity would default to happily ignoring
> the quiet bits.

I have no idea why anybody would consider that a sensible default, to be
honest.  I have a hard time imagining a sensible use case at all.

Possibly skipping initial silences in manually recorded MIDI files that
aren't edited at all in a sequencer?

But that does not really sound all that sensible.

-- 
David Kastrup



Re: Initial rests in MIDI not included?

2023-09-27 Thread David Kastrup
Jean Abou Samra  writes:

> Le mercredi 27 septembre 2023 à 08:22 -0400, Kevin Cole a écrit :
>> And... we have a winner! It's a timidity problem!
>
>
> From what I can read, it is the expected behavior of timidity, but there
> is a --preserve-silence option to change it.

I don't have timidity installed and consequently am also missing its
manual pages or I'd have checked.

-- 
David Kastrup



Re: Initial rests in MIDI not included?

2023-09-27 Thread David Kastrup
Kevin Cole  writes:

> I just tried it again with the attached, and still do not get "The Sound of
> Silence" ;-)
>
> $ cat mwe.ly
> \version "2.24.2"
> \language "english"
> global = {
>   \time 4/4
>   \key f \major
>   \tempo 4=150
> }
> PartFour = \relative a {
>   \global
>   \clef "treble"
>   \partial 4 a4
> }
> \score {
>   \new Voice = "PartFour" {
> R1*32 R1*24
> \repeat unfold 4 {
>   \transpose c c,, { \PartFour  }
> }
>   }
>   \midi { }
> }

$ lilymidi --pretty /tmp/mwe.midi 
Filename: /tmp/mwe.midi
MIDI format:  1 (one or more simultaneous tracks)
Divisions:1536 per whole note
#Tracks:  2

Track 1:
Time 0:
Text:   creator: 
Text:   LilyPond 2.24.2   
Time signature: 4/4, metronome 1/4
Tempo:  100 msec/quarter
Time 86016: 
Time signature: 4/4, metronome 1/4
Tempo:  40 msec/quarter
Time 86400: 
Time signature: 4/4, metronome 1/4
Time 86784: 
Time signature: 4/4, metronome 1/4
Time 87168: 
Time signature: 4/4, metronome 1/4
Time 87552: 
End of Track

Track 2:
Time 0:
Track name: \new:PartFour
Time 86016: 
Key signature: F major
Note on: Channel 0, A1(33)@90
Time 86400: 
Note off: Channel 0, A1(33)
Key signature: F major
Note on: Channel 0, A1(33)@90
Time 86784: 
Note off: Channel 0, A1(33)
Key signature: F major
Note on: Channel 0, A1(33)@90
Time 87168: 
Note off: Channel 0, A1(33)
Key signature: F major
Note on: Channel 0, A1(33)@90
Time 87552: 
Note off: Channel 0, A1(33)
End of Track


What is apparent is that it may be a bad idea to first pause a number of
bars and only then include \global with a different \tempo .

But the location of the tempo change aside your principal problem, like
before, seems to be that timidity as a player skips initial rests.

Try fluidsynth -ia pulseaudio -n on your MIDI file as an alternative (on
my system, I get inexplicable problems with -ia pipewire or -ia alsa)
instead.

-- 
David Kastrup



Re: Initial rests in MIDI not included?

2023-09-27 Thread David Kastrup
David Wright  writes:

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

That's all circumstantial evidence.  Nobody so far has actually attached
the resulting MIDI file and/or the output of

lilymidi --pretty

on it.  That would be way more informative.

-- 
David Kastrup



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



Re: Symmetrical hairpins

2023-09-25 Thread David Kastrup
Valentin Petzel  writes:

> Hello Arjen,
>
> I’m wondering if in your case it ight be beneficial to not create two
> Hairpins, but rather a special case stencil like this:

Huh.  Maybe this would not be the worst strategy for implementing messa
di voce graphically in general.  It would take care of symmetry and
length issues.

-- 
David Kastrup



Re: Images in Info files

2023-09-22 Thread David Kastrup
Ben Bradshaw  writes:

> Hello,
> I've been trying to get images to work in the info manuals (inside emacs on
> arch linux) but have had no luck so far. I tried to do what is in this post
>  https://lists.gnu.org/archive/html/lilypond-user/2014-08/msg00341.html
> <https://lists.gnu.org/archive/html/lilypond-user/2014-08/msg00341.html> ,
> but it doesn't seem to work. As far as I can tell, when I gunzip one of the
> info.gz files and get an info file, the code doesn't have anything in it to
> link to an image. The html files that get installed have the paths, and
> those files work fine, but the info manuals don't. Is there a way to
> compile the documentation to get images in the info manuals? The usage
> manual suggests that there is a --info-images-dir argument in
> lilypond-book, but I'm not sure where to try that. Any help would be
> appreciated!

make info

will do the info pages with images, as opposed to just

make all

which creates info pages without images.  I am not 100% sure whether
"make info" works without a preceding "make doc" these days.  There was
some aggrievance of that kind at some point of time in the recent past.

-- 
David Kastrup



Re: Scheme used badly: syntax problem

2023-09-16 Thread David Kastrup
Graham King  writes:

> Many thanks David!
>
> (In the course of trying to convert the \note syntax, I discovered the
> existence of \note-by-number which solved 90% of my problem.  Sorry for
> the confusing reference to \note.)

Well, \note-by-number #1 #0 #UP is essentially the same as \note {2} #UP

If you are not calculating note values, \note tends to have the simpler
syntax.

-- 
David Kastrup



Re: Scheme used badly: syntax problem

2023-09-16 Thread David Kastrup
Graham King  writes:

> I'm trying to convert a naive Scheme function which has been broken by
> the new syntax for \note.  Some arithmetic gives me the index (in this
> MNWE, 96) to a list  of pairs, foo, from which I want to extract some
> markup.
>
> The 300-LOC problem seems to boil down to this:
>
> %~~~
> \version "2.25.7"
>
> #(define foo '((96 . #{ \markup { \note-by-number #1 #0 #UP }#})))
>
> { c'1^\markup {#(cdr (assoc 96 foo))} }
> %~~~
>
> Please could a kind Scheme expert point out the stupid and obvious
> mistake that has eluded me for several evenings?

Uh, there isn't even \note in there?

The problem in the above is a quoting problem: you mustn't quote
#{...#}, and you can avoid quoting it using quasiquote and unquote:

\version "2.25.7"

#(define foo `((96 . ,#{ \markup { \note-by-number #1 #0 #UP }#})))

{ c'1^\markup {#(cdr (assoc 96 foo))} }

-- 
David Kastrup



  1   2   3   4   5   6   7   8   9   10   >