Re: need help building a Scheme function

2024-06-25 Thread Lukas-Fabian Moser

[Sorry! I wrote this two days ago on a train in one of the famous German
cell connection dead zones - and then forgot to actually send it later.]

Hi Kieren,


The last "m" in your innermost (if ...) is unnecessary: As with the difference between "for" and 
"map" in plain Scheme, the return value of the lambda function in for-some-music gets discarded ("for" 
functions are supposed to _do_ something, not _return_ something). So your branch stating "... else return m" can be 
omitted.

Excellent.


Well, modulo David's correction. :-)

It's true that the lambda function in for-some-music isn't supposed to
return the music it has produced. But since its return value determines
(as a boolean) whether to recurse, we should make sure to

- return ##f if our music argument m is not a note-event (but might
contain one)
- return a true value if we don't want to recurse any further. Since
note-events usually don't contain any other music, this might never
actually matter, but it is good to also read your code in the note-event
case and check which value gets returned in which case.

It might be worth noting that an (if condition then-clause) expression
without an else-clause returns and unspecified value if condition is #f.
https://www.gnu.org/software/guile/manual/html_node/Conditionals.html


Next, as you already hinted: If you use the same expression more than once 
(here (ly:music-property m 'pitch)), it is usually reasonably to store it in a 
variable, i.e. use (let ...).

Why wouldn’t I use let* here? I 
readhttps://extending-lilypond.gitlab.io/en/scheme/local-variables.html#let-syntax,
 and unless there’s some big-ticket efficiency problem under the hood, I don’t 
see why anyone would use let instead of let*.

I do not know if there are efficiency differences between let and let*
(but I doubt it). Personally, I use let if I don't need let*, since this
way, when I re-read my code, I immediately know that the let-assignments
do not depend on one another.



we rather want a list of pairs (old-pitch . new-pitch)

That’s the interface I was thinking of.


In order to construct such a list of pairs from two music inputs as above, (map 
...) provides a very elegant way.

In the case of a simple scale,

\adjustPitches scaleIn scaleOut

and then post-processing into lists, etc., makes some sense. But what about 
sending in pairs instead? e.g.

\adjustPitches ((ces c) (c b') (e g))

There would be the question of whether the user wants to process each pair 
consecutively (e.g., all ces become c, then all c [including the old ces] 
become b', etc.)… Maybe both options made available, with either a switch or 
optional parameter(s)?


The problem is that (ces c), or rather (ces . c), is Scheme syntax (and
requires ` and , when ces and c should not be taken as mere symbols),
but we don't have note name input in Scheme. So this would actually be
something like

(list (cons #{ ces #} #{ c #}) (cons #{ c #} #{ b #}))

or

`((,#{ ces #} . ,#{ c #}) (,#{ c #} . ,#{ b #}))

both of which make my brain hurt :-).

A way of inputting the pitches in LilyPond syntax might be much more
convenient. Possibilites that come to mind might be

{ ces c e } { c b' g }

{ ces c c b' e g }

{}

etc., all of which are comparatively easy to implement (the first one
probably being the easiest).

Lukas



Re: need help building a Scheme function

2024-06-23 Thread Kieren MacMillan
Hi Lukas!

Thanks for the patient and helpful tutorial(s).  :)

> The last "m" in your innermost (if ...) is unnecessary: As with the 
> difference between "for" and "map" in plain Scheme, the return value of the 
> lambda function in for-some-music gets discarded ("for" functions are 
> supposed to _do_ something, not _return_ something). So your branch stating 
> "... else return m" can be omitted.

Excellent.

> Next, as you already hinted: If you use the same expression more than once 
> (here (ly:music-property m 'pitch)), it is usually reasonably to store it in 
> a variable, i.e. use (let ...).

Why wouldn’t I use let* here? I read 
https://extending-lilypond.gitlab.io/en/scheme/local-variables.html#let-syntax, 
and unless there’s some big-ticket efficiency problem under the hood, I don’t 
see why anyone would use let instead of let*.

> Also some food for thought, if I may:
> - What if I want to replace each b by the c _above_ it?

Yes, you are thinking what I’m thinking, for the final version.  :)

> we rather want a list of pairs (old-pitch . new-pitch)

That’s the interface I was thinking of.

> In order to construct such a list of pairs from two music inputs as above, 
> (map ...) provides a very elegant way.

In the case of a simple scale,

   \adjustPitches scaleIn scaleOut

and then post-processing into lists, etc., makes some sense. But what about 
sending in pairs instead? e.g.

   \adjustPitches ((ces c) (c b') (e g))

There would be the question of whether the user wants to process each pair 
consecutively (e.g., all ces become c, then all c [including the old ces] 
become b', etc.)… Maybe both options made available, with either a switch or 
optional parameter(s)?

Cheers,
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: need help building a Scheme function

2024-06-23 Thread Lukas-Fabian Moser

The last "m" in your innermost (if ...) is unnecessary: As with the
difference between "for" and "map" in plain Scheme, the return value of
the lambda function in for-some-music gets discarded ("for" functions
are supposed to _do_ something, not _return_ something).

No, it doesn't.  It is a boolean that determines whether to recurse (#f)
or not (everything else).


Of course you're right, my bad. To be more precise:

- Plain Scheme (for ...) is indeed not supposed to return something but
rather do something.
- LilyPond's (for-some-music ...) is intended to i) do something, ii)
return a boolean indicating whether the recursion should continue (kind
of "is my work done in this branch of music?").

Of course that's what you explained, I just wanted to point out the
comparison with standard "for".

So @Kieren: In your example you should take care to control the return
value of your lambda (in particular, also in the else-branches of your
if's.)

Lukas


Re: need help building a Scheme function

2024-06-23 Thread Lukas-Fabian Moser

Hi David,


If you don't want to call upon undocumented internals of LilyPond (the
(@@ (lily) ...) bit), you can just use


[with-output-to-string]

Wow, thanks! I hadn't encountered this possibility yet.

Also thanks for pointing out the possibility of in-place modification.

Lukas


Re: need help building a Scheme function

2024-06-23 Thread Lukas-Fabian Moser

Hi Kieren,


for-some-music does not return music.  It works on music in-place.  So
the last thing in your music function must not be for-some-music but
rather the music that you have been working on.

So…

%%%  SNIPPET BEGINS
adjustPitch =
#(define-music-function (pitchIn pitchOut music) (ly:pitch? ly:pitch? ly:music?)
(for-some-music
 (lambda (m)
 (if (music-is-of-type? m 'note-event)
 (if (and (= (ly:pitch-notename (ly:music-property m 'pitch)) 
(ly:pitch-notename pitchIn))
   (= (ly:pitch-alteration (ly:music-property m 
'pitch)) (ly:pitch-alteration pitchIn)))
 (ly:music-set-property! m 'pitch
 (ly:make-pitch
  (ly:pitch-octave (ly:music-property m 
'pitch))
  (ly:pitch-notename pitchOut)
  (ly:pitch-alteration pitchOut)))
 m)
 #f))
 music)
 music)

testmusic = \fixed c' { c4 d es e f g c' es' eis }

{ \testmusic }

{ \adjustPitch ees e \testmusic }
%%%  SNIPPET ENDS

??


The last "m" in your innermost (if ...) is unnecessary: As with the
difference between "for" and "map" in plain Scheme, the return value of
the lambda function in for-some-music gets discarded ("for" functions
are supposed to _do_ something, not _return_ something). So your branch
stating "... else return m" can be omitted.

Next, as you already hinted: If you use the same expression more than
once (here (ly:music-property m 'pitch)), it is usually reasonably to
store it in a variable, i.e. use (let ...).

Also some food for thought, if I may:

- What if I want to replace each b by the c _above_ it?

- I've been thinking about a conventient user interface. If I understand
you correctly, you aim for something like a list of input-pitches and a
list of output-pitches, both preferably given as music, so we can do

\adjustPitch { c d e } { fis e d } \music

meaning: turn c into fis, d into e, and e into d. If I'm right, you'll
probably be able to make good use of (music-pitches ...). Also, for
search-and-replace tasks in Scheme, using an association list (alist) as
a dictionary is often convenient. This would mean we rather want a list
of pairs (old-pitch . new-pitch). In order to construct such a list of
pairs from two music inputs as above, (map ...) provides a very elegant way.

See also:

https://www.gnu.org/software/guile/manual/html_node/Association-Lists.html
https://www.gnu.org/software/guile/manual/html_node/List-Mapping.html

Lukas


Re: need help building a Scheme function

2024-06-22 Thread Kieren MacMillan
Hi David,

> for-some-music does not return music.  It works on music in-place.  So
> the last thing in your music function must not be for-some-music but
> rather the music that you have been working on.

So…

%%%  SNIPPET BEGINS
adjustPitch =
#(define-music-function (pitchIn pitchOut music) (ly:pitch? ly:pitch? ly:music?)
   (for-some-music
(lambda (m)
(if (music-is-of-type? m 'note-event)
(if (and (= (ly:pitch-notename (ly:music-property m 'pitch)) 
(ly:pitch-notename pitchIn))
  (= (ly:pitch-alteration (ly:music-property m 'pitch)) 
(ly:pitch-alteration pitchIn)))
(ly:music-set-property! m 'pitch
(ly:make-pitch
 (ly:pitch-octave (ly:music-property m 
'pitch))
 (ly:pitch-notename pitchOut)
 (ly:pitch-alteration pitchOut)))
m)
#f))
music)
music)

testmusic = \fixed c' { c4 d es e f g c' es' eis }

{ \testmusic }

{ \adjustPitch ees e \testmusic }
%%%  SNIPPET ENDS

??

Thanks,
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: need help building a Scheme function

2024-06-22 Thread David Kastrup
Kieren MacMillan  writes:

> I tried a few times, but got errors (about returning
> unspecified). Hints appreciated.

for-some-music does not return music.  It works on music in-place.  So
the last thing in your music function must not be for-some-music but
rather the music that you have been working on.

-- 
David Kastrup



Re: need help building a Scheme function

2024-06-22 Thread Kieren MacMillan
Hi David,

> This will also adjust eis and eses to e.  Note names are numbers and can
> be compared with = .  (make-music 'NoteEvent m) is silly and creates an
> unnecessary copy.  You can just use m instead.

Thanks — current version:

%%%  SNIPPET BEGINS
\version "2.25.11"

adjustPitch =
#(define-music-function (pitchIn pitchOut music) (ly:pitch? ly:pitch? ly:music?)
   (music-map
(lambda (m)
(if (music-is-of-type? m 'note-event)
(if (and (= (ly:pitch-notename (ly:music-property m 'pitch)) 
(ly:pitch-notename pitchIn))
  (= (ly:pitch-alteration (ly:music-property m 'pitch)) 
(ly:pitch-alteration pitchIn)))
(ly:music-set-property! m 'pitch
(ly:make-pitch
 (ly:pitch-octave (ly:music-property m 
'pitch))
 (ly:pitch-notename pitchOut)
 (ly:pitch-alteration pitchOut)))
m)
#f)
m)
music))

testmusic = \fixed c' { c4 d es e f g c' es' eis' }

{ \testmusic }

{ \adjustPitch ees e \testmusic }
%%%  SNIPPET ENDS

Q: Is there a more efficient way to test for note name and alteration 
independent of octave?

> If you do, you don't replace any music, so music-map is unnecessary.
> This can be better done with for-some-music .

I tried a few times, but got errors (about returning unspecified). Hints 
appreciated.

As for next step(s): I’m thinking some let-ing would make sense?

Thanks,
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: need help building a Scheme function

2024-06-22 Thread David Kastrup
Kieren MacMillan  writes:

> Hi again,
>
>> There is no necessity to return a new NoteEvent; you can just change
>> pitch on the existing one.
>> 
>> Music functions are allowed to modify their music arguments in place.
>
> This is what I have so far, which appears to do what I want:
>
> %%%  SNIPPET BEGINS
> \version "2.25.11"
>
> adjustPitch = 
> #(define-music-function (pitchIn pitchOut music) (ly:pitch? ly:pitch? 
> ly:music?)
>(music-map
> (lambda (m)
> (if (music-is-of-type? m 'note-event)
> (if (equal? (ly:pitch-notename (ly:music-property m 'pitch)) 
> (ly:pitch-notename pitchIn))
> (ly:music-set-property! m 'pitch (ly:make-pitch 
> (ly:pitch-octave (ly:music-property m 'pitch)) (ly:pitch-notename pitchOut) 
> 0))
> (make-music 'NoteEvent m))
> (ly:message "Not of type"))
> m)
> music))
>
> \adjustPitch ees e \fixed c' { c4 d es f g c' es' }
> %%%  SNIPPET ENDS
>
> Comments before I move to the next step…?

This will also adjust eis and eses to e.  Note names are numbers and can
be compared with = .  (make-music 'NoteEvent m) is silly and creates an
unnecessary copy.  You can just use m instead.

If you do, you don't replace any music, so music-map is unnecessary.
This can be better done with for-some-music .

-- 
David Kastrup



Re: need help building a Scheme function

2024-06-22 Thread Kieren MacMillan
Hi again,

> There is no necessity to return a new NoteEvent; you can just change
> pitch on the existing one.
> 
> Music functions are allowed to modify their music arguments in place.

This is what I have so far, which appears to do what I want:

%%%  SNIPPET BEGINS
\version "2.25.11"

adjustPitch = 
#(define-music-function (pitchIn pitchOut music) (ly:pitch? ly:pitch? ly:music?)
   (music-map
(lambda (m)
(if (music-is-of-type? m 'note-event)
(if (equal? (ly:pitch-notename (ly:music-property m 'pitch)) 
(ly:pitch-notename pitchIn))
(ly:music-set-property! m 'pitch (ly:make-pitch 
(ly:pitch-octave (ly:music-property m 'pitch)) (ly:pitch-notename pitchOut) 0))
(make-music 'NoteEvent m))
(ly:message "Not of type"))
m)
music))

\adjustPitch ees e \fixed c' { c4 d es f g c' es' }
%%%  SNIPPET ENDS

Comments before I move to the next step…?

Thanks,
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: need help building a Scheme function

2024-06-22 Thread David Kastrup
Lukas-Fabian Moser  writes:

> Elaborating on David's explanation, it might be instructive to study the
> output of:
>
> \version "2.25.9"
>
> mappingFunction =
> #(define-music-function (music) (ly:music?)
>(music-map
> (lambda (m)
>   (ly:message "Considering music:\n~a\n-\n"
>   ((@@ (lily) music->lily-string) m))
>   m)
> music))
>
> \mappingFunction
> \new PianoStaff
> <<
>   \new Staff \relative { c'4 d e c }
>   \new Staff \relative { c' g c c }
>>>

If you don't want to call upon undocumented internals of LilyPond (the
(@@ (lily) ...) bit), you can just use

\version "2.25.9"

mappingFunction =
#(define-music-function (music) (ly:music?)
   (music-map
(lambda (m)
 (ly:message "Considering music:~a-\n"
  (with-output-to-string (lambda () (displayLilyMusic m
  m)
music))

\mappingFunction
\new PianoStaff
<<
  \new Staff \relative { c'4 d e c }
  \new Staff \relative { c' g c c }
>>


-- 
David Kastrup


Re: need help building a Scheme function

2024-06-22 Thread David Kastrup
Lukas-Fabian Moser  writes:

> But: Whether you use music-map or map-some-music, your helper function
> (your lambda) is expected to return the new music into which the given
> argument m should be transformed. So in any case, your lambda function
> should return music - in the trivial case, it could return m itself
> without change, but in the long run, you want to return a new
> note-event, i.e. (make-music 'NoteEvent ...).
>
> For this, it will come in handy that it's possible to do
>
> (make-music 'NoteEvent m)
>
> i.e. create a new NoteEvent that takes its 'pitch (which you're going to
> overwrite using an additional 'pitch ), 'articulation etc.
> properties from m. (This is explained somewhere in Jean's guide.)

There is no necessity to return a new NoteEvent; you can just change
pitch on the existing one.

Music functions are allowed to modify their music arguments in place.

-- 
David Kastrup



Re: need help building a Scheme function

2024-06-21 Thread Lukas-Fabian Moser

Hi Kieren,

Am 21.06.24 um 20:25 schrieb Kieren MacMillan:

Hi all,

Thank you for the rapid-iteration non-isochronous Scheme class!  :)

Before I do the next step, is this optimal at this point?

%%%  SNIPPET BEGINS
\version "2.25.11"

adjustPitch =
#(define-music-function (pitchIn pitchOut music) (ly:pitch? ly:pitch? ly:music?)
(music-map
 (lambda (m)
 (if (music-is-of-type? m 'note-event)
 (ly:message "Pitch is: ~a" (ly:music-property m 'pitch))
 #f)
 m)
 music))

\adjustPitch es es \fixed c' { c4 d e f g a b c' }
%%%  SNIPPET ENDS


While it's possible to use music-map, I'd still recommend
map-some-music: Instead of considering all the various music objects in
a tree (and then specialising to only considering note events),
map-some-music is tailor-made for applications where we want to reach a
specific type of music objects in our recursion and then, in each case,
declaring the job done, i.e. not recursing any further. (The actual
difference should be very small, since also music-map can't help but
stop recursing at note-events, since these don't contain other music
objects.)

But: Whether you use music-map or map-some-music, your helper function
(your lambda) is expected to return the new music into which the given
argument m should be transformed. So in any case, your lambda function
should return music - in the trivial case, it could return m itself
without change, but in the long run, you want to return a new
note-event, i.e. (make-music 'NoteEvent ...).

For this, it will come in handy that it's possible to do

(make-music 'NoteEvent m)

i.e. create a new NoteEvent that takes its 'pitch (which you're going to
overwrite using an additional 'pitch ), 'articulation etc.
properties from m. (This is explained somewhere in Jean's guide.)

Lukas




Re: need help building a Scheme function

2024-06-21 Thread Kieren MacMillan
Hi Lukas,

> Elaborating on David's explanation, it might be instructive to study the 
> output of:
> [snip]
> In short: music-map really considers every music object in a music tree.

That was instructive — thanks!
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: need help building a Scheme function

2024-06-21 Thread Lukas-Fabian Moser

Hi Kieren,


I’m a little confused that the output of

%%%  SNIPPET BEGINS
\version "2.25.11"

adjustPitch =
#(define-music-function (pitchIn pitchOut music) (ly:pitch? ly:pitch? ly:music?)
(music-map
 (lambda (m)
   (ly:message "Pitch is: ~a" (ly:music-property m 'pitch)) m)
 music))

\adjustPitch es es \fixed c' { c4 d e f g a b c' }
%%%  SNIPPET ENDS

is

Pitch is: #
Pitch is: #
Pitch is: #
Pitch is: #
Pitch is: #
Pitch is: #
Pitch is: #
Pitch is: #
Pitch is: ()
Pitch is: ()

What is causing the last two output lines?


Elaborating on David's explanation, it might be instructive to study the
output of:

\version "2.25.9"

mappingFunction =
#(define-music-function (music) (ly:music?)
   (music-map
    (lambda (m)
  (ly:message "Considering music:\n~a\n-\n"
  ((@@ (lily) music->lily-string) m))
  m)
    music))

\mappingFunction
\new PianoStaff
<<
  \new Staff \relative { c'4 d e c }
  \new Staff \relative { c' g c c }
>>

In short: music-map really considers every music object in a music tree.

Lukas


Re: need help building a Scheme function

2024-06-21 Thread Kieren MacMillan
Hi David,

> To say something is "optimal", you have to state your objective.

I guess the immediate objective was to output [in the log] a list of pitches 
given the 'music' input.

> music-map is used for changing music, and you don't appear to do any
> useful changes to the music.  In fact, you replace note events with
> *undefined* which appears comparatively useless.
> 
> So what are you trying to achieve here?

The longer-term objective is to write

  \adjustMusic es e { c d es f g c' es' }

and get

  { c d e f g c' e' }

i.e., turn all E flats [at any octave] into E naturals.

Thanks,
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: need help building a Scheme function

2024-06-21 Thread David Kastrup
Kieren MacMillan  writes:

> Hi all,
>
> Thank you for the rapid-iteration non-isochronous Scheme class!  :)
>
> Before I do the next step, is this optimal at this point?
>
> %%%  SNIPPET BEGINS
> \version "2.25.11"
>
> adjustPitch = 
> #(define-music-function (pitchIn pitchOut music) (ly:pitch? ly:pitch? 
> ly:music?)
>(music-map
> (lambda (m)
> (if (music-is-of-type? m 'note-event)
> (ly:message "Pitch is: ~a" (ly:music-property m 'pitch))
> #f)
> m)
> music))
>
> \adjustPitch es es \fixed c' { c4 d e f g a b c' }
> %%%  SNIPPET ENDS

To say something is "optimal", you have to state your objective.
music-map is used for changing music, and you don't appear to do any
useful changes to the music.  In fact, you replace note events with
*undefined* which appears comparatively useless.

So what are you trying to achieve here?

-- 
David Kastrup



Re: need help building a Scheme function

2024-06-21 Thread Kieren MacMillan
Hi all,

Thank you for the rapid-iteration non-isochronous Scheme class!  :)

Before I do the next step, is this optimal at this point?

%%%  SNIPPET BEGINS
\version "2.25.11"

adjustPitch = 
#(define-music-function (pitchIn pitchOut music) (ly:pitch? ly:pitch? ly:music?)
   (music-map
(lambda (m)
(if (music-is-of-type? m 'note-event)
(ly:message "Pitch is: ~a" (ly:music-property m 'pitch))
#f)
m)
music))
   
\adjustPitch es es \fixed c' { c4 d e f g a b c' }
%%%  SNIPPET ENDS

Thanks,
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: need help building a Scheme function

2024-06-21 Thread Kieren MacMillan
Hi David,

> If you want to only look at note events, you need to check for them
> yourself.  music-map is not discriminating.

Ah! Lovely Socratic lesson. :)

Thanks,
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: need help building a Scheme function

2024-06-21 Thread David Kastrup
Kieren MacMillan  writes:

> Hi again,
>
> I’m a little confused that the output of
>
> %%%  SNIPPET BEGINS
> \version "2.25.11"
>
> adjustPitch = 
> #(define-music-function (pitchIn pitchOut music) (ly:pitch? ly:pitch? 
> ly:music?)
>(music-map
> (lambda (m)
>   (ly:message "Pitch is: ~a" (ly:music-property m 'pitch)) m)
> music))
>
> \adjustPitch es es \fixed c' { c4 d e f g a b c' }
> %%%  SNIPPET ENDS
>
> is
>
> Pitch is: #
> Pitch is: #
> Pitch is: #
> Pitch is: #
> Pitch is: #
> Pitch is: #
> Pitch is: #
> Pitch is: #
> Pitch is: ()
> Pitch is: ()
>
> What is causing the last two output lines?

Well, what do you think should be the pitch of

{ c4 d e f g a b c' }

and of

\fixed c' { c4 d e f g a b c' }

?

If you want to only look at note events, you need to check for them
yourself.  music-map is not discriminating.

-- 
David Kastrup



Re: need help building a Scheme function

2024-06-21 Thread Kieren MacMillan
Hi Timothy,

> Your lambda function for the mapping returns the value of ly:message, which 
> is #. You need to return some music. Changing the lambda 
> function to
> (lambda (m)
>   (ly:message "Pitch is: ~a" (ly:music-property m 'pitch)) m)
> maps the music to itself without any changes.

Oh! I see that now.

Thanks!
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: need help building a Scheme function

2024-06-21 Thread Kieren MacMillan
Hi again,

I’m a little confused that the output of

%%%  SNIPPET BEGINS
\version "2.25.11"

adjustPitch = 
#(define-music-function (pitchIn pitchOut music) (ly:pitch? ly:pitch? ly:music?)
   (music-map
(lambda (m)
  (ly:message "Pitch is: ~a" (ly:music-property m 'pitch)) m)
music))

\adjustPitch es es \fixed c' { c4 d e f g a b c' }
%%%  SNIPPET ENDS

is

Pitch is: #
Pitch is: #
Pitch is: #
Pitch is: #
Pitch is: #
Pitch is: #
Pitch is: #
Pitch is: #
Pitch is: ()
Pitch is: ()

What is causing the last two output lines?

Thanks,
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: need help building a Scheme function

2024-06-21 Thread Timothy Lanfear

On 21/06/2024 17:36, Kieren MacMillan wrote:

Hi Lukas!

All right… already back for more specific help.

I struggled with map-some-music, and failed. Scanned through Jean’s [amazing] 
“Extending” docs — yes, yes, I need to RTM on that one, page-by-page! — and 
found an example with music-map, so tried that instead. Also failed.

Your lambda function for the mapping returns the value of ly:message, 
which is #. You need to return some music. Changing the 
lambda function to


(lambda (m) (ly:message "Pitch is: ~a" (ly:music-property m 'pitch)) m)

maps the music to itself without any changes.

--
Timothy Lanfear, Bristol, UK.


Re: need help building a Scheme function

2024-06-21 Thread Kieren MacMillan
Hi Lukas!

All right… already back for more specific help.

I struggled with map-some-music, and failed. Scanned through Jean’s [amazing] 
“Extending” docs — yes, yes, I need to RTM on that one, page-by-page! — and 
found an example with music-map, so tried that instead. Also failed.

%%%  SNIPPET BEGINS
\version "2.25.11"

adjustPitch = 
#(define-music-function (pitchIn pitchOut music) (ly:pitch? ly:pitch? ly:music?)
   (music-map
(lambda (m)
  (ly:message "Pitch is: ~a" (ly:music-property m 'pitch)))
music))

melody = {
  c'2 g'2 es'2. d'4 |
  c' es' d' c' |
  b d' g2
}

\adjustPitch es es \fixed c' { c d e f g a b c' }
%%%  SNIPPET ENDS

Helps/Hints appreciated.
Kieren
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: need help building a Scheme function

2024-06-21 Thread Kieren MacMillan
Hi L-F!

>> Is map-some-music the correct next move?
> Yes.

Thanks!

> I take it you're only asking for confirmation you're on the right track? :-)

Correct. I’ll try to ask more specific questions when I need more than 
confirmation.

> So I only suggest use the ly:pitch? predicate for pitchIn/pitchOut instead of 
> ly:music?.

Good point. I *think* I eventually want to allow a set (array?) of pitches 
in/out, but for now, I’ll start the input as small as the output.

Thanks!
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: need help building a Scheme function

2024-06-21 Thread Lukas-Fabian Moser

Hi Kieren,

Am 21.06.24 um 16:39 schrieb Kieren MacMillan:

%%%  SNIPPET BEGINS
\version "2.25.11"

adjustPitch =
#(define-music-function (pitchIn pitchOut music) (ly:music? ly:music? ly:music?)
(ly:message "Pitch is: ~a" (ly:pitch-notename (ly:music-property pitchIn 
'pitch)))
music)

melody = {
   c'2 g'2 es'2. d'4 |
   c' es' d' c' |
   b d' g2
}

\adjustPitch es es \fixed c' { c d e f g a b c' }
%%%  SNIPPET ENDS

This does exactly what it says on the can. Now I want to “map” the message 
[stand-in] function to the music provided, so it outputs the pitch for each 
note in the 'music' input.

Is map-some-music the correct next move?


Yes. I take it you're only asking for confirmation you're on the right
track? :-)

So I only suggest use the ly:pitch? predicate for pitchIn/pitchOut
instead of ly:music?.

Lukas


need help building a Scheme function

2024-06-21 Thread Kieren MacMillan
Hey list!

Trying to work up to being a bigger and better contributor to The ’Pond. Found 
and copied that “transpose major to minor” scale function in the previous 
thread I contributed to, but (a) don’t really know if it’s the best way to do 
what the OP wanted, (b) thought it might be overkill for what the OP wanted, 
and (c) figured writing another function attacking the same problem with a 
slightly different approach might be a good way to climb the learning curve.

So… I‘m writing a function called \adjustPitch, where

\adjustPitch e es { c d e f g c' e' }

should output

{ c d es f g c' es'  }

Started like this:

%%%  SNIPPET BEGINS
\version "2.25.11"

adjustPitch = 
#(define-music-function (pitchIn pitchOut music) (ly:music? ly:music? ly:music?)
   (ly:message "Pitch is: ~a" (ly:pitch-notename (ly:music-property pitchIn 
'pitch)))
   music)

melody = {
  c'2 g'2 es'2. d'4 |
  c' es' d' c' |
  b d' g2
}

\adjustPitch es es \fixed c' { c d e f g a b c' }  
%%%  SNIPPET ENDS

This does exactly what it says on the can. Now I want to “map” the message 
[stand-in] function to the music provided, so it outputs the pitch for each 
note in the 'music' input.

Is map-some-music the correct next move?

Thanks,
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: Scheme help

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

> Hello Kevin,
>
> When you call a music expression like \music Lilypond will allways pass a 
> copy 
> of that music object. Thus some music functions assume it is safe to modify 
> the original music object. So when you do
>
> \keepWithTag ... #music
>
> you will first remove everything tagged without v1, then everything tagged 
> without v2 and so on. So in the end only untagged and tagged with everything 
> will persist. Then you get multiple references to that music object.
>
> What you need to do is to copy the music object passed using ly:music-deep-
> copy:
>
> %%%
> repeat-verses =
> #(define-music-function ( count music  )
> ( index? ly:music? )
>(make-music 'SequentialMusic 'elements
>  (map-in-order
>   (lambda (verse)
>(begin
> (define versenum
>  (string->symbol (string-join (list "v" (number->string verse)) "" )))
>  #{ \keepWithTag #versenum #(ly:music-deep-copy music) #})) 
>   (iota count 1

Out of shere laziness, I'd be using
$music here instead of #(ly:music-deep-copy music).  $music is the
Scheme equivalent of \music (including making a copy and suffering from
an early evaluation effect).

It is also possible to replace

#{ \keepWithTag #versenum #(ly:music-deep-copy music) #}

with

(keepWithTag versenum (ly:music-deep-copy music))

but there is a slight difference regarding point-and-click behavior and
typesetting-time error messages.  A closer equivalent would be

(ly:set-origin! (keepWithTag versenum (ly:music-deep-copy music (*location*

So the #{ ... $xxx #} variant keeps track of a few details behind the
scene that are not relevant for the function itself but that might come
in handy eventually.

> %%%
> repeat-verses =
> #(define-music-function ( count music  )
> ( index? ly:music? )
>(make-music 'SequentialMusic 'elements
>  (map-in-order
>   (lambda (verse)
>(let ((versenum (string->symbol (format #f "v~a" verse
>  (keepWithTag versenum (ly:music-deep-copy music
>   (iota count 1
>
> \repeat-verses 3 { \tag #'v1 c' \tag #'v2 d' \tag #'v3 e' f' }
> %%%

There actually is no reason to use `map-in-order' over just `map' here
since the loop body has no side effects.

Your Scheme inner construct does not touch the
point-and-click/error-location data.  That may or may not be what is
desired.  The guesses that #{ $... #} takes in that regard have a
certain chance of being what the user would prefer.

-- 
David Kastrup



Re: Scheme help

2024-05-24 Thread Kevin Pye
Thanks Valentin,

I'll incorporate your suggestions. I doubt I'd have worked out the problems at 
my level of Scheme programming without your help.

I'll probably have more questions in the future.

Kevin.

On Fri, 24 May 2024, at 17:17, Valentin Petzel wrote:
> Hello Kevin,
>
> When you call a music expression like \music Lilypond will allways pass a 
> copy 
> of that music object. Thus some music functions assume it is safe to modify 
> the original music object. So when you do
>
> \keepWithTag ... #music
>
> you will first remove everything tagged without v1, then everything tagged 
> without v2 and so on. So in the end only untagged and tagged with everything 
> will persist. Then you get multiple references to that music object.
>
> What you need to do is to copy the music object passed using ly:music-deep-
> copy:
>
> %%%
> repeat-verses =
> #(define-music-function ( count music  )
> ( index? ly:music? )
>(make-music 'SequentialMusic 'elements
>  (map-in-order
>   (lambda (verse)
>(begin
> (define versenum
>  (string->symbol (string-join (list "v" (number->string verse)) "" )))
>  #{ \keepWithTag #versenum #(ly:music-deep-copy music) #})) 
>   (iota count 1
>
> repeat-verses 3 { \tag #'v1 c' \tag #'v2 d' \tag #'v3 e' f' }
> %%%
>
> There are some details with your code I’d do differently:
>
> 1. Instead of using string-joins use format:
> (format #f "v~a" verse)
>
> 2. Instead of using begin/define, use let and let* for local bindings:
> (let ((versenum ...)) #{ ... #})
>
> %%%
> repeat-verses =
> #(define-music-function ( count music  )
> ( index? ly:music? )
>(make-music 'SequentialMusic 'elements
>  (map-in-order
>   (lambda (verse)
>(let ((versenum (string->symbol (format #f "v~a" verse
>  (keepWithTag versenum (ly:music-deep-copy music
>   (iota count 1
>
> \repeat-verses 3 { \tag #'v1 c' \tag #'v2 d' \tag #'v3 e' f' }
> %%%
>
>
> Am Freitag, 24. Mai 2024, 07:41:07 MESZ schrieb Kevin Pye:
>> So after 56 years of programming I've at last got around to writing some
>> Lisp, and of course it doesn't work.
>> 
>> I'm trying to define a routine repeat-verses which would be used like
>> 
>> \repeat-verses 3 \music
>> 
>> which would have the effect of
>> 
>> \keepWithTag #'v1 \music
>> \keepWithTag #'v2 \music
>> \keepWithTag #'v3 \music
>> 
>> I came up with this code:
>> 
>> repeat-verses =
>> #(define-music-function ( count music  )
>> ( index? ly:music? )
>>(make-music 'SequentialMusic 'elements
>>  (map-in-order
>>   (lambda (verse)
>>(begin
>> (define versenum
>>  (string->symbol (string-join (list "v" (number->string verse)) ""
>> ))) #{ \keepWithTag #versenum #music #}))
>>   (iota count 1
>> 
>> which doesn't quite work. It's as though no tags are defined, so anything in
>> \music which is surrounded by a tag is omitted.
>> 
>> Replacing the definition of versenum with (define versenum 'v1) works fine,
>> although of course you get three copies of verse one, and replacing  the
>> definition of versenum with
>> 
>> (define versenum
>>  (string->symbol (string-join (list "v" (number->string 1)) "" )))
>> 
>> (i.e. not using the value of variable verse) also works with three copies of
>> verse one.
>> 
>> So two questions:
>>  1. Why doesn't this work; and
>>  2. How should I really go about solving this problem?
>> Kevin.
>
>
> Attachments:
> * signature.asc



Re: Scheme help

2024-05-24 Thread Valentin Petzel
Hello Kevin,

When you call a music expression like \music Lilypond will allways pass a copy 
of that music object. Thus some music functions assume it is safe to modify 
the original music object. So when you do

\keepWithTag ... #music

you will first remove everything tagged without v1, then everything tagged 
without v2 and so on. So in the end only untagged and tagged with everything 
will persist. Then you get multiple references to that music object.

What you need to do is to copy the music object passed using ly:music-deep-
copy:

%%%
repeat-verses =
#(define-music-function ( count music  )
( index? ly:music? )
   (make-music 'SequentialMusic 'elements
 (map-in-order
  (lambda (verse)
   (begin
(define versenum
 (string->symbol (string-join (list "v" (number->string verse)) "" )))
 #{ \keepWithTag #versenum #(ly:music-deep-copy music) #})) 
  (iota count 1

repeat-verses 3 { \tag #'v1 c' \tag #'v2 d' \tag #'v3 e' f' }
%%%

There are some details with your code I’d do differently:

1. Instead of using string-joins use format:
(format #f "v~a" verse)

2. Instead of using begin/define, use let and let* for local bindings:
(let ((versenum ...)) #{ ... #})

%%%
repeat-verses =
#(define-music-function ( count music  )
( index? ly:music? )
   (make-music 'SequentialMusic 'elements
 (map-in-order
  (lambda (verse)
   (let ((versenum (string->symbol (format #f "v~a" verse
 (keepWithTag versenum (ly:music-deep-copy music
  (iota count 1

\repeat-verses 3 { \tag #'v1 c' \tag #'v2 d' \tag #'v3 e' f' }
%%%


Am Freitag, 24. Mai 2024, 07:41:07 MESZ schrieb Kevin Pye:
> So after 56 years of programming I've at last got around to writing some
> Lisp, and of course it doesn't work.
> 
> I'm trying to define a routine repeat-verses which would be used like
> 
> \repeat-verses 3 \music
> 
> which would have the effect of
> 
> \keepWithTag #'v1 \music
> \keepWithTag #'v2 \music
> \keepWithTag #'v3 \music
> 
> I came up with this code:
> 
> repeat-verses =
> #(define-music-function ( count music  )
> ( index? ly:music? )
>(make-music 'SequentialMusic 'elements
>  (map-in-order
>   (lambda (verse)
>(begin
> (define versenum
>  (string->symbol (string-join (list "v" (number->string verse)) ""
> ))) #{ \keepWithTag #versenum #music #}))
>   (iota count 1
> 
> which doesn't quite work. It's as though no tags are defined, so anything in
> \music which is surrounded by a tag is omitted.
> 
> Replacing the definition of versenum with (define versenum 'v1) works fine,
> although of course you get three copies of verse one, and replacing  the
> definition of versenum with
> 
> (define versenum
>  (string->symbol (string-join (list "v" (number->string 1)) "" )))
> 
> (i.e. not using the value of variable verse) also works with three copies of
> verse one.
> 
> So two questions:
>  1. Why doesn't this work; and
>  2. How should I really go about solving this problem?
> Kevin.



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


Scheme help

2024-05-23 Thread Kevin Pye
So after 56 years of programming I've at last got around to writing some Lisp, 
and of course it doesn't work.

I'm trying to define a routine repeat-verses which would be used like

\repeat-verses 3 \music

which would have the effect of

\keepWithTag #'v1 \music
\keepWithTag #'v2 \music
\keepWithTag #'v3 \music

I came up with this code:

repeat-verses =
#(define-music-function ( count music  )
( index? ly:music? )
   (make-music 'SequentialMusic 'elements
 (map-in-order
  (lambda (verse)
   (begin
(define versenum
 (string->symbol (string-join (list "v" (number->string verse)) "" )))
 #{ \keepWithTag #versenum #music #})) 
  (iota count 1

which doesn't quite work. It's as though no tags are defined, so anything in 
\music which is surrounded by a tag is omitted.

Replacing the definition of versenum with (define versenum 'v1) works fine, 
although of course you get three copies of verse one, and replacing  the 
definition of versenum with

(define versenum
 (string->symbol (string-join (list "v" (number->string 1)) "" )))

(i.e. not using the value of variable verse) also works with three copies of 
verse one.

So two questions:
 1. Why doesn't this work; and
 2. How should I really go about solving this problem?
Kevin.


Re: Cry for help - lost plot ....

2024-05-18 Thread Kieren MacMillan
Hi Giles,

> Just like that? Just like that! Wow!

Eventually, one gets tired of how often Lilypond wows you…
Nice to see you’re not there yet.  ;)

— K
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: Cry for help - lost plot ....

2024-05-18 Thread Giles Boardman
Just like that? Just like that! Wow!

From: Kieren MacMillan 
Sent: 18 May 2024 18:45
To: Giles Boardman 
Cc: Aaron Hill ; Lilypond-User Mailing List 

Subject: Re: Cry for help - lost plot 

Hi Giles,

> though being able to put multiple columns side by side without them thinking 
> they were continuous music would be even more awesome, and very elegant imho

Like this?

%%%  SNIPPET BEGINS
\version "2.24.3"

\layout {
  \context {
\Score
\override RehearsalMark.padding = #3
  }
}

\markup {
  \fill-line {
\score { { \mark "ON079-1a-_01" \key c\major \time 9/8 a''8 b''8 a''8 g''4 
e''8 d''4 d''8 } }
\score { { \mark "ON079-1a-_02" \key c\major \time 9/8 a'8 a'8 a'8 d''4 
d''8 e''8 f''8 g''8 } }
\score { { \mark "ON079-1a-_03" \key c\major \time 9/8 a''8 b''8 a''8 g''4 
e''8 d''4 f''8 } }
  }
}
%%%  SNIPPET ENDS

Cheers,
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.



Re: Cry for help - lost plot ....

2024-05-18 Thread Giles Boardman
Thanks David - that's good advice and exactly how I got here. As I said, 
somewhere along the line I lost the plot. I think you have put your finger on 
what I have failed to grasp by telling me that only the first \mark statement 
is being processed and that everything else is "spurious".


From: David Wright 
Sent: 18 May 2024 18:24
To: Giles Boardman 
Cc: Aaron Hill ; lilypond-user@gnu.org 

Subject: Re: Cry for help - lost plot 

On Sat 18 May 2024 at 16:46:43 (+), Giles Boardman wrote:
> Thanks for getting back to me Aaron and throwing me a rope 
>
> I understand the two models you describe. I thought I was going for the 
> second i.e. a single sequential part, but I want to put each section on a 
> different line - this will help me enormously with proof-reading.
>
> What I see in the preview without the score block is just what I want, for 
> this part of my process - is there no (simple) way to embed it in a score 
> block to get it into a pdf and also into a midi file? Would each line need to 
> be its own score with the midi file produced in its own separate block?
>
> I think my fundamental problem is I don't understand why this, below, isn't 
> an example of the sequential model (isn't it "one music") - can you tell me 
> what Lilypond is objecting to?
>
> \version "2.24.3"
>
> \score {
>
>
> \mark "ON079-1a-_01" \key c\major \time 9/8 a''8 b''8 a''8 g''4 e''8 d''4 d''8
> \mark "ON079-1a-_02" \key c\major \time 9/8 a'8 a'8 a'8 d''4 d''8 e''8 f''8 
> g''8
> \mark "ON079-1a-_03" \key c\major \time 9/8 a''8 b''8 a''8 g''4 e''8 d''4 f''8
>
> \layout { }
> \midi { }
>

> }
Learning Manual §4.1.2 addresses exactly that problem. I would read it
through, then start with /their/ scores and work to produce what you
want in terms of one-liners.

In the example above, the one music consists of \mark "ON079-1a-_01",
and everything else is spurious.

Cheers,
David.


Re: Cry for help - lost plot ....

2024-05-18 Thread Kieren MacMillan
Hi Giles,

> though being able to put multiple columns side by side without them thinking 
> they were continuous music would be even more awesome, and very elegant imho

Like this?

%%%  SNIPPET BEGINS
\version "2.24.3"

\layout {
  \context {
\Score
\override RehearsalMark.padding = #3
  }
}

\markup {
  \fill-line {
\score { { \mark "ON079-1a-_01" \key c\major \time 9/8 a''8 b''8 a''8 g''4 
e''8 d''4 d''8 } }
\score { { \mark "ON079-1a-_02" \key c\major \time 9/8 a'8 a'8 a'8 d''4 
d''8 e''8 f''8 g''8 } }
\score { { \mark "ON079-1a-_03" \key c\major \time 9/8 a''8 b''8 a''8 g''4 
e''8 d''4 f''8 } }
  }
}
%%%  SNIPPET ENDS

Cheers,
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: Cry for help - lost plot ....

2024-05-18 Thread Giles Boardman
Thanks Kieren - I take it a couple of dozen expressions is good and one is bad 

Both snippets are really helpful. Though I'm a bit concerned about the ton of 
other issues you mention, I'll happily take the one that works for now, though 
my fried brain is still struggling a bit. The other one with the justified 
lines anticipates where I'll get to next - I love the left justified single 
bars (though being able to put multiple columns side by side without them 
thinking they were continuous music would be even more awesome, and very 
elegant imho) but eventually one bar just won't be enough and I'll want 
multiple lines elegantly spaced, just like this.

And it's such fun too, apart from the hair tearing.

Thanks again

Giles

From: Kieren MacMillan 
Sent: 18 May 2024 18:21
To: Giles Boardman 
Cc: Aaron Hill ; Lilypond-User Mailing List 

Subject: Re: Cry for help - lost plot 

Hi Giles,

Are you looking for something like this?

%%%  SNIPPET BEGINS
\version "2.24.3"

\paper {
  score-system-spacing.padding = #6
}

\layout {
  indent = 0
  ragged-right = ##f
  \context {
\Score
\override RehearsalMark.padding = #3
  }
}

\score {
  { \mark "ON079-1a-_01" \key c\major \time 9/8 a''8 b''8 a''8 g''4 e''8 d''4 
d''8 }
}
\score {
  { \mark "ON079-1a-_02" \key c\major \time 9/8 a'8 a'8 a'8 d''4 d''8 e''8 f''8 
g''8 }
}
\score {
  { \mark "ON079-1a-_03" \key c\major \time 9/8 a''8 b''8 a''8 g''4 e''8 d''4 
f''8 }
}
%%%  SNIPPET ENDS

> I think my fundamental problem is I don't understand why this, below, isn't 
> an example of the sequential model (isn't it "one music")

This “works”:

%%%  SNIPPET BEGINS
\version "2.24.3"

\score {
  {
\mark "ON079-1a-_01" \key c\major \time 9/8 a''8 b''8 a''8 g''4 e''8 d''4 
d''8
\mark "ON079-1a-_02" \key c\major \time 9/8 a'8 a'8 a'8 d''4 d''8 e''8 f''8 
g''8
\mark "ON079-1a-_03" \key c\major \time 9/8 a''8 b''8 a''8 g''4 e''8 d''4 
f''8
  }
  \layout { }
  \midi { }
}
%%%  SNIPPET ENDS
[Of course, this introduces a whole bunch of other issues… but it “works”!]

> - can you tell me what Lilypond is objecting to?

Your \score block contains about two dozen music expressions.  ;)
Wrapping that whole chunk in {} reduces it to a single music expression.

Hope that helps!
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.



Re: Cry for help - lost plot ....

2024-05-18 Thread David Wright
On Sat 18 May 2024 at 16:46:43 (+), Giles Boardman wrote:
> Thanks for getting back to me Aaron and throwing me a rope 
> 
> I understand the two models you describe. I thought I was going for the 
> second i.e. a single sequential part, but I want to put each section on a 
> different line - this will help me enormously with proof-reading.
> 
> What I see in the preview without the score block is just what I want, for 
> this part of my process - is there no (simple) way to embed it in a score 
> block to get it into a pdf and also into a midi file? Would each line need to 
> be its own score with the midi file produced in its own separate block?
> 
> I think my fundamental problem is I don't understand why this, below, isn't 
> an example of the sequential model (isn't it "one music") - can you tell me 
> what Lilypond is objecting to?
> 
> \version "2.24.3"
> 
> \score {
> 
> 
> \mark "ON079-1a-_01" \key c\major \time 9/8 a''8 b''8 a''8 g''4 e''8 d''4 d''8
> \mark "ON079-1a-_02" \key c\major \time 9/8 a'8 a'8 a'8 d''4 d''8 e''8 f''8 
> g''8
> \mark "ON079-1a-_03" \key c\major \time 9/8 a''8 b''8 a''8 g''4 e''8 d''4 f''8
> 
> \layout { }
> \midi { }
> 
> }

Learning Manual §4.1.2 addresses exactly that problem. I would read it
through, then start with /their/ scores and work to produce what you
want in terms of one-liners.

In the example above, the one music consists of \mark "ON079-1a-_01",
and everything else is spurious.

Cheers,
David.



Re: Cry for help - lost plot ....

2024-05-18 Thread Kieren MacMillan
Hi Giles,

Are you looking for something like this?

%%%  SNIPPET BEGINS
\version "2.24.3"

\paper {
  score-system-spacing.padding = #6
}

\layout {
  indent = 0
  ragged-right = ##f
  \context {
\Score
\override RehearsalMark.padding = #3
  }
}

\score {
  { \mark "ON079-1a-_01" \key c\major \time 9/8 a''8 b''8 a''8 g''4 e''8 d''4 
d''8 }
}
\score {
  { \mark "ON079-1a-_02" \key c\major \time 9/8 a'8 a'8 a'8 d''4 d''8 e''8 f''8 
g''8 }
}
\score {
  { \mark "ON079-1a-_03" \key c\major \time 9/8 a''8 b''8 a''8 g''4 e''8 d''4 
f''8 }
}
%%%  SNIPPET ENDS

> I think my fundamental problem is I don't understand why this, below, isn't 
> an example of the sequential model (isn't it "one music")

This “works”:

%%%  SNIPPET BEGINS
\version "2.24.3"

\score {
  {
\mark "ON079-1a-_01" \key c\major \time 9/8 a''8 b''8 a''8 g''4 e''8 d''4 
d''8 
\mark "ON079-1a-_02" \key c\major \time 9/8 a'8 a'8 a'8 d''4 d''8 e''8 f''8 
g''8 
\mark "ON079-1a-_03" \key c\major \time 9/8 a''8 b''8 a''8 g''4 e''8 d''4 
f''8 
  }
  \layout { }
  \midi { }
}
%%%  SNIPPET ENDS
[Of course, this introduces a whole bunch of other issues… but it “works”!]

> - can you tell me what Lilypond is objecting to? 

Your \score block contains about two dozen music expressions.  ;)
Wrapping that whole chunk in {} reduces it to a single music expression.

Hope that helps!
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: Cry for help - lost plot ....

2024-05-18 Thread Giles Boardman
Thanks for getting back to me Aaron and throwing me a rope 

I understand the two models you describe. I thought I was going for the second 
i.e. a single sequential part, but I want to put each section on a different 
line - this will help me enormously with proof-reading.

What I see in the preview without the score block is just what I want, for this 
part of my process - is there no (simple) way to embed it in a score block to 
get it into a pdf and also into a midi file? Would each line need to be its own 
score with the midi file produced in its own separate block?

I think my fundamental problem is I don't understand why this, below, isn't an 
example of the sequential model (isn't it "one music") - can you tell me what 
Lilypond is objecting to?

\version "2.24.3"

\score {


\mark "ON079-1a-_01" \key c\major \time 9/8 a''8 b''8 a''8 g''4 e''8 d''4 d''8
\mark "ON079-1a-_02" \key c\major \time 9/8 a'8 a'8 a'8 d''4 d''8 e''8 f''8 g''8
\mark "ON079-1a-_03" \key c\major \time 9/8 a''8 b''8 a''8 g''4 e''8 d''4 f''8

\layout { }
\midi { }

}






From: Aaron Hill 
Sent: 18 May 2024 17:18
To: Giles Boardman 
Cc: lilypond-user@gnu.org 
Subject: Re: Cry for help - lost plot 

On 2024-05-18 8:49 am, Giles Boardman wrote:
> \score {
>
> … music …
>
>   \layout { }
>   \midi { }
> }
>
> Please, someone help me while I still have a little hair left to pull
> out on a later occasion :-}


\score basically expects just one "music".  You are providing many
"musics".  The question is how you want to handle it.

Normally, we have simultaneous music where the parts are meant to run in
parallel.  But you can also do sequential music.

So, this means your \score block should have one of these two patterns:


\score {
   <<
 ...simultaneous music...
   >>

   \layout { }
   \midi { }
}

\score {
   {
 ...sequential music...
   }

   \layout { }
   \midi { }
}



-- Aaron Hill


Re: Cry for help - lost plot ....

2024-05-18 Thread Paul Hodges
If you make your lines sequential music in one score (by adding {...} around 
them, as a score can contain only one music expression) they'll all run 
together continuously.  You can add \break to force new lines, but then they 
are stretched to the width of the page.  You can then add ragged-right = ##t, 
but you will still have an indent for the first (which can be set to zero); you 
will also have the time signature repeated at the end of each line - which I'm 
sure can be turned off, though I can't recall the details.


It seems you'd be better off putting a \score block round each line, if you 
want each line to remain independent.


Paul



 From:   Aaron Hill  
 To:   Giles Boardman  
 Cc:
 Sent:   18/05/2024 17:18 
 Subject:   Re: Cry for help - lost plot  

On 2024-05-18 8:49 am, Giles Boardman wrote: 
> \score { 
>  
> … music … 
>  
>   \layout { } 
>   \midi { } 
> } 
>  
> Please, someone help me while I still have a little hair left to pull  
> out on a later occasion :-} 
 
 
\score basically expects just one "music".  You are providing many  
"musics".  The question is how you want to handle it. 
 
Normally, we have simultaneous music where the parts are meant to run in  
parallel.  But you can also do sequential music. 
 
So, this means your \score block should have one of these two patterns: 
 
 
\score { 
   << 
     ...simultaneous music... 
   >> 
 
   \layout { } 
   \midi { } 
} 
 
\score { 
   { 
     ...sequential music... 
   } 
 
   \layout { } 
   \midi { } 
} 
 
 
 
-- Aaron Hill 
 


Re: Cry for help - lost plot ....

2024-05-18 Thread Aaron Hill

On 2024-05-18 8:49 am, Giles Boardman wrote:

\score {

… music …

  \layout { }
  \midi { }
}

Please, someone help me while I still have a little hair left to pull 
out on a later occasion :-}



\score basically expects just one "music".  You are providing many 
"musics".  The question is how you want to handle it.


Normally, we have simultaneous music where the parts are meant to run in 
parallel.  But you can also do sequential music.


So, this means your \score block should have one of these two patterns:


\score {
  <<
...simultaneous music...
  >>

  \layout { }
  \midi { }
}

\score {
  {
...sequential music...
  }

  \layout { }
  \midi { }
}



-- Aaron Hill



Cry for help - lost plot ....

2024-05-18 Thread Giles Boardman
t.ly:15:1<5>:
 error: Spurious expression in \score
{ \mark "ON079-1-b_03" \key c\major \time 9/8 a''4 d'''8 d'''4 b''8 c'''4 a''8 }
c:/users/acer/appdata/local/temp/frescobaldi-cahb3r/tmpdto4tu/document.ly:16:1<6>:
 error: Spurious expression in \score
{ \mark "ON079-1-b_04" \key c\major \time 9/8 g''4 e''8 c''8 c''8 c''8 e''8 
f''8 g''8 }
c:/users/acer/appdata/local/temp/frescobaldi-cahb3r/tmpdto4tu/document.ly:17:1<7>:
 error: Spurious expression in \score
{ \mark "ON079-1-b_05" \key c\major \time 9/8 a''4 d'''8 d'''4 b''8 c'''4 g''8 }
c:/users/acer/appdata/local/temp/frescobaldi-cahb3r/tmpdto4tu/document.ly:18:1<8>:
 error: Spurious expression in \score
{ \mark "ON079-1-b_06" \key c\major \time 9/8 a''4 d'''8 d'''8 d'''8 d'''8 e''8 
f''8 g''8 }
c:/users/acer/appdata/local/temp/frescobaldi-cahb3r/tmpdto4tu/document.ly:19:1<9>:
 error: Spurious expression in \score
{ \mark "ON079-1-b_07" \key c\major \time 9/8 a''8 b''8 c'''8 b''8 c'''8 d'''8 
c'''8 b''8 a''8 }
Interpreting music...
Preprocessing graphical objects...
Interpreting music...
MIDI output to `document.mid'...
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...
Converting to `document.pdf'...
fatal error: failed files: 
"c:\\users\\acer\\appdata\\local\\temp\\frescobaldi-cahb3r\\tmpdto4tu\\document.ly"
Exited with return code 1.

Now I get one solitary line on my page and no green message.

I tried removing all the curly braces from around my lines, but that doesn't 
help .

Please, someone help me while I still have a little hair left to pull out on a 
later occasion :-}





Re: Help with Mac

2024-04-15 Thread Alejandro Castera
How kind of you, I thank you very much and I will take your advice, it will 
surely help me. I wish you all the best!

> El 15 abr 2024, a las 3:09 p.m., Maurits Lamers via LilyPond user discussion 
>  escribió:
> 
> Hi Alejandro,
> 
> The DMG was a way to quickly install Lilypond, but it came with a few 
> downsides.
> 
> The biggest one was that Lilypond was bundled as part of the LilyPad editor 
> app. This was what was started when you would doubleclick Lilypond.app. The 
> LilyPad editor was a very barebones editor, and as with every piece of 
> software it needed maintenance. That maintenance became problematic and 
> increasingly pointless when comparing the feature set of that editor with 
> something like Frescobaldi. 
> Additionally, in later versions of macOS, Apple started requiring signed 
> applications, for which you need a (paid) Apple Dev account.
> 
> Therefore, the decision was made to offer lilypond as a download in .zip 
> format (generic package), instead of a .dmg with a .app in it. Sadly it is 
> not as simple as copying over the contents of a .dmg, but the increased 
> strictness by Apple around signed applications is a major cause.
> 
> To install lilypond on a modern mac, you can follow these steps:
> 
> Download the generic package for macOS (lilypond-2.24.3 at the moment of 
> writing) from https://lilypond.org/download.html
> doubleclick on the downloaded zip file, to have the Archive Utility.app unzip 
> it.
> you will find a folder called "lilypond-2.24.3"
> move this folder to the Applications / Apps folder
> Check in System Preferences under Privacy and Security that your App security 
> setting is set to "App store and identified developers"
> open the lilypond-2.24.3 folder in the Applications folder, and open the bin 
> folder inside of that
> right click on the file called lilypond, and choose open
> macOS will prompt you with a warning that it cannot verify the identify of 
> the developer of 'lilypond' and whether you would like to open it or not.
> Choose open.
> Open the libexec folder and repeat step 7 to 9 with the files python3.10, gs 
> and convert-ly.
> Depending on which executables you need to use for your use case in addition 
> to the ones above, you might have to repeat step 7-9 for more executables in 
> the bin and/or libexec folder.
> Assuming you use Frescobaldi as editor, go to the settings in Frescobaldi and 
> add this lilypond version to the list of lilypond versions.
> Following these steps should make things work as expected (without requiring 
> any Terminal knowledge).
> 
> cheers
> 
> Maurits
> 
> Op 15-04-2024 om 22:22 schreef Alejandro Castera:
>> Good afternoon, community.
>> 
>> I've been using Lilypond on Mac for a long time, but for a few years now 
>> they haven't released a new version to install in DMG format. There are some 
>> packages to install via "ports" (which I haven't understood what they are) 
>> and using MacPorts or Homebrew (which I haven't understood how to use 
>> either). All this through the Terminal command line, which I don't 
>> understand how to use. For this reason, I am still using LilyPond version 
>> 2.20 because it was the last one installable as DMG. Please, if someone can 
>> guide me to install the latest version of LilyPond 2.24.3 because I have 
>> tried several times in different ways and have not succeeded. 
>> 
>> Please, LilyPond developers, we need a DMG installer because not all of us 
>> Mac musicians know the Terminal command line.
>> 
>> Thanks in advance for your attention. 
>> Regards
>> 
>> 



Re: Help with Mac

2024-04-15 Thread Alejandro Castera
How kind of you, I thank you very much and I will take your advice, it will 
surely help me. I wish you all the best!

> El 15 abr 2024, a las 3:07 p.m., Carl Sorensen  
> escribió:
> 
> 
> 
> On Mon, Apr 15, 2024 at 2:26 PM Alejandro Castera  <mailto:alexja...@yahoo.com.mx>> wrote:
>> Good afternoon, community.
>> 
>> I've been using Lilypond on Mac for a long time, but for a few years now 
>> they haven't released a new version to install in DMG format. There are some 
>> packages to install via "ports" (which I haven't understood what they are) 
>> and using MacPorts or Homebrew (which I haven't understood how to use 
>> either). All this through the Terminal command line, which I don't 
>> understand how to use. For this reason, I am still using LilyPond version 
>> 2.20 because it was the last one installable as DMG. Please, if someone can 
>> guide me to install the latest version of LilyPond 2.24.3 because I have 
>> tried several times in different ways and have not succeeded. 
>> 
>> Please, LilyPond developers, we need a DMG installer because not all of us 
>> Mac musicians know the Terminal command line.
> 
> Dear Alejandro,
> 
>  Due to Apple's policies on creating applications, there will not be any more 
> .DMG installs of LilyPond.
> 
> However, you can get LilyPond to work on your Mac without using the Terminal.
> 
> You will want to download Frescobaldi, which is available as a DMG.  
> https://www.frescobaldi.org/download
> 
> And then you will install LilyPond as an executable file.  We currently have 
> x86 applications that can be run even on Apple Silicon Macs, but will be a 
> bit slower than the native M1 build:  https://lilypond.org/development.html
> 
> We also have an M1 build available: https://cloud.hahnjo.de/s/x9D62eASSn6Ng7D
> 
> Once you have LilyPond installed, you will need to set the Lilypond 
> Preferences in Frescobaldi to point to your LilyPond executable.  Once you 
> have done that, you can use Frescobaldi to edit your lilypond files.  It's so 
> much better than the LilyPad editor that you will love it.
> 
> Detailed instructions for doing this are found in the Learning Manual: 
> https://lilypond.org/doc/v2.25/Documentation/learning/graphical-setup-under-macos
> 
> You don't need to use the Terminal at all if you follow these instructions.
> 
> I hope this is helpful.
> 
> Carl Sorensen



Re: Help with Mac

2024-04-15 Thread Maurits Lamers via LilyPond user discussion

Hi Alejandro,

The DMG was a way to quickly install Lilypond, but it came with a few 
downsides.


The biggest one was that Lilypond was bundled as part of the LilyPad 
editor app. This was what was started when you would doubleclick 
Lilypond.app. The LilyPad editor was a very barebones editor, and as 
with every piece of software it needed maintenance. That maintenance 
became problematic and increasingly pointless when comparing the feature 
set of that editor with something like Frescobaldi.
Additionally, in later versions of macOS, Apple started requiring signed 
applications, for which you need a (paid) Apple Dev account.


Therefore, the decision was made to offer lilypond as a download in .zip 
format (generic package), instead of a .dmg with a .app in it. Sadly it 
is not as simple as copying over the contents of a .dmg, but the 
increased strictness by Apple around signed applications is a major cause.


To install lilypond on a modern mac, you can follow these steps:

1. Download the generic package for macOS (lilypond-2.24.3 at the
   moment of writing) from https://lilypond.org/download.html
2. doubleclick on the downloaded zip file, to have the Archive
   Utility.app unzip it.
3. you will find a folder called "lilypond-2.24.3"
4. move this folder to the Applications / Apps folder
5. Check in System Preferences under Privacy and Security that your App
   security setting is set to "App store and identified developers"
6. open the lilypond-2.24.3 folder in the Applications folder, and open
   the bin folder inside of that
7. right click on the file called lilypond, and choose open
8. macOS will prompt you with a warning that it cannot verify the
   identify of the developer of 'lilypond' and whether you would like
   to open it or not.
9. Choose open.
10. Open the libexec folder and repeat step 7 to 9 with the files
   python3.10, gs and convert-ly.
11. Depending on which executables you need to use for your use case in
   addition to the ones above, you might have to repeat step 7-9 for
   more executables in the bin and/or libexec folder.
12. Assuming you use Frescobaldi as editor, go to the settings in
   Frescobaldi and add this lilypond version to the list of lilypond
   versions.

Following these steps should make things work as expected (without 
requiring any Terminal knowledge).


cheers

Maurits

Op 15-04-2024 om 22:22 schreef Alejandro Castera:

Good afternoon, community.

I've been using Lilypond on Mac for a long time, but for a few years now they haven't 
released a new version to install in DMG format. There are some packages to install via 
"ports" (which I haven't understood what they are) and using MacPorts or 
Homebrew (which I haven't understood how to use either). All this through the Terminal 
command line, which I don't understand how to use. For this reason, I am still using 
LilyPond version 2.20 because it was the last one installable as DMG. Please, if someone 
can guide me to install the latest version of LilyPond 2.24.3 because I have tried 
several times in different ways and have not succeeded.

Please, LilyPond developers, we need a DMG installer because not all of us Mac 
musicians know the Terminal command line.

Thanks in advance for your attention.
Regards



Re: Help with Mac

2024-04-15 Thread Carl Sorensen
On Mon, Apr 15, 2024 at 2:26 PM Alejandro Castera 
wrote:

> Good afternoon, community.
>
> I've been using Lilypond on Mac for a long time, but for a few years now
> they haven't released a new version to install in DMG format. There are
> some packages to install via "ports" (which I haven't understood what they
> are) and using MacPorts or Homebrew (which I haven't understood how to use
> either). All this through the Terminal command line, which I don't
> understand how to use. For this reason, I am still using LilyPond version
> 2.20 because it was the last one installable as DMG. Please, if someone can
> guide me to install the latest version of LilyPond 2.24.3 because I have
> tried several times in different ways and have not succeeded.
>
> Please, LilyPond developers, we need a DMG installer because not all of us
> Mac musicians know the Terminal command line.
>

Dear Alejandro,

 Due to Apple's policies on creating applications, there will not be any
more .DMG installs of LilyPond.

However, you can get LilyPond to work on your Mac without using the
Terminal.

You will want to download Frescobaldi, which is available as a DMG.
https://www.frescobaldi.org/download

And then you will install LilyPond as an executable file.  We currently
have x86 applications that can be run even on Apple Silicon Macs, but will
be a bit slower than the native M1 build:
https://lilypond.org/development.html

We also have an M1 build available:
https://cloud.hahnjo.de/s/x9D62eASSn6Ng7D

Once you have LilyPond installed, you will need to set the Lilypond
Preferences in Frescobaldi to point to your LilyPond executable.  Once you
have done that, you can use Frescobaldi to edit your lilypond files.  It's
so much better than the LilyPad editor that you will love it.

Detailed instructions for doing this are found in the Learning Manual:
https://lilypond.org/doc/v2.25/Documentation/learning/graphical-setup-under-macos

You don't need to use the Terminal at all if you follow these instructions.

I hope this is helpful.

Carl Sorensen


Help with Mac

2024-04-15 Thread Alejandro Castera
Good afternoon, community.

I've been using Lilypond on Mac for a long time, but for a few years now they 
haven't released a new version to install in DMG format. There are some 
packages to install via "ports" (which I haven't understood what they are) and 
using MacPorts or Homebrew (which I haven't understood how to use either). All 
this through the Terminal command line, which I don't understand how to use. 
For this reason, I am still using LilyPond version 2.20 because it was the last 
one installable as DMG. Please, if someone can guide me to install the latest 
version of LilyPond 2.24.3 because I have tried several times in different ways 
and have not succeeded. 

Please, LilyPond developers, we need a DMG installer because not all of us Mac 
musicians know the Terminal command line.

Thanks in advance for your attention. 
Regards




Re: Help using a Scheme variable in a function

2024-04-13 Thread ming tsang
Hello Mathew Fong,
I am very interested in this scheme variable in a function, however I have
a hard time generating a working .ly with sample output.
Thank you.
-- 
ming (lyndon) tsang


Re: [HELP] RemoveAllEmptyStaves not working.

2024-03-06 Thread Lucas Cavalcanti
Hello, Kieren. Your suggestion did fix the issue. Thank you.

Em qua., 6 de mar. de 2024 às 14:52, Kieren MacMillan <
kie...@kierenmacmillan.info> escreveu:

> Hi Lucas,
>
> > I've used the RemoveAllEmptyStaves command to remove (obviously) the
> unnecessary staffs. However, the drumkit doesn't get removed like it should.
> > The drumkit staff is independent by itself; it is not part of a group
> staff. It is, however, a DrumStaff.
> > I've looked at the documentation (Hiding Staves) and found a similar
> situation (the double bass not being removed). However, the D.B was not
> removed because it was part of a section/group staff. Adding injury to the
> cause, I was not able comprehend the use of "Keep_alive" commands.
>
> It’s a little “nuclear”, but…
>
> \layout {
>   \context {
> \Score
> \RemoveAllEmptyStaves
>   }
> }
>
> [Note the \Score rather than \Staff]
>
> Hope that helps!
> Kieren.
> __
>
> My work day may look different than your work day. Please do not feel
> obligated to read or respond to this email outside of your normal working
> hours.
>
>


Re: [HELP] RemoveAllEmptyStaves not working.

2024-03-06 Thread Kieren MacMillan
Hi Lucas,

> I've used the RemoveAllEmptyStaves command to remove (obviously) the 
> unnecessary staffs. However, the drumkit doesn't get removed like it should.
> The drumkit staff is independent by itself; it is not part of a group staff. 
> It is, however, a DrumStaff.
> I've looked at the documentation (Hiding Staves) and found a similar 
> situation (the double bass not being removed). However, the D.B was not 
> removed because it was part of a section/group staff. Adding injury to the 
> cause, I was not able comprehend the use of "Keep_alive" commands.

It’s a little “nuclear”, but…

\layout {
  \context {
\Score
\RemoveAllEmptyStaves
  }
}

[Note the \Score rather than \Staff]

Hope that helps!
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




[HELP] RemoveAllEmptyStaves not working.

2024-03-06 Thread Lucas Cavalcanti
Hello. I'm writing a score of a song of which there are 16 measures of only
rests in two instruments (the rhythm and the drumkit). I've used the
RemoveAllEmptyStaves command to remove (obviously) the unnecessary staffs.
However, the drumkit doesn't get removed like it should.
The drumkit staff is independent by itself; it is not part of a group
staff. It is, however, a DrumStaff.
I've looked at the documentation (Hiding Staves
<https://lilypond.org/doc/v2.25/Documentation/notation/hiding-staves>) and
found a similar situation (the double bass not being removed). However, the
D.B was not removed because it was part of a section/group staff. Adding
injury to the cause, I was not able comprehend the use of "Keep_alive"
commands.

Any help would be appreciated
Lucas
\version "2.24.3"

\layout {
  \context {
\Staff
\RemoveAllEmptyStaves
  }
}

tempomapnormal = {
  \numericTimeSignature
  \repeat unfold 2 {
  \time 6/4 \repeat unfold 6 { s4 }
  \time 4/4 \repeat unfold 3 {s4 s4 s4 s4} \break
  \repeat unfold 3 {s4 s4 s4 s4}
  \time 5/4 \repeat unfold 5 {s4} \break
  }
}
drumkit = \drummode { 
{
  
  \numericTimeSignature
  \time 6/4 
  4 \repeat unfold 5 r4
  \time 4/4
  \repeat unfold 6 {r4 r4 r4 r4}
  \time 5/4 r4 r4 r4 r4 r4
  %They have no difference. 
  %Both methods don't solve the issue.
  \time 6/4 \repeat unfold 6 r4
  \time 4/4 \repeat unfold 6 { r4 r4 r4 r4 }
  \time 5/4 \repeat unfold 5 r4
  %\repeat unfold 35 s4
}

}
Melody = { << \relative c' 
{
  %Just notes. No problem here.
  %\sectionLabel "Intro"
  r4 e' f e8 d4 e a,,8
  f''4 e8 d4
  c a,8 e''4 d8 c4
  b a,8 c'4 b8 a4. a,4 f'' e8 d4 e a,,8 f''4 e8 d4 c
  a,8 e''4 d8 c4 b a,8
  c' r8 gis a4 a,8 c'4 d
  %\break
  a,^\markup"Only the Melody staff should appear." e'' f
  e8 d4 e a,,8
  gis''4 f8 e4 d a,8 f''4
  e8 d4 c a,8 d'4
  c8 b4. a,4 
  %\break
  f''
  e8 d4 e a,,8 f''4
  e8 d4 c a,8 e''4
  d8 c4 b a,8 
  c' r8
  gis a4 a,8 4 
  
}
{ \tempomapnormal }
>>}

Rhythm = {<< \relative c' 
{
  %No problem here.
  4 \repeat unfold 5 {r4} 
  \repeat unfold 6 {r4 r4 r4 r4}
  r4 r4 r4 4 4 \break
  \repeat unfold 6 r4
  \repeat unfold 6 { r4 r4 r4 r4 }
  \repeat unfold 5 r4
}
{ \tempomapnormal }
>>}
music = {<<
  
  { \new Staff \with { instrumentName="Melody" } \Melody }
  { \new Staff \with { instrumentName="Rhythm" } \Rhythm }
  { \new DrumStaff \with { instrumentName="Drumkit" } \drumkit }
>>}

\score { \music 
 \layout { 
   %I've enabled polymeter because the drums will play
   %a 7/8 against the main rhythm and melody.
   \enablePolymeter 
} }

Witchcraft-help.pdf
Description: Adobe PDF document


Re: Help

2024-03-03 Thread Karlin High
On Sun, Mar 3, 2024 at 2:54 PM George  wrote:
> Thank you Karlin for the promptness with which you responded. I'm glad, but 
> unfortunately I can't benefit from your wonderful program because I use 
> Windows 7 and I don't have the resources for Windows 10. Anyway, thank you 
> and I wish you the best of luck in the future, George.
> God bless!

I am confident there is a way to get LilyPond running on Windows 7.

If not a current version, then one of the older ones.



PS: In future messages to the LilyPond community, use Reply All or
otherwise include lilypond-user@gnu.org in the list of recipients.
-- 
Karlin High
Missouri, USA



Re: Help

2024-03-02 Thread Karlin High
On Sat, Mar 2, 2024 at 7:48 PM George  wrote:

> I would like to know if your program can export as Picture and PDF.
>

Yes: PDF and PNG.

See the Usage Manual for more options.

<
https://lilypond.org/doc/v2.24/Documentation/usage/command_002dline-usage#basic-command-line-options-for-lilypond
>
-- 
Karlin High
Missouri, USA


Help

2024-03-02 Thread George
Hi, I congratulate you on your excellent creation. I am glad that it is
still accessible to those who are passionate but without money. I would
like to know if your program can export as Picture and PDF. Thank you.
George


Re: Help with some lyrics gymnastics

2024-01-17 Thread Matthew Fong
Thank you again, Thomas. I'm going to try this out this week!

Matt


Re: Help with some lyrics gymnastics

2024-01-15 Thread Thomas Richter

Hello again,

a few more ideas:

My solution uses the TextSpanner which works for two or more notes. But 
for a single note (syllable), a function like your lyricsWithOption is 
more suitable. The following draws the separating line in the proper length.


%%-

#(define-markup-command (stacked-lyric-single layout props one two)
  (string? string?)
  (let* ((lyric (interpret-markup layout props 
(make-stacked-lyric-markup one two)))

 (width (interval-length (ly:stencil-extent lyric X
    (ly:stencil-add
  lyric
  (make-line-stencil 0.1 0 0.8 width 0.8

%%-

It can be used in the Lyrics context, e.g.

\markup \stacked-lyric-single "you" "God the Father"


For another line thickness, change the first argument of 
make-line-stencil (0.1) and include the following for the TextSpanner in 
the startStackedLyric function with a 10 times larger value:


\once \override TextSpanner.thickness = #1.0


For a proper layout in case of a TextSpanner line break, it could be 
necessary to set the properties of left-broken and right-broken in 
bound-details.



All the best,

Thomas

--

Thomas Richter
Vienna / Austria
thomas-rich...@aon.at

Re: Help with some lyrics gymnastics

2024-01-15 Thread Matthew Fong
Hello Thomas,

That works splendidly. Thank you. The NullVoice is a new concept to me, and
seems necessary here.

I also found the same LSR example and was working through trying to
understand it.


Many thanks,
mattfong


Re: Help with some lyrics gymnastics

2024-01-14 Thread Thomas Richter



On Fri, Jan 12, 2024 at 6:09 PM Matthew Fong  wrote:

I'm trying to replicate lyrics as shown in the red box (the Roman
Missal in English), where
1/ Lyric options are *stacked* and separated by a horizontal line
2/ Lyrics without options are*vertically centered* relative to the
option stack



The following uses TextSpanner for the separating line and the Lyrics 
context is aligned to a NullVoice.


%%-

\version "2.24.0"

#(define-markup-command (stacked-lyric layout props one two)
  (string? string?)
  #:properties ((baseline-skip))
  (interpret-markup layout props
    (markup
  #:translate `(0 . ,(* 0.5 baseline-skip))
  #:center-column (one two

startStackedLyric =
#(define-music-function (one two)
  (string? string?)
  (let ((lyric (make-stacked-lyric-markup one two)))
    #{
  \once \override TextSpanner.style = #'line
  \once \override TextSpanner.outside-staff-priority = ##f
  \once \override TextSpanner.padding = #0.8
  \once \override TextSpanner.bound-details =
    #(lambda (grob)
  `((left (padding .
    ,(* -0.5 (interval-length
  (ly:stencil-extent
    (grob-interpret-markup grob lyric) X
  (attach-dir . -1))
    (right (padding . -0.5
  \lyricmode { #lyric }
  \startTextSpan
    #}))

stackedLyric =
#(define-music-function (one two)
  (string? string?)
  #{ \lyricmode { \markup \stacked-lyric #one #two } #})

stopStackedLyric =
#(define-music-function () ()
  #{ \lyricmode { "" } \stopTextSpan #})


\new Staff
<<
  \new Voice \relative c'' {
    g4 a\breve*1/4 g4
    g4 a\breve*1/4 a4
  }
  \new NullVoice = "aligner" {
    g4 a8*4/5 a a a a g4
    g4 a8 a4 a8 a4
  }
  \new Lyrics \lyricsto "aligner" {
    \override VerticalAxisGroup.nonstaff-relatedstaff-spacing.padding = 
#2.5

    Through our Lord Jesus Christ, your Son,
    \startStackedLyric "who" "who"
    \stackedLyric "lives" "live"
    \stackedLyric "and reigns" "and reign"
    \stopStackedLyric
    with
  }
>>
\layout {
  \context {
    \Lyrics
    \consists "Text_spanner_engraver"
  }
}

%%-

Note that \stopStackedLyric requires a separate note in the NullVoice. 
Its note value affects the length to the right of the horizontal line.


I used a somehow similar solution for function theory symbols, based on 
the snipped lsr.di.unimi.it/LSR/Item?id=967 
 by Klaus Blum.



All the best,

Thomas

--
Thomas Richter
Vienna / Austria
thomas-rich...@aon.at

Re: Help with some lyrics gymnastics

2024-01-13 Thread David Wright
On Sat 13 Jan 2024 at 08:25:32 (-0800), Matthew Fong wrote:
> Hello everyone,
> 
> I've done a few more things which might be described as hacking using
> \markup.
> 
> \tweak LyricText.self-alignment-X #-0.75
> \markup \center-column { \override #'(baseline-skip . 0.4) \line{ "lives
> and reigns" } \vspace #-0.6 \line { \draw-line #'(19 . 0) } \vspace #-0.1
> \line { "live and reign" }}
> 
> Could this be implemented via something like a TextSpanner? The horizontal
> line has some overhang, but too much and it start a staff on the next line.
> 
> Unfortunately, I cannot change just one portion of the vertical alignment
> using VerticalAxisGroup.nonstaff-relatedstaff-spacing.padding
> 
> Any help is appreciated. Attached is my latest MWE.

Sorry, but can you stop reposting the original with each iteration,
please; I now have three copies, and so does everybody else on this list.

Cheers,
David.



Re: Help need with the "implicitBassFigures" command

2024-01-12 Thread Eef Weenink
> So my choosing the number as “0” (or any other). I can use that
> number instead of the original to have it surpressed.
> Good to know. For pratical reasons (not getting lost in my scores ☺ )
> I will set this everytime to “5” or what number needed (in figured
> bass, I know about the 5 not being needed to mention, because if
> nothing written it is always 5.

If you think about it, that's not true! There are many notes which
remain unfigured where it is left to the performer to judge that a
change of harmony is not required. Indeed, usually the majority of
notes.
And conversely, you do see the 5 even when it is not the resolution of
a suspension.

>  Maybe also some other numbers to surpress? )

Well, just to keep track of what the figure being suppressed is, you
could use 55 in your implicitBassFigures list - it would mean you only
have to declare the list once. Then you would write the figure 55 for
those 5's which are being suppressed.

I have to say that if I came across your example in performance I would
imagine it was the 6 on the note earlier that was being extended. But
then, as the figures are appearing below the staff, the figures are
perhaps intended for academic use only?
---
I like the idea with the number 55. Easy to remember, what it stands for.

The example was copy-pasted together to get as much variations in a short line.
Nothing to analyze.

I understand that the suppressing of numbers, or just not writing down a 
number, depends on time, place and composer in history. Every time, place and 
person had his/her conventions. I am in the process of learning this.
And for me, my convention now is:
- As as start I presume any note on the bassline is the tonica of a harmony.
- Looking at the melody above, it could be that some notes are passing notes, 
or other notes not part of the harmony-structure.
- Unless there is a number I will presume the chord would have the number 5. If 
something else is needed, they would have written it down.
- Sometimes the 5 is written down, then I have to take care that at least there 
is a fifth in the chord.
- Extension lines are a way to say” Next note has the same harmonic number”

As soon things come on my path, what do not fit this shortlist, I have to add 
more rules. ☺

And now back to Wolf, General Bass.
Thank you for your help. Regards, Eef


Re: Help need with the "implicitBassFigures" command

2024-01-12 Thread Richard Shann
On Thu, 2024-01-11 at 12:40 +, Eef Weenink wrote:
> Thank you Richard
> 
> You say: “ 
> You don't have to use 5 as the implicit figure:”
> 
> Try:
> -
> 
>     \new FiguredBass \with { implicitBassFigures = #'(0) }   
> \figuremode {
>   \set figuredBassAlterationDirection = #RIGHT
>   \set figuredBassPlusDirection = #RIGHT
>   \override BassFigureAlignment.stacking-dir = #DOWN
>   <6 5->8 <0 4->8
> --
> 
> So my choosing the number as “0” (or any other). I can use that
> number instead of the original to have it surpressed.
> Good to know. For pratical reasons (not getting lost in my scores ☺ )
> I will set this everytime to “5” or what number needed (in figured
> bass, I know about the 5 not being needed to mention, because if
> nothing written it is always 5.

If you think about it, that's not true! There are many notes which
remain unfigured where it is left to the performer to judge that a
change of harmony is not required. Indeed, usually the majority of
notes.
And conversely, you do see the 5 even when it is not the resolution of
a suspension.

>  Maybe also some other numbers to surpress? )

Well, just to keep track of what the figure being suppressed is, you
could use 55 in your implicitBassFigures list - it would mean you only
have to declare the list once. Then you would write the figure 55 for
those 5's which are being suppressed.

I have to say that if I came across your example in performance I would
imagine it was the 6 on the note earlier that was being extended. But
then, as the figures are appearing below the staff, the figures are
perhaps intended for academic use only?

Richard Shann



> Anyway most clear is to implicitBassFigures=”5” and write 5
> 
> To ease my life: 
> declare in the beginning: 
> -
> extendOn = \bassFigureExtendersOn
> extendOnImpFive = { \bassFigureExtendersOn 
> \set implicitBassFigures = #'(5)}
> extendOff = {\bassFigureExtendersOff 
> \set implicitBassFigures = #'()}
> ---
> use as needed
> 
> 
> Regards, Eef




Re: Help need with the "implicitBassFigures" command

2024-01-11 Thread Eef Weenink
Perfect solution. I repeat it for future readers:

Context = \new FiguredBass
First time:
Set in context with:
\new FiguredBass \with { implicitBassFigures = #'(0) }
Or in score with:
  \set FiguredBass.implicitBassFigures = #'(0)
Next time(s)
\set implicitBassFigures = #'(0)
Is enough,

And if context = Staff, change every FiguredBass to Staff

Thank you. Eef

Van: Michael Werner 
Datum: donderdag, 11 januari 2024 om 12:15
Aan: Eef Weenink 
CC: lilypond-user@gnu.org 
Onderwerp: Re: Help need with the "implicitBassFigures" command
Hi there,

On Thu, Jan 11, 2024 at 5:49 AM Eef Weenink 
mailto:h.e.ween...@de-erve.nl>> wrote:
\new FiguredBass \with { implicitBassFigures = #'(0) }
%{if I set the implicitBass to 5, or other number, it works for the whole 
passage%}
\figuremode {
  \set figuredBassAlterationDirection = #RIGHT
  \set figuredBassPlusDirection = #RIGHT
  \override BassFigureAlignment.stacking-dir = #DOWN
  <6 5->8 <5 4->8
  \extendOn
  \set Staff.implicitBassFigures = #'(5)
  %{if I set the implicitBass to 5, or other number, it DOES NOT do 
anything%}
  <5 3>4
  \set Staff.implicitBassFigures = #'(0)
  \extendOff <5 _+>8
  <7>8 <6>8 <5>4

You had it almost right here. The one thing you need to change is that the 
implicitBassFigures property is part of the FiguredBass context, not Staff. 
Since there is no implicitBassFigures property in the Staff context that \set 
command will just get silently ignored. So either change the
\set Staff.implicitBassFigures
to
\set FiguredBass.implicitBassFigures
or, since these statements are already in the FiguredBass context, just leave 
the context off and make it just
\set implicitBassFigures
And then you should be good.
--
Michael


Re: Help need with the "implicitBassFigures" command

2024-01-11 Thread Richard Shann
On Thu, 2024-01-11 at 10:43 +, Eef Weenink wrote:
> Good day to all of you.
> 
> I am working on a figured bass, and now it is needed to get an
> extended line under two notes, not showing the number:
> Afbeelding met lijn, Lettertype, ontvangst, tekst
> 
> Automatisch gegenereerde beschrijving
> The line under the d and e have the meaning: Read as 5 and extend to
> next note.
> I made this using this command: 
>   \new FiguredBass \with { implicitBassFigures = #'(5) }
>  
> But this surpresses ALL the “fives” in the fragment. It I set it to
> “0” or leave it out, I see this:
> Afbeelding met Lettertype, lijn, muziek
> 
> Automatisch gegenereerde beschrijving
> Only the 5 at d and e should be surpressed. So I input these lines: 
> <5 4->8
>   \extendOn
>   \set Staff.implicitBassFigures = #'(5)
>   %{if I set the implicitBass to 5, or other number, it DOES NOT
> do anything%}
>   <5 3>4
>   \set Staff.implicitBassFigures = #'(0)
> 
> Big puzzle now is how to get this to work. I read somewhere this
> would be caused by combination of implicitBassfigures and
> \bassFigureExtendersOn.
> However it is no option to leave \bassFigureExtendersOn out (I would
> not get the line I need).
> 
> For testing, here is the example I used: 
> %%---
> \version "2.24.3"
>  
> extendOn = \bassFigureExtendersOn
> extendOff = \bassFigureExtendersOff
>  
> \score {
>   \new StaffGroup <<
>     \new Staff = "violone" \with {
>   instrumentName = \markup {
>     \center-column { Violone, \line { e Cembalo. } }
>   }
>     }
>     {
>   \time 4/4
>   \clef bass
>   fis8 d8 e8 fis8 g8 g,4 g16 f
>     }
>  
>     \new FiguredBass \with { implicitBassFigures = #'(0) }
>     %{if I set the implicitBass to 5, or other number, it works for
> the whole passage%}
>     \figuremode {
>   \set figuredBassAlterationDirection = #RIGHT
>   \set figuredBassPlusDirection = #RIGHT
>   \override BassFigureAlignment.stacking-dir = #DOWN
>   <6 5->8 <5 4->8
>   \extendOn
>   \set Staff.implicitBassFigures = #'(5)
>   %{if I set the implicitBass to 5, or other number, it DOES NOT
> do anything%}
>   <5 3>4 
>   \set Staff.implicitBassFigures = #'(0)
>   \extendOff <5 _+>8
>   <7>8 <6>8 <5>4
> }
>   >>
> }
> %%
You don't have to use 5 as the implicit figure:

Try:
\version "2.24.3"
 
extendOn = \bassFigureExtendersOn
extendOff = \bassFigureExtendersOff
 
\score {
  \new StaffGroup <<
\new Staff = "violone" \with {
  instrumentName = \markup {
\center-column { Violone, \line { e Cembalo. } }
  }
}
{
  \time 4/4
  \clef bass
  fis8 d8 e8 fis8 g8 g,4 g16 f
}
 
\new FiguredBass \with { implicitBassFigures = #'(0) }
%{if I set the implicitBass to 5, or other number, it works for the
whole passage%}
\figuremode {
  \set figuredBassAlterationDirection = #RIGHT
  \set figuredBassPlusDirection = #RIGHT
  \override BassFigureAlignment.stacking-dir = #DOWN
  <6 5->8 <0 4->8
  \extendOn
 % \set Staff.implicitBassFigures = #'(5)
  %{if I set the implicitBass to 5, or other number, it DOES NOT do
anything%}
  <0 3>4
  \set Staff.implicitBassFigures = #'(0)
  \extendOff <5 _+>8
  <7>8 <6>8 <5>4
}
  >>
}
%%

Richard




Re: Help need with the "implicitBassFigures" command

2024-01-11 Thread Michael Werner
Hi there,

On Thu, Jan 11, 2024 at 5:49 AM Eef Weenink  wrote:

> \new FiguredBass \with { implicitBassFigures = #'(0) }
>
> %{if I set the implicitBass to 5, or other number, it works for the
> whole passage%}
>
> \figuremode {
>
>   \set figuredBassAlterationDirection = #RIGHT
>
>   \set figuredBassPlusDirection = #RIGHT
>
>   \override BassFigureAlignment.stacking-dir = #DOWN
>
>   <6 5->8 <5 4->8
>
>   \extendOn
>
>   \set Staff.implicitBassFigures = #'(5)
>
>   %{if I set the implicitBass to 5, or other number, it DOES NOT do
> anything%}
>
>   <5 3>4
>
>   \set Staff.implicitBassFigures = #'(0)
>
>   \extendOff <5 _+>8
>
>   <7>8 <6>8 <5>4
>

You had it almost right here. The one thing you need to change is that
the implicitBassFigures property is part of the FiguredBass context, not
Staff. Since there is no implicitBassFigures property in the Staff context
that \set command will just get silently ignored. So either change the
\set Staff.implicitBassFigures
to
\set FiguredBass.implicitBassFigures
or, since these statements are already in the FiguredBass context, just
leave the context off and make it just
\set implicitBassFigures
And then you should be good.
--
Michael


Help need with the "implicitBassFigures" command

2024-01-11 Thread Eef Weenink
Good day to all of you.

I am working on a figured bass, and now it is needed to get an extended line 
under two notes, not showing the number:
[Afbeelding met lijn, Lettertype, ontvangst, tekst  Automatisch gegenereerde 
beschrijving]
The line under the d and e have the meaning: Read as 5 and extend to next note.
I made this using this command:
  \new FiguredBass \with { implicitBassFigures = #'(5) }

But this surpresses ALL the “fives” in the fragment. It I set it to “0” or 
leave it out, I see this:
[Afbeelding met Lettertype, lijn, muziek  Automatisch gegenereerde beschrijving]
Only the 5 at d and e should be surpressed. So I input these lines:
<5 4->8
  \extendOn
  \set Staff.implicitBassFigures = #'(5)
  %{if I set the implicitBass to 5, or other number, it DOES NOT do 
anything%}
  <5 3>4
  \set Staff.implicitBassFigures = #'(0)

Big puzzle now is how to get this to work. I read somewhere this would be 
caused by combination of implicitBassfigures and \bassFigureExtendersOn.
However it is no option to leave \bassFigureExtendersOn out (I would not get 
the line I need).

For testing, here is the example I used:
%%---
\version "2.24.3"

extendOn = \bassFigureExtendersOn
extendOff = \bassFigureExtendersOff

\score {
  \new StaffGroup <<
\new Staff = "violone" \with {
  instrumentName = \markup {
\center-column { Violone, \line { e Cembalo. } }
  }
}
{
  \time 4/4
  \clef bass
  fis8 d8 e8 fis8 g8 g,4 g16 f
}

\new FiguredBass \with { implicitBassFigures = #'(0) }
%{if I set the implicitBass to 5, or other number, it works for the whole 
passage%}
\figuremode {
  \set figuredBassAlterationDirection = #RIGHT
  \set figuredBassPlusDirection = #RIGHT
  \override BassFigureAlignment.stacking-dir = #DOWN
  <6 5->8 <5 4->8
  \extendOn
  \set Staff.implicitBassFigures = #'(5)
  %{if I set the implicitBass to 5, or other number, it DOES NOT do 
anything%}
  <5 3>4
  \set Staff.implicitBassFigures = #'(0)
  \extendOff <5 _+>8
  <7>8 <6>8 <5>4
}
  >>
}
%%


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 with correct pitch after function call within \relative

2024-01-08 Thread Artur Dobija
Dear Lilypond-user,
I sent this mail to the wrong mail, I should have send it to
lilypond-user-requ...@gnu.org ! Sorry!
Best,
Artur Dobija

pon., 8 sty 2024 o 23:56 Artur Dobija  napisał(a):

> 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 need to *remove* them, not only hide, because if they are still there,
> they still heavily affect the spacing in unexpected ways!
> What I ask you is: how to *remove* notes "c" and "d" in such a way, that
> it would not mess up the relative mode and think, that the note "f" is
> calculated from the note "d" (otherwise it will be octave lower)? The
> function is agnostic of the pitch before and pitch after.
>
> What I tried:
> – \resetRelativeOctave
> – setting to-relative-callback note property to ##f
>
> customLigatura =
> #(define-music-function
>   (music)
>   (ly:music?)
>
>   (let ((notes (list)) ; notes participating in ligature creation: pitch,
> duration, shape (square, punctum, obliqua, pes, )
> (total-duration (make-duration-of-length (ly:music-length music
>
> ; get all those notes only that will form ligature's stencil
> (for-some-music
>   (lambda (m)
>(if (equal? (ly:music-property m 'name) 'NoteEvent)
>  (set! notes
>(append notes
>   (list (make-music
> 'NoteEvent
> 'pitch (ly:music-property m 'pitch)
> 'duration (ly:music-property m 'duration)
>   'mensural-ligature-shape (ly:music-property m
> 'mensural-ligature-shape)
>  #f))
>   music)
>
>   #{
>   \once \override MensuralVoice.NoteHead.stencil =
> #ly:text-interface::print
>   \once \override MensuralVoice.NoteHead.text = \markup \translate
> #'(0 . -0.5) "Ligatura" % this will be my stencil.
>
>  % only the first note with new stencil must be printed
>   #(make-music
>  'NoteEvent
>  'duration total-duration
>  'pitch (ly:music-property (list-ref notes 0) 'pitch))
>
> %{
>What goes here to trick the relative mode to think
>   that it must calculate the pitch from the LAST note
>   (and not the given note)?
>something like: \countRelativeFrom d
>
>   I tried:
>   (ly:make-music-relative! music (ly:make-pitch
>  -1
>  (quotient
>  (ly:pitch-steps
> (ly:make-pitch 1 0))
>  2)))
>   \resetRelativeOctave #(last (music-pitches music))
> %}
>   #}))
>
> % TESTS
> <<
> \new MensuralStaff \new MensuralVoice \relative { \clef F g,1 \ligatura {
> a a' c,, g''} a }
> \new MensuralStaff \new MensuralVoice \relative { \clef F g,1 a a' c,, g''
> a }
> >>
> <<
> \new MensuralStaff \new MensuralVoice \relative { a1 \ligatura { b c d } f
> }
> \new MensuralStaff \new MensuralVoice \relative { a1 b c d f }
> >>
>
> % ArturJD, Engraving Chant, https://www.instagram.com/engraving.chant/
>
>


Help with correct pitch after function call within \relative

2024-01-08 Thread Artur Dobija
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 need to *remove* them, not only hide, because if they are still there,
they still heavily affect the spacing in unexpected ways!
What I ask you is: how to *remove* notes "c" and "d" in such a way, that it
would not mess up the relative mode and think, that the note "f" is
calculated from the note "d" (otherwise it will be octave lower)? The
function is agnostic of the pitch before and pitch after.

What I tried:
– \resetRelativeOctave
– setting to-relative-callback note property to ##f

customLigatura =
#(define-music-function
  (music)
  (ly:music?)

  (let ((notes (list)) ; notes participating in ligature creation: pitch,
duration, shape (square, punctum, obliqua, pes, )
(total-duration (make-duration-of-length (ly:music-length music

; get all those notes only that will form ligature's stencil
(for-some-music
  (lambda (m)
   (if (equal? (ly:music-property m 'name) 'NoteEvent)
 (set! notes
   (append notes
  (list (make-music
'NoteEvent
'pitch (ly:music-property m 'pitch)
'duration (ly:music-property m 'duration)
  'mensural-ligature-shape (ly:music-property m
'mensural-ligature-shape)
 #f))
  music)

  #{
  \once \override MensuralVoice.NoteHead.stencil =
#ly:text-interface::print
  \once \override MensuralVoice.NoteHead.text = \markup \translate #'(0
. -0.5) "Ligatura" % this will be my stencil.

 % only the first note with new stencil must be printed
  #(make-music
 'NoteEvent
 'duration total-duration
 'pitch (ly:music-property (list-ref notes 0) 'pitch))

%{
   What goes here to trick the relative mode to think
  that it must calculate the pitch from the LAST note
  (and not the given note)?
   something like: \countRelativeFrom d

  I tried:
  (ly:make-music-relative! music (ly:make-pitch
 -1
 (quotient
 (ly:pitch-steps
(ly:make-pitch 1 0))
 2)))
  \resetRelativeOctave #(last (music-pitches music))
%}
  #}))

% TESTS
<<
\new MensuralStaff \new MensuralVoice \relative { \clef F g,1 \ligatura { a
a' c,, g''} a }
\new MensuralStaff \new MensuralVoice \relative { \clef F g,1 a a' c,, g''
a }
>>
<<
\new MensuralStaff \new MensuralVoice \relative { a1 \ligatura { b c d } f }
\new MensuralStaff \new MensuralVoice \relative { a1 b c d f }
>>

% ArturJD, Engraving Chant, https://www.instagram.com/engraving.chant/


Re: Help with Measure Numbers

2024-01-07 Thread David Wright
On Mon 08 Jan 2024 at 01:45:32 (+), Karen Billings wrote:
> I deleted the commented section, saved the file, and got the same behavior. I 
> used the file lilypond-8.22.1.mingw, downloaded on 8/8/21, to install 
> lilypond on this machine. Is that the correct install program?

I don't see that the program version matters. I've not noticed
any changes in this area for years.

> Ultimately, the solution was a combination of Kieren's and Mario's solutions:
> 1. Move "Bar_number_engraver" to layout block:
> 
> 
>     \context {
> 
>       \Score
> 
>       \consists "Bar_number_engraver"
> 
>       barNumberVisibility = #(every-nth-bar-number-visible 1)
> 
>       \override BarNumber.break-visibility = #end-of-line-invisible
> 
>     }
> 
> 
> 2. Replace contents of the \Score block with a BarNumber.break-visibility 
> statement
> 
>     \context {
> 
>       \Score
> 
>       \override BarNumber.break-visibility = ##(#f #t #f)
> 
>     }
> 
>   
> The odd thing is that the original "Bar_number_engraver" command worked fine 
> with a single staff.

So what you've got here is a context (1) to write barnumbers on the
first measure of each line, followed by a context (2) to write
barnumbers on all measures except the first. (It doesn't matter
where you place the barNumberVisibility.)

I would just write the single context:

  \context {
\Score
\override BarNumber.break-visibility = #end-of-line-invisible
barNumberVisibility = #all-bar-numbers-visible
  }

which is what Kieren suggested.

You could even put the following in a separate file, and just drop it
in with \include at the top of the file (like language, paper etc)
whenever you needed it to apply by default to all scores in the file.

  \layout {
\context {
  \Score
  \override BarNumber.break-visibility = #end-of-line-invisible
  barNumberVisibility = #all-bar-numbers-visible
}
  }

Cheers,
David.



Re: Help with Measure Numbers

2024-01-07 Thread Karen Billings
 David, Kieren, and Mario,
I deleted the commented section, saved the file, and got the same behavior. I 
used the file lilypond-8.22.1.mingw, downloaded on 8/8/21, to install lilypond 
on this machine. Is that the correct install program?
Ultimately, the solution was a combination of Kieren's and Mario's solutions:
1. Move "Bar_number_engraver" to layout block:


    \context {

      \Score

      \consists "Bar_number_engraver"

      barNumberVisibility = #(every-nth-bar-number-visible 1)

      \override BarNumber.break-visibility = #end-of-line-invisible

    }


2. Replace contents of the \Score block with a BarNumber.break-visibility 
statement

    \context {

      \Score

      \override BarNumber.break-visibility = ##(#f #t #f)

    }

  
The odd thing is that the original "Bar_number_engraver" command worked fine 
with a single staff.
Thanks to all for your help with this!
Karen
On Sunday, January 7, 2024 at 05:30:08 PM MST, David Wright 
 wrote:  
 
 On Sun 07 Jan 2024 at 23:55:09 (+), Karen Billings wrote:
>  Thank you so much for the info, Kieren.
> I followed your instructions and moved the bar numbering block
>     \context {      \Score      \consists "Bar_number_engraver"      
> barNumberVisibility = #(every-nth-bar-number-visible 1)      \override 
> BarNumber.break-visibility = #end-of-line-invisible    }
> from the beginning of the score to the layout block, as in your example.
> Unfortunately, I now get two bar numbers on every measure (not just the first 
> one in each line)! (Is it already Monday?)
> 
> 
> Revised snipped attached.

I compiled the attachment you posted (Morning Wings (snippet2).ly)
and got an eight measure score with each measure numbered (once).
Perhaps you hadn't commented out the first half-dozen lines under
\score when you compiled it, viz:

  % Move measure numbering to layout section
  % \context PianoStaff \with {
  %    \consists "Bar_number_engraver"
  %    barNumberVisibility = #(every-nth-bar-number-visible 1)
  %    \override BarNumber.break-visibility = #end-of-line-invisible
  %  }

Cheers,
David.
  

Re: Help with Measure Numbers

2024-01-07 Thread David Wright
On Sun 07 Jan 2024 at 23:55:09 (+), Karen Billings wrote:
>  Thank you so much for the info, Kieren.
> I followed your instructions and moved the bar numbering block
>     \context {      \Score      \consists "Bar_number_engraver"      
> barNumberVisibility = #(every-nth-bar-number-visible 1)      \override 
> BarNumber.break-visibility = #end-of-line-invisible    }
> from the beginning of the score to the layout block, as in your example.
> Unfortunately, I now get two bar numbers on every measure (not just the first 
> one in each line)! (Is it already Monday?)
> 
> 
> Revised snipped attached.

I compiled the attachment you posted (Morning Wings (snippet2).ly)
and got an eight measure score with each measure numbered (once).
Perhaps you hadn't commented out the first half-dozen lines under
\score when you compiled it, viz:

  % Move measure numbering to layout section
  % \context PianoStaff \with {
  %\consists "Bar_number_engraver"
  %barNumberVisibility = #(every-nth-bar-number-visible 1)
  %\override BarNumber.break-visibility = #end-of-line-invisible
  %  }

Cheers,
David.



Re: Help with Measure Numbers

2024-01-07 Thread Karen Billings
 Thank you so much for the info, Kieren.
I followed your instructions and moved the bar numbering block
    \context {      \Score      \consists "Bar_number_engraver"      
barNumberVisibility = #(every-nth-bar-number-visible 1)      \override 
BarNumber.break-visibility = #end-of-line-invisible    }
from the beginning of the score to the layout block, as in your example.
Unfortunately, I now get two bar numbers on every measure (not just the first 
one in each line)! (Is it already Monday?)


Revised snipped attached.
KarenOn Sunday, January 7, 2024 at 04:13:26 PM MST, Kieren MacMillan 
 wrote:  
 
 Hi Karen,

> I need all measures numbered in this score - for some reason, the first 
> measure number in each line is being printed twice:

Just add/configure the Bar_number_engraver at the Score level — see snippet 
below.

Hope this helps!
Kieren.

% Version 1.0
% Last edit:  January 7, 2024
%
% The source code is covered by the Creative
% Commons Attribution-NonCommercial license,
% http://creativecommons.org/licenses/by-nc/2.5/
% Attribution:  Karen S. Billings CAGO
%

\version "2.22.1"
\include "english.ly"
ignore = \override NoteColumn.ignore-collision = ##t
\layout { indent = 0.0\cm }

\paper {
  #(define top-margin (* 0.5 in))
  #(define line-width (* 6.5 in))
  #(define bottom-margin (* 1.0 in))
  top-system-spacing.basic-distance = #10
  score-system-spacing.basic-distance = #10
  system-system-spacing.basic-distance = #17
  last-bottom-spacing.basic-distance = #10
  score-markup-spacing.basic-distance = #15
  ragged-bottom = ##t
}

% #(set-global-staff-size 24)

harmony = \chordmode {
  % Insert chords if needed
}
Melody = \relative c'' {
  \clef treble
  \key c \major
  \autoBeamOn
  \numericTimeSignature
  \time 4/4
  R1*4
  \bar "||" \break
  a4 a c c e, a a2
  c,4 e d c8 b a2 a2
  \bar "|."
}

Words = \lyricmode {
  _ _ _ _ _ _ _
}


UpperOne = \relative c'' {
  \clef treble
  \key c \major
  \numericTimeSignature
  \stemUp
  \time 4/4
  \repeat unfold 4 { 4  2 }
  c4 b8 a b2 a1
  a8 b 4 4 g a1
}

UpperTwo = \relative c' {
  \clef treble
  \key c \major
  \numericTimeSignature
  \stemDown
  \time 4/4
  \repeat unfold 4 { e8 e e e e2 }
  e8 e e4 d2
  c8 d e4 d2
  e8 f e4 d2
  4 d e2
}

LowerOne = \relative c' {
  \clef bass
  \key c \major
  \numericTimeSignature
  \time 4/4
  \stemUp
  a1 a a a
  a1 a a a
}
LowerTwo = {
  \clef bass
  \key c \major
  \numericTimeSignature
  \stemDown
  \time 4/4
}


\score {
  <<
    %    \new ChordNames {
    %      \set chordChanges = ##t
    %      \harmony
    %    }
    \new Staff
    \new Voice = "mel" \Melody
    \new Lyrics \lyricsto mel \Words
    \new PianoStaff <<
      \new Staff = "Upper"  <<
        \new Voice = "UpperOne" \UpperOne
        \new Voice = "UpperTwo" \UpperTwo
      >>
      \new Staff = "Lower" <<
        \new Voice = "LowerOne" \LowerOne
        \new Voice = "LowerTwo" \LowerTwo
      >>
    >>
  >>
  \layout {
    ragged-last = ##f
    ragged-right = ##f
    \context {
      \Score
      \consists "Bar_number_engraver"
      barNumberVisibility = #(every-nth-bar-number-visible 1)
      \override BarNumber.break-visibility = #end-of-line-invisible
    }
    \context {
      \Lyrics
      \override LyricSpace.minimum-distance = #0.8
      \override LyricText.font-size = #+1.2
      \override VerticalAxisGroup.minimum-Y-extent = #'(-1 . 1)
      \override VerticalAxisGroup.
      nonstaff-relatedstaff-spacing.padding = #1.5
      \override VerticalAxisGroup.
      nonstaff-unrelatedstaff-spacing.padding = #1.5
    }
  }
}

__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.

  % Version 1.0
% Last edit:  January 7, 2024
%
% The source code is covered by the Creative
% Commons Attribution-NonCommercial license,
% http://creativecommons.org/licenses/by-nc/2.5/
% Attribution:  Karen S. Billings CAGO
%


\version "2.22.1"
\include "english.ly"
ignore = \override NoteColumn.ignore-collision = ##t
\layout { indent = 0.0\cm }

\paper {
  #(define top-margin (* 0.5 in))
  #(define line-width (* 6.5 in))
  #(define bottom-margin (* 1.0 in))
  top-system-spacing.basic-distance = #10
  score-system-spacing.basic-distance = #10
  system-system-spacing.basic-distance = #17
  last-bottom-spacing.basic-distance = #10
  score-markup-spacing.basic-distance = #15
  ragged-bottom = ##t
}

% #(set-global-staff-size 24)

harmony = \chordmode {
  % Insert chords if needed
}
Melody = \relative c'' {
  \clef treble
  \key c \major
  \autoBeamOn
  \numericTimeSignature
  \time 4/4
  R1*4
  \bar "||" \break
  a4 a c c e, a a2
  c,4 e d c8 b a2 a2
  \bar "|."
}

Words = \lyricmode {
  _ _ _ _ _ _ _
}


UpperOne = \relative c'' {
  \clef treble
  \key c \major
  \numericTimeSignature
  \stemUp
  \time 4/4
  \repeat unfold 4 { 4  2 }
  c4 b8 a b2 a1
  a8 b 4 4 g a1
}

UpperTwo = \relative c' {
  \clef treble
  

Re: Help with Measure Numbers

2024-01-07 Thread Mario Moles

\override BarNumber.break-visibility = ##(#f #t #f)

Il 07/01/24 23:19, Karen Billings ha scritto:
Hi all - I'm currently using Lilypond 2.22.1 to set some handbell 
music, and I'm encountering a problem with measure numbering.


I need all measures numbered in this score - for some reason, the 
first measure number in each line is being printed twice:


Inline image

Working file is attached.

Thanks much!

Karen


Re: Help with Measure Numbers

2024-01-07 Thread Kieren MacMillan
Hi Karen,

> I need all measures numbered in this score - for some reason, the first 
> measure number in each line is being printed twice:

Just add/configure the Bar_number_engraver at the Score level — see snippet 
below.

Hope this helps!
Kieren.

% Version 1.0
% Last edit:  January 7, 2024
%
% The source code is covered by the Creative
% Commons Attribution-NonCommercial license,
% http://creativecommons.org/licenses/by-nc/2.5/
% Attribution:  Karen S. Billings CAGO
%

\version "2.22.1"
\include "english.ly"
ignore = \override NoteColumn.ignore-collision = ##t
\layout { indent = 0.0\cm }

\paper {
  #(define top-margin (* 0.5 in))
  #(define line-width (* 6.5 in))
  #(define bottom-margin (* 1.0 in))
  top-system-spacing.basic-distance = #10
  score-system-spacing.basic-distance = #10
  system-system-spacing.basic-distance = #17
  last-bottom-spacing.basic-distance = #10
  score-markup-spacing.basic-distance = #15
  ragged-bottom = ##t
}

% #(set-global-staff-size 24)

harmony = \chordmode {
  % Insert chords if needed
}
Melody = \relative c'' {
  \clef treble
  \key c \major
  \autoBeamOn
  \numericTimeSignature
  \time 4/4
  R1*4
  \bar "||" \break
  a4 a c c e, a a2
  c,4 e d c8 b a2 a2
  \bar "|."
}

Words = \lyricmode {
  _ _ _ _ _ _ _
}


UpperOne = \relative c'' {
  \clef treble
  \key c \major
  \numericTimeSignature
  \stemUp
  \time 4/4
  \repeat unfold 4 { 4  2 }
  c4 b8 a b2 a1
  a8 b 4 4 g a1
}

UpperTwo = \relative c' {
  \clef treble
  \key c \major
  \numericTimeSignature
  \stemDown
  \time 4/4
  \repeat unfold 4 { e8 e e e e2 }
  e8 e e4 d2
  c8 d e4 d2
  e8 f e4 d2
  4 d e2
}

LowerOne = \relative c' {
  \clef bass
  \key c \major
  \numericTimeSignature
  \time 4/4
  \stemUp
  a1 a a a
  a1 a a a
}
LowerTwo = {
  \clef bass
  \key c \major
  \numericTimeSignature
  \stemDown
  \time 4/4
}


\score {
  <<
%\new ChordNames {
%  \set chordChanges = ##t
%  \harmony
%}
\new Staff
\new Voice = "mel" \Melody
\new Lyrics \lyricsto mel \Words
\new PianoStaff <<
  \new Staff = "Upper"  <<
\new Voice = "UpperOne" \UpperOne
\new Voice = "UpperTwo" \UpperTwo
  >>
  \new Staff = "Lower" <<
\new Voice = "LowerOne" \LowerOne
\new Voice = "LowerTwo" \LowerTwo
  >>
>>
  >>
  \layout {
ragged-last = ##f
ragged-right = ##f
\context {
  \Score
  \consists "Bar_number_engraver"
  barNumberVisibility = #(every-nth-bar-number-visible 1)
  \override BarNumber.break-visibility = #end-of-line-invisible
}
\context {
  \Lyrics
  \override LyricSpace.minimum-distance = #0.8
  \override LyricText.font-size = #+1.2
  \override VerticalAxisGroup.minimum-Y-extent = #'(-1 . 1)
  \override VerticalAxisGroup.
  nonstaff-relatedstaff-spacing.padding = #1.5
  \override VerticalAxisGroup.
  nonstaff-unrelatedstaff-spacing.padding = #1.5
}
  }
}

__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Help with Measure Numbers

2024-01-07 Thread Karen Billings
Hi all - I'm currently using Lilypond 2.22.1 to set some handbell music, and 
I'm encountering a problem with measure numbering.
I need all measures numbered in this score - for some reason, the first measure 
number in each line is being printed twice:


Working file is attached.
Thanks much!
Karen
% Version 1.0
% Last edit:  January 7, 2024
%
% The source code is covered by the Creative
% Commons Attribution-NonCommercial license,
% http://creativecommons.org/licenses/by-nc/2.5/
% Attribution:  Karen S. Billings CAGO
%


\version "2.22.1"
\include "english.ly"
ignore = \override NoteColumn.ignore-collision = ##t
\layout { indent = 0.0\cm }

\paper {
  #(define top-margin (* 0.5 in))
  #(define line-width (* 6.5 in))
  #(define bottom-margin (* 1.0 in))
  top-system-spacing.basic-distance = #10
  score-system-spacing.basic-distance = #10
  system-system-spacing.basic-distance = #17
  last-bottom-spacing.basic-distance = #10
  score-markup-spacing.basic-distance = #15
  ragged-bottom = ##t
}

% #(set-global-staff-size 24)

harmony = \chordmode {
  % Insert chords if needed
}
Melody = \relative c'' {
  \clef treble
  \key c \major
  \autoBeamOn
  \numericTimeSignature
  \time 4/4
  R1*4
  \bar "||" \break
  a4 a c c e, a a2
  c,4 e d c8 b a2 a2
  \bar "|."
}

Words = \lyricmode {
  _ _ _ _ _ _ _
}


UpperOne = \relative c'' {
  \clef treble
  \key c \major
  \numericTimeSignature
  \stemUp
  \time 4/4
  \repeat unfold 4 { 4  2 }
  c4 b8 a b2 a1
  a8 b 4 4 g a1
}

UpperTwo = \relative c' {
  \clef treble
  \key c \major
  \numericTimeSignature
  \stemDown
  \time 4/4
  \repeat unfold 4 { e8 e e e e2 }
  e8 e e4 d2
  c8 d e4 d2
  e8 f e4 d2
  4 d e2
}

LowerOne = \relative c' {
  \clef bass
  \key c \major
  \numericTimeSignature
  \time 4/4
  \stemUp
  a1 a a a
  a1 a a a
}
LowerTwo = {
  \clef bass
  \key c \major
  \numericTimeSignature
  \stemDown
  \time 4/4
}


\score {
\context PianoStaff \with {
\consists "Bar_number_engraver"
barNumberVisibility = #(every-nth-bar-number-visible 1)
\override BarNumber.break-visibility = #end-of-line-invisible
  }
  <<
%\new ChordNames {
%  \set chordChanges = ##t
%  \harmony
%}
\new Staff
\new Voice = "mel" \Melody
\new Lyrics \lyricsto mel \Words
\new PianoStaff <<
  \new Staff = "Upper"  <<
\new Voice = "UpperOne" \UpperOne
\new Voice = "UpperTwo" \UpperTwo
  >>
  \new Staff = "Lower" <<
\new Voice = "LowerOne" \LowerOne
\new Voice = "LowerTwo" \LowerTwo
  >>
>>
  >>
  \layout {
ragged-last = ##f
ragged-right = ##f
\context {
  \Lyrics
  \override LyricSpace #'minimum-distance = #0.8
  \override LyricText #'font-size = #+1.2
  \override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 1)
  \override VerticalAxisGroup.
  nonstaff-relatedstaff-spacing.padding = #1.5
  \override VerticalAxisGroup.
  nonstaff-unrelatedstaff-spacing.padding = #1.5
}
  }
}





Re: Help using a Scheme variable in a function

2024-01-06 Thread Matthew Fong
Ah ha! Thank you, David!

\override #`(line-width . ,rubricsWidthSU) does indeed work. I have to be
mindful of the environment I'm using the variable in.


Many thanks,
mattfong

On Sat, Jan 6, 2024 at 3:43 PM David Kastrup  wrote:

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

> 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: Help using a Scheme variable in a function

2024-01-06 Thread Matthew Fong
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)


Many thanks,
mattfong

On Sat, Jan 6, 2024 at 3:21 PM Matthew Fong  wrote:

> Hello everyone,
>
> I'm feeling somewhat confounded by LilyPond Scheme variables.
>
> I've created some global variables that I want to use in functions so I
> change up some custom spacing only one (as these may vary with staff size)
>
> I defined the following
> #(define kOneStaffUnitInInches 0.0761)
> #(define kContentWidthInches 6.5)
>
> #(define halfInchSU (/ 0.5 kOneStaffUnitInInches))
> #(define contentWidthSU (/ kContentWidthInches kOneStaffUnitInInches))
> #(define rubricsWidthSU (/ (- kContentWidthInches 0.5)
> kOneStaffUnitInInches))
>
> And wrote this function:
> rubricsTest =
> #(define-scheme-function
> (text)
> (markup-list?)
> #{ \markup
> \line {
> \hspace #halfInchSU
> \override #'(line-width . 78.84)
> \wordwrap #text
> }
> #}
> )
>
> \rubricsTest \markuplist { Although it is provided with its own Preface,
> this Eucharistic Prayer may also be used with other Prefaces, especially
> those that present an overall view of the mystery of salvation, such as the
> Common Prefaces. }
>
> -
>
> I can get \hspace to happily use the variable halfInchSU. However, I
> cannot seem to use the variable rubricsWidthSU with \override
> #'(line-width . 78.84).
>
> I must be missing something very simple?
>
>
> Many thanks,
> mattfong
>
>
>
>


Help using a Scheme variable in a function

2024-01-06 Thread Matthew Fong
Hello everyone,

I'm feeling somewhat confounded by LilyPond Scheme variables.

I've created some global variables that I want to use in functions so I
change up some custom spacing only one (as these may vary with staff size)

I defined the following
#(define kOneStaffUnitInInches 0.0761)
#(define kContentWidthInches 6.5)

#(define halfInchSU (/ 0.5 kOneStaffUnitInInches))
#(define contentWidthSU (/ kContentWidthInches kOneStaffUnitInInches))
#(define rubricsWidthSU (/ (- kContentWidthInches 0.5)
kOneStaffUnitInInches))

And wrote this function:
rubricsTest =
#(define-scheme-function
(text)
(markup-list?)
#{ \markup
\line {
\hspace #halfInchSU
\override #'(line-width . 78.84)
\wordwrap #text
}
#}
)

\rubricsTest \markuplist { Although it is provided with its own Preface,
this Eucharistic Prayer may also be used with other Prefaces, especially
those that present an overall view of the mystery of salvation, such as the
Common Prefaces. }

-

I can get \hspace to happily use the variable halfInchSU. However, I cannot
seem to use the variable rubricsWidthSU with \override #'(line-width .
78.84).

I must be missing something very simple?


Many thanks,
mattfong


Re: Help with music function

2023-12-18 Thread Mark Probert


Many thanks, Aaron. A clear and helpful answer!

The “why” was simply an exercise in seeing if I could cleanup a LP file by 
using such syntactic sugar (to which the answer is no :-) ).

Thanks again
 ..m.



> On 19 Dec 2023, at 07:05, Aaron Hill  wrote:
> 
> On 2023-12-17 9:33 pm, Mark Probert wrote:
>> Hi.
>> I'm struggling some with writing a music function for rests.  Basically I
>> want to be able to write something like
>> \rel-rest( b', 1)
> 
> Minor nit: Functions in LilyPond do not use parentheses and commas for 
> arguments in this way.  You need only say something like the following to 
> invoke your function:
> 
> 
> \rel-rest b' 1
> 
> 
>> which would place a dotted quarter rest on the indicated pitch (the
>> equivalent of
>>  b'1\rest
>> I'm starting with
>> rel-rest =
>> #(define-music-function (pit dur) (ly:pitch? ly:duration?)
>>  #{
>>#pit#dur\rest
>>  #})
>> but that gives me an error.
>> Any suggestions?
> 
> There are a few things the errors in the output log should be communicating.
> 
>> Unbound variable: #{pit\#dur\\rest}#
> 
> Firstly, whitespace is important in Scheme.  Jamming together #pit#dur\rest 
> gives the parser little hope to understand what you mean.  It thinks this 
> refers to a singular named thing, which in this context does not exist.
> 
> So, give each part of that expression some room to breathe:
> 
> 
> #pit #dur \rest
> 
> 
> But then LilyPond is not satisfied that this represents a valid music 
> expression.  When using variables, often the number sign (#) is correct, 
> however there are some spots when you need to use the dollar sign ($) instead.
> 
> 
> $pit $dur \rest
> 
> 
> Lastly, I am not sure why using the duration "1" as you indicated would 
> result in a dotted quarter rest.  Did you mean "4." or is the point of the 
> music function to manipulate the inputs in some way?  I am not sure I see the 
> connection/logic there, so you are going to be a bit on your own there.
> 
> But with the modification indicated above, you can now do this:
> 
> 
> { \rel-rest b' 4. }
> 
> %% ...or even...
> 
> { \rel-rest b'4. }
> 
> 
> However, this feels like more typing than just using the \rest post-event, 
> apart from being prefixed.
> 
> 
> -- Aaron Hill





Re: Help with music function

2023-12-18 Thread William Rehwinkel via LilyPond user discussion

Dear Mark,

I did this in a slightly different way...if you do

\displayMusic c4\rest

you can see how to represent a rest using the make-music procedure in 
scheme code. Modifying that a bit, I got


% 
\version "2.25.6"

%\displayMusic c4\rest =
%(make-music
  %'RestEvent
  %'duration
  %(ly:make-duration 2)
  %'pitch
  %(ly:make-pitch -1 0))

restt = #(define-music-function (pit dur) (ly:pitch? ly:duration?)
(make-music
'RestEvent
'duration
dur
'pitch
pit)
)

\relative c' {
  \restt c 4
  \restt e 4
  \restt g 4
  \restt c 4
  \restt b 2
  \restt a 2
  \restt g 2.
  \restt g 4
}
% 

-William


On 12/18/23 00:33, Mark Probert wrote:

Hi.

I'm struggling some with writing a music function for rests.  Basically 
I want to be able to write something like


  \rel-rest( b', 1)

which would place a dotted quarter rest on the indicated pitch (the 
equivalent of


   b'1\rest

I'm starting with

rel-rest =
#(define-music-function (pit dur) (ly:pitch? ly:duration?)
   #{
     #pit#dur\rest
   #})

but that gives me an error.

Any suggestions?

--

--
-mark.


--
William Rehwinkel - Oberlin College and Conservatory '24

will...@williamrehwinkel.net

PGP key: https://ftp.williamrehwinkel.net/pubkey.txt


OpenPGP_signature.asc
Description: OpenPGP digital signature


Re: Help with music function

2023-12-18 Thread Aaron Hill via LilyPond user discussion

On 2023-12-17 9:33 pm, Mark Probert wrote:

Hi.

I'm struggling some with writing a music function for rests.  Basically 
I

want to be able to write something like

 \rel-rest( b', 1)


Minor nit: Functions in LilyPond do not use parentheses and commas for 
arguments in this way.  You need only say something like the following 
to invoke your function:



 \rel-rest b' 1



which would place a dotted quarter rest on the indicated pitch (the
equivalent of

  b'1\rest

I'm starting with

rel-rest =
#(define-music-function (pit dur) (ly:pitch? ly:duration?)
  #{
#pit#dur\rest
  #})

but that gives me an error.

Any suggestions?


There are a few things the errors in the output log should be 
communicating.



Unbound variable: #{pit\#dur\\rest}#


Firstly, whitespace is important in Scheme.  Jamming together 
#pit#dur\rest gives the parser little hope to understand what you mean.  
It thinks this refers to a singular named thing, which in this context 
does not exist.


So, give each part of that expression some room to breathe:


 #pit #dur \rest


But then LilyPond is not satisfied that this represents a valid music 
expression.  When using variables, often the number sign (#) is correct, 
however there are some spots when you need to use the dollar sign ($) 
instead.



 $pit $dur \rest


Lastly, I am not sure why using the duration "1" as you indicated would 
result in a dotted quarter rest.  Did you mean "4." or is the point of 
the music function to manipulate the inputs in some way?  I am not sure 
I see the connection/logic there, so you are going to be a bit on your 
own there.


But with the modification indicated above, you can now do this:


{ \rel-rest b' 4. }

%% ...or even...

{ \rel-rest b'4. }


However, this feels like more typing than just using the \rest 
post-event, apart from being prefixed.



-- Aaron Hill



Help with music function

2023-12-17 Thread Mark Probert
Hi.

I'm struggling some with writing a music function for rests.  Basically I
want to be able to write something like

 \rel-rest( b', 1)

which would place a dotted quarter rest on the indicated pitch (the
equivalent of

  b'1\rest

I'm starting with

rel-rest =
#(define-music-function (pit dur) (ly:pitch? ly:duration?)
  #{
#pit#dur\rest
  #})

but that gives me an error.

Any suggestions?

-- 

-- 
-mark.


Re: Help Needed to make chord chart over two pages

2023-08-27 Thread Michael Werner
On Sat, Aug 26, 2023 at 8:45 AM JacquelineUkulele-Guitar Grant <
jackiemusicgr...@hotmail.com> wrote:

> Hi All
>

Hi Jacqueline,


> I am new to this Lilipond user help group, I aplopgize if I am breaking
> any rules are guideline.
>
> I have been use Lilypond for a few year, even though I do not fully
> understand it.
>
> I am trying to make a Chord Chart that goes over two pages, in what I call
> a "ukulele layout".  A "ukulele layout" being where the chords are in
> line with the lyrics.
> I also, in the long run, I am looking to do a other layout of the same
> song but in what I call  a "guitar layout". A "guitar layout" being where
> the chords are above the lyrics.
> For both of the layouts I want the option of going over two page, should I
> need to.
>
> Here is the code for the "ukulele layout", which fills up one page., but
> if I try and add another verse (just as a test) it goes funny!
> Thanks
>

First of all, I'm certainly no expert. So there may well be better ways to
do these things. But, here goes.  First off:

 \version "2.18.2"  % necessary for upgrading to future LilyPond versions.
>

This version is *really* old. I would strongly recommend upgrading to the
latest version, which at this moment is 2.24.2 for the stable branch.


>  \header{
>
>   title = "ODE TO BILLIE JOE - KEY // - VERSION 2"
>
>   subtitle = "For melody"
>
> arranger = "HELP NEEDED TO DO A TWO PAGE CHORD CHART"
>
> copyright = "HELP NEEDED TO DO A TWO PAGE CHORD CHART"
>
> tagline = "HELP NEEDED TO DO A TWO PAGE CHORD CHART"
>
>
>
> }
>
>
>
> \layout {
>
>  indent = 0.0
>
>  }
>
>
>
> melody = \relative c' { \key a \major
>
> |  \partial 4.  e'8  e8[  e8]  | e4  e8 e8  r8 e8  e8[ e8]  | e8[ e8]  a8
> a8  e8 e4 e8 ~ | e1  |
>
> }
>
> text = \lyricmode {
>
> \set stanza = #" " It was the third of June a -- no -- ther sleep -- y,
> dust -- y, Del -- ta Day.
>
> }
>

If you aren't going to be using stanza numbers you actually don't need to
use \set stanza - it defaults to not putting a stanza number. So the above
line can become:

text = \lyricmode {
  It was the third of June a -- no -- ther sleep -- y, dust -- y, Del -- ta
Day.
}


>  \score{ <<
>
> \new Voice = "one" { \melody }
>
> \new Lyrics \lyricsto "one" \text
>
> >>
>
> \layout { }
>
> }
>
>
>
> \markup { \column {
>

And the line right above here is the problem. The \markup command creates a
single markup block, which isn't readily breakable by Lilypond's page
breaking system. What's needed here is instead the \markuplist command.
This creates a series of single lines that are easily and smoothly
breakable as needed. One possible caveat is that a verse could wind up
split by a page break. If you want to keep each verse as an intact block
then each verse can be wrapped in a \column block.


>  % Verse One
>
> \line   \fontsize #-0.8 { Verse 1}
>
>
>
> \line   \fontsize #-0.8 { It was the \bold [D7]  third of \bold [D7/A]
> June another \bold [Am7] sleepy, dusty, Delta \bold [D7] day. \bold [D7/A]
> \bold [D7]  \bold [D7/A]}
>
>
>
> \line   \fontsize #-0.8 { I was  \bold [D7] out chopping cotton, and my
> \bold [Am7] brot-her was bailing \bold [D7] hay. \bold [D7/A] \bold [D7]
> \bold [D7/A]  }
>
>
>
> \line   \fontsize #-0.8 { And at  \bold [G7] din-ner time we stopped and
> walked \bold [G7] back to the house to \bold [G7] eat. }
>
>
>
> \line  \fontsize #-0.5 {And momma  \bold [D7] holler-ed out the back door
> 'y'all re- \bold [D7] -mem-ber to wipe your \bold [D7] feet'. }
>
>
>
> \line  { And then she  \bold [G7] said I got some news this \bold [G7]
> morn-in' from Choctaw \bold [G7] Ridge.  }
>
> \line  \fontsize #-0.5 { Today  \bold [D7] Bill-ie Joe McAllister jumped
> \bold [C7] off the Tallahatchie \bold [D7] Bridge.  \bold [D7/A] \bold
> [D7] \bold [D7/A]  }
>

With all the \fontsize commands here, I would suggest just putting a single
one at the top so as to affect all the text at once. That would help keep
things more uniform in appearance.


>  %to make a line look blank, for vertical space between lines
>
> \line   \fontsize #-40 {. }
>

A better way to do this is use the \vspace command. It's specifically made
to handle this. I tend to use a single variable with this - that way I can
adjust all the spacing at once and keep it uniform.

I've snipped the rest as it's basically just repeating all this so far. The
code for the verses would then be:

\score {
  <<
\new Voice = "one" { \melody }
\new Lyrics \lyri

Re: Help Needed to make chord chart over two pages

2023-08-26 Thread Stu McKenzie


On 2023-08-26 05:17, JacquelineUkulele-Guitar Grant wrote:

Hi All

I am new to this Lilipond user help group, I aplopgize if I am 
breaking any rules are guideline.


I have been use Lilypond for a few year, even though I do not fully 
understand it.


I am trying to make a Chord Chart that goes over two pages, in what I 
call a "ukulele layout".  A "ukulele layout" being where the chords 
are in line with the lyrics.
I also, in the long run, I am looking to do a other layout of the same 
song but in what I call  a "guitar layout". A "guitar layout" being 
where the chords are above the lyrics.
For both of the layouts I want the option of going over two page, 
should I need to.


Here is the code for the "ukulele layout", which fills up one page., 
but if I try and add another verse (just as a test) it goes funny!

Thanks


\version "2.18.2"% necessary for upgrading to future LilyPond versions.

\header{

title = "ODE TO BILLIE JOE - KEY // - VERSION 2"

subtitle = "For melody"

arranger = "HELP NEEDED TO DO A TWO PAGE CHORD CHART"

copyright = "HELP NEEDED TO DO A TWO PAGE CHORD CHART"

tagline = "HELP NEEDED TO DO A TWO PAGE CHORD CHART"

}

\layout {

indent = 0.0

}

melody = \relative c' { \key a \major

|\partial 4.e'8e8[e8]| e4e8 e8r8 e8e8[ e8]| e8[ e8]a8 a8e8 e4 e8 ~ | e1|

}

text = \lyricmode {

\set stanza = #" " It was the third of June a -- no -- ther sleep -- 
y, dust -- y, Del -- ta Day.


}

\score{ <<

\new Voice = "one" { \melody }

\new Lyrics \lyricsto "one" \text

>>

\layout { }

}

\markup { \column {

\line { \transparent {Verse 2. }}

% Verse One

\line\fontsize #-0.8 { Verse 1}

\line\fontsize #-0.8 { It was the \bold [D7]third of \bold [D7/A] June 
another \bold [Am7] sleepy, dusty, Delta \bold [D7] day. \bold 
[D7/A]\bold [D7]\bold [D7/A]}


\line\fontsize #-0.8 { I was\bold [D7] out chopping cotton, and my 
\bold [Am7] brot-her was bailing \bold [D7] hay. \bold [D7/A] \bold 
[D7] \bold [D7/A]}


\line\fontsize #-0.8 { And at\bold [G7] din-ner time we stopped and 
walked \bold [G7] back to the house to \bold [G7] eat. }


\line\fontsize #-0.5 {And momma\bold [D7] holler-ed out the back door 
'y'all re- \bold [D7] -mem-ber to wipe your \bold [D7] feet'. }


\line{ And then she\bold [G7] said I got some news this \bold [G7] 
morn-in' from Choctaw \bold [G7] Ridge.}


\line\fontsize #-0.5 { Today\bold [D7] Bill-ie Joe McAllister jumped 
\bold [C7] off the Tallahatchie \bold [D7] Bridge.\bold [D7/A] \bold 
[D7] \bold [D7/A]}


%to make a line look blank, for vertical space between lines

\line\fontsize #-40 {. }

% verse Two

\line\fontsize #-0.8 { Verse 2}

\line\fontsize #-0.8 { And\bold [D7] pop-pa said to \bold [D7/A] momma 
as he \bold [Am7] passed around the black-eyedpeas. \bold [D7/A] \bold 
[D7] \bold [D7/A] }


\line\fontsize #-0.8 { Well Billie \bold [D7] Joe never had a lick of 
\bold [Am7] sense, pass the biscuits\bold [D7] please. \bold [D7/A] 
\bold [D7] \bold [D7/A] }


\line\fontsize #-0.8 { There's \bold [G7] five more acres in the \bold 
[G7] low-er forty I got to \bold [G7] plow. }


\line\fontsize #-0.5 { And momma \bold [D7] said it was a shame a- 
\bold [D7] -bout Billie Joe any \bold [D7] -how.}


\line{ \bold [G7] noth-ing ever comes to no \bold [G7] good up on 
Choctaw \bold [G7] Ridge. }


\line\fontsize #-0.5 { And \bold [D7] Bill-ie Joe McAllister 
jumped\bold [C7] off the Tallahatchie \bold [D7] Bridge.\bold [D7/A] 
\bold [D7] \bold [D7/A] }


%to make a line look blank, for vertical space between lines

\line\fontsize #-40 {. }

\line\fontsize #-0.8 { Verse 3}

\line\fontsize #-0.8 {\bold [D7] Brother said \bold [D7/A] he recalled 
when \bold [Am7] he and Tom and Billie Joe. \bold [D7/A] \bold [D7] 
\bold [D7/A] }


\line\fontsize #-0.6 { And put a frog \bold [D7] frog down my back at 
the \bold [Am7] Car-roll County Picture \bold [D7] Show. \bold [D7/A] 
\bold [D7] \bold [D7/A]}


\line\fontsize #-0.6 { And wasn't\bold [G7] I talkin' to him after 
\bold [G7] church last Sunday \bold [G7] night. }


\line\fontsize #-0.6 {I'll have a- \bold [D7] -no-ther piece of pie 
\bold [D7] _ _ you know it don't seem \bold [D7] right.}


\line\fontsize #-0.6 { I \bold [G7] saw him at the sawmill yester- 
\bold [G7] -day up on Choctaw \bold [G7] Ridge.}


\line\fontsize #-0.5 { An' now you \bold [D7] tell me Bill-ie Joe 
jumped\bold [C7] off the Tallahatchie \bold [D7] Bridge.\bold [D7/A] 
\bold [D7] \bold [D7/A] }


%to make a line look blank, for vertical space between lines

\line\fontsize #-40 {. }

%Verse 4

\line\fontsize #-0.8 { Verse 4}

\line\fontsize #-0.8 {\bold [D7] Mom-ma said to \bold [D7/A] me 'Child 
what's \bold [Am7] happened to your appetite? \bold [D7/A] \bold [D7] 
\bold [D7/A]}


\line\fontsize #-0.6 { Why I've been\bold [D7] cook-in' all morning, 
and you \bold [Am7] haven't touched a 

Help Needed to make chord chart over two pages

2023-08-26 Thread JacquelineUkulele-Guitar Grant
Hi All

I am new to this Lilipond user help group, I aplopgize if I am breaking any 
rules are guideline.

I have been use Lilypond for a few year, even though I do not fully understand 
it.

I am trying to make a Chord Chart that goes over two pages, in what I call a 
"ukulele layout".  A "ukulele layout" being where the chords are in line with 
the lyrics.
I also, in the long run, I am looking to do a other layout of the same song but 
in what I call  a "guitar layout". A "guitar layout" being where the chords are 
above the lyrics.
For both of the layouts I want the option of going over two page, should I need 
to.

Here is the code for the "ukulele layout", which fills up one page., but if I 
try and add another verse (just as a test) it goes funny!
Thanks



\version "2.18.2"  % necessary for upgrading to future LilyPond versions.


\header{

  title = "ODE TO BILLIE JOE - KEY // - VERSION 2"

  subtitle = "For melody"

arranger = "HELP NEEDED TO DO A TWO PAGE CHORD CHART"

copyright = "HELP NEEDED TO DO A TWO PAGE CHORD CHART"

tagline = "HELP NEEDED TO DO A TWO PAGE CHORD CHART"


}


\layout {

 indent = 0.0

 }


melody = \relative c' { \key a \major

|  \partial 4.  e'8  e8[  e8]  | e4  e8 e8  r8 e8  e8[ e8]  | e8[ e8]  a8 a8  
e8 e4 e8 ~ | e1  |

}

text = \lyricmode {

\set stanza = #" " It was the third of June a -- no -- ther sleep -- y, dust -- 
y, Del -- ta Day.

}


\score{ <<

\new Voice = "one" { \melody }

\new Lyrics \lyricsto "one" \text

>>

\layout { }

}


\markup { \column {

\line { \transparent {Verse 2. }}


% Verse One

\line   \fontsize #-0.8 { Verse 1}


\line   \fontsize #-0.8 { It was the \bold [D7]  third of \bold [D7/A] June 
another \bold [Am7] sleepy, dusty, Delta \bold [D7] day. \bold [D7/A]  \bold 
[D7]  \bold [D7/A]}


\line   \fontsize #-0.8 { I was  \bold [D7] out chopping cotton, and my \bold 
[Am7] brot-her was bailing \bold [D7] hay. \bold [D7/A] \bold [D7] \bold [D7/A] 
 }


\line   \fontsize #-0.8 { And at  \bold [G7] din-ner time we stopped and walked 
\bold [G7] back to the house to \bold [G7] eat. }


\line  \fontsize #-0.5 {And momma  \bold [D7] holler-ed out the back door 
'y'all re- \bold [D7] -mem-ber to wipe your \bold [D7] feet'. }


\line  { And then she  \bold [G7] said I got some news this \bold [G7] morn-in' 
from Choctaw \bold [G7] Ridge.  }

\line  \fontsize #-0.5 { Today  \bold [D7] Bill-ie Joe McAllister jumped \bold 
[C7] off the Tallahatchie \bold [D7] Bridge.  \bold [D7/A] \bold [D7] \bold 
[D7/A]  }


%to make a line look blank, for vertical space between lines

\line   \fontsize #-40 {. }


% verse Two

\line   \fontsize #-0.8 { Verse 2}


\line   \fontsize #-0.8 { And  \bold [D7] pop-pa said to \bold [D7/A] momma as 
he \bold [Am7] passed around the black-eyed  peas. \bold [D7/A] \bold [D7] 
\bold [D7/A] }


\line   \fontsize #-0.8 { Well Billie \bold [D7] Joe never had a lick of \bold 
[Am7] sense, pass the biscuits  \bold [D7] please. \bold [D7/A] \bold [D7] 
\bold [D7/A] }


\line   \fontsize #-0.8 { There's \bold [G7] five more acres in the \bold [G7] 
low-er forty I got to \bold [G7] plow. }


\line  \fontsize #-0.5 { And momma \bold [D7] said it was a shame a- \bold [D7] 
-bout Billie Joe any \bold [D7] -how.}


\line  { \bold [G7] noth-ing ever comes to no \bold [G7] good up on Choctaw 
\bold [G7] Ridge. }


\line  \fontsize #-0.5 { And \bold [D7] Bill-ie Joe McAllister jumped  \bold 
[C7] off the Tallahatchie \bold [D7] Bridge.  \bold [D7/A] \bold [D7] \bold 
[D7/A] }



%to make a line look blank, for vertical space between lines

\line   \fontsize #-40 {. }


\line   \fontsize #-0.8 { Verse 3}

\line   \fontsize #-0.8 {  \bold [D7] Brother said \bold [D7/A] he recalled 
when \bold [Am7] he and Tom and Billie Joe. \bold [D7/A] \bold [D7] \bold 
[D7/A] }


\line   \fontsize #-0.6 { And put a frog \bold [D7] frog down my back at the 
\bold [Am7] Car-roll County Picture \bold [D7] Show. \bold [D7/A] \bold [D7] 
\bold [D7/A]  }


\line   \fontsize #-0.6 { And wasn't  \bold [G7] I talkin' to him after \bold 
[G7] church last Sunday \bold [G7] night. }


\line  \fontsize #-0.6 {  I'll have a- \bold [D7] -no-ther piece of pie \bold 
[D7] _ _ you know it don't seem \bold [D7] right.  }


\line   \fontsize #-0.6 { I \bold [G7] saw him at the sawmill yester- \bold 
[G7] -day up on Choctaw \bold [G7] Ridge.  }


\line  \fontsize #-0.5 { An' now you \bold [D7] tell me Bill-ie Joe jumped  
\bold [C7] off the Tallahatchie \bold [D7] Bridge.  \bold [D7/A] \bold [D7] 
\bold [D7/A] }



%to make a line look blank, for vertical space between lines

\line   \fontsize #-40 {. }


%Verse 4

\line   \fontsize #-0.8 { Verse 4}

\line   \fontsize #-0.8 {  \bold [D7] Mom-ma said to \bold [D7/A] me 'Child 
what's \bold [Am7] happened to your appetite? \bold [D7/A] \bold [D7] \bold 
[D7/A]  }


\li

Re: Need help displaying note names in 2.22

2023-08-08 Thread Viktor Mastoridis
Dear all,

Thank you very much for the time taken to comment on my problem.

I tried all the suggestions one by one - the best solution was to upgrade
to Lilypond 2.24 (much easier than I thought) and to use Jean's code below:

\version "2.24.1"

\layout {
  \context {
\NoteNames
noteNameFunction =
  #(lambda args
 #{ \markup \with-string-transformer #(lambda (layout props str)
(string-upcase str))
#(apply note-name-markup args) #})
  }
}

music = \relative c { c, cis d es }

\score {
 <<
\new TabStaff \with {
  stringTunings = #bass-tuning
}
{ \music  }
\new NoteNames { \music }
  >>
  \layout { }
  \midi { }
}

---
Viktor Mastoridis





On Mon, 7 Aug 2023 at 19:04, Jean Abou Samra  wrote:

> Le lundi 07 août 2023 à 19:00 +0100, Viktor Mastoridis a écrit :
>
> How do I upgrade to Lilypond 2.24 on Mint 21 (Ubuntu LTS 22.4) without
> braking the system?
>
>
>
>
> Just follow the tutorial, it will not interfere with the system in any way.
>
>
> https://lilypond.org/doc/v2.24/Documentation/learning/graphical-setup-under-gnu_002flinux.html
>
>
> (You presumably already have Frescobaldi, so you don't need that part,
> only the part where it explains how to add a new LilyPond version to
> Frescobaldi.)
>


Re: Need help displaying note names in 2.22

2023-08-07 Thread Jean Abou Samra
Le lundi 07 août 2023 à 19:00 +0100, Viktor Mastoridis a écrit :
> How do I upgrade to Lilypond 2.24 on Mint 21 (Ubuntu LTS 22.4) without braking
> the system?



Just follow the tutorial, it will not interfere with the system in any way.

https://lilypond.org/doc/v2.24/Documentation/learning/graphical-setup-under-gnu_002flinux.html


(You presumably already have Frescobaldi, so you don't need that part, only the
part where it explains how to add a new LilyPond version to Frescobaldi.)


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


Re: Need help displaying note names in 2.22

2023-08-07 Thread Viktor Mastoridis
On Sunday, 6 August 2023, Jean Abou Samra  wrote:

> Oops, except that this is not going to work in 2.22, since
> \with-string-transformer is new in 2.24.
>
> However, 2.22 is not supported anymore, I would recommend upgrading to
> 2.24 anyway.
>

How do I upgrade to Lilypond 2.24 on Mint 21 (Ubuntu LTS 22.4) without
braking the system?

Viktor


-- 
Viktor Mastoridis


Re: Need help displaying note names in 2.22

2023-08-06 Thread Silvain Dupertuis

Le 06.08.23 à 16:59, David Kastrup a écrit :

Strange...
I tried a few things, but did not find a way to make it work.

I noticed  2 things :

1. In this association table :
chimenames =
#`(
     ("c" . "C")
     ("cis" . "C♯")
     ("d" . "D")
     ("es" . "E♭")
)
It only takes into account notes of names with one single character as
the default-name, but it does print the new-note if it has more
characters. I do not understand why...

Note names have changed to use ♯ and ♭ characters, so you need to look
up "c♯" instead of "cis".


I do not understand...

"c♯"
- is not recognized in the music description only "cis" works
- it is not recognized either in the table as (markup->string (ly:grob-property 
grob 'text))
in the associative table either,

--
Silvain Dupertuis
Route de Lausanne 335
1293 Bellevue (Switzerland)
tél. +41-(0)22-774.20.67
portable +41-(0)79-604.87.52
web: silvain-dupertuis.org 

Re: Need help displaying note names in 2.22

2023-08-06 Thread Jean Abou Samra
Oops, except that this is not going to work in 2.22, since \with-string-
transformer is new in 2.24.

However, 2.22 is not supported anymore, I would recommend upgrading to 2.24
anyway.


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


Re: Need help displaying note names in 2.22

2023-08-06 Thread Jean Abou Samra
Le dimanche 06 août 2023 à 18:36 +0200, Robin Bannister a écrit :

> David Kastrup wrote:
> 
> 
> > Note names have changed to use ♯ and ♭ characters, so you need to look
> > up "c♯" instead of "cis".
> 
> 
> I got no hits that way.


That's because the sharp sign is printed with \markup \accidental in the text 
property, i.e., (ly:grob-property grob 'text), but \accidental does not yet 
have a markup->string handler giving Unicode accidental characters.

Michael's solution works, but it will nullify the effect of certain 
NoteNames-specific properties like printOctaveNames.

I think the best solution here is

```
\version "2.24.1"

\layout {
  \context {
\NoteNames
noteNameFunction =
  #(lambda args
 #{ \markup \with-string-transformer #(lambda (layout props str) 
(string-upcase str))
#(apply note-name-markup args) #})
  }
}

music = \relative c { c, cis d es }

\score {
 <<
\new TabStaff \with {
  stringTunings = #bass-tuning
}  
{ \music  }
\new NoteNames { \music }
  >>
  \layout { }
  \midi { }
}
```

Best

Jean


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


Re: Need help displaying note names in 2.22

2023-08-06 Thread Robin Bannister

David Kastrup wrote:


Note names have changed to use ♯ and ♭ characters, so you need to look
up "c♯" instead of "cis".


I got no hits that way.

An alternative is to add
   printAccidentalNames = #'lily
to the NoteNames \with.



And if I change the "es" lookup key to the more canonical "ees" it finds 
the corresponding markup instead of returning the errored #f.




Cheers,
Robin



Re: Need help displaying note names in 2.22

2023-08-06 Thread Michael Werner
Hi Victor,

On Sat, Aug 5, 2023 at 7:12 PM Viktor Mastoridis <
viktor.mastori...@gmail.com> wrote:

> Hello,
>
> I have been using the syntax below for several years; the last code update
> I did was in December 2022, and it worked well since.
> Today I noticed that I can't get the sharp/flat note names properly.
> C# & Eb are not displayed.
> Can you please help?
> ---
>
>
> \version "2.22.1"
> chimenames =
> #`(
> ("c" . "C")
> ("cis" . "C♯")
>("d" . "D")
>   ("es" . "E♭")
>)
>
> ChimeNoteNames =
> #(lambda (grob)
> (let* ((default-name (markup->string (ly:grob-property grob 'text)))
>(new-name (assoc-get default-name chimenames)))
>   (ly:grob-set-property! grob 'text new-name)
> (ly:text-interface::print grob)))
>

Is the main idea here to just get the note names displayed in uppercase? If
so, I've been doing basically the same thing with this:

\version "2.25.6"

music = \relative c { c, cis d es }

\score
{
  <<
\new TabStaff
\with {
  stringTunings = #bass-tuning
}
{ \music  }

\new NoteNames {
  \set noteNameFunction = #(lambda (pitch ctx)
 (markup #:sans (note-name->markup pitch #f))
 )

  \music
}
  >>
  \layout { }  \midi { }
}

It might not be perfect but it gets the job done. For reference, the
note-name->markup function reference is:

*Function:* *note-name->markup** pitch lowercase?*

Return pitch markup for pitch, including accidentals printed as glyphs. If
lowercase? is set to false, the note names are capitalized.
-- 
Michael


Re: Need help displaying note names in 2.22

2023-08-06 Thread David Kastrup
Silvain Dupertuis  writes:

> Strange...
> I tried a few things, but did not find a way to make it work.
>
> I noticed  2 things :
>
> 1. In this association table :
> chimenames =
> #`(
>     ("c" . "C")
>     ("cis" . "C♯")
>     ("d" . "D")
>     ("es" . "E♭")
> )
> It only takes into account notes of names with one single character as
> the default-name, but it does print the new-note if it has more
> characters. I do not understand why...

Note names have changed to use ♯ and ♭ characters, so you need to look
up "c♯" instead of "cis".

> 2. In my version (2.24), I get a warning of a deprecated syntax for
> the expression
> {\override NoteName #'stencil = #ChimeNoteNames }
> saying it should be written with a dot notation
> {\override NoteName.#'stencil = #ChimeNoteNames }
> and the warning disappear with this notation

Ugh.  Please just write NoteName.stencil here.  This is 2.18+ syntax.

-- 
David Kastrup



Re: Need help displaying note names in 2.22

2023-08-06 Thread Silvain Dupertuis

Strange...
I tried a few things, but did not find a way to make it work.

I noticed  2 things :

1. In this association table :
chimenames =
#`(
    ("c" . "C")
    ("cis" . "C♯")
    ("d" . "D")
    ("es" . "E♭")
)
It only takes into account notes of names with one single character as the default-name, 
but it does print the new-note if it has more characters. I do not understand why...


2. In my version (2.24), I get a warning of a deprecated syntax for the 
expression
{\override NoteName #'stencil = #ChimeNoteNames }
saying it should be written with a dot notation
{\override NoteName.#'stencil = #ChimeNoteNames }
and the warning disappear with this notation


Le 06.08.23 à 01:11, Viktor Mastoridis a écrit :

Hello,

I have been using the syntax below for several years; the last code update I did was in 
December 2022, and it worked well since.

Today I noticed that I can't get the sharp/flat note names properly.
C# & Eb are not displayed.
Can you please help?
---


\version "2.22.1"
chimenames =
#`(
    ("c" . "C")
    ("cis" . "C♯")
   ("d" . "D")
      ("es" . "E♭")
   )

ChimeNoteNames =
#(lambda (grob)
    (let* ((default-name (markup->string (ly:grob-property grob 'text)))
           (new-name (assoc-get default-name chimenames)))
          (ly:grob-set-property! grob 'text new-name)
    (ly:text-interface::print grob)))

music = \relative c { c, cis d es }

\score
{
 <<
    \new TabStaff
    \with {
      stringTunings = #bass-tuning
    }
      { \music  }

    \new NoteNames \with {\override NoteName #'stencil = #ChimeNoteNames }
    { \music }
  >>
  \layout { }  \midi { }
}


---
Viktor Mastoridis





--
Silvain Dupertuis
Route de Lausanne 335
1293 Bellevue (Switzerland)
tél. +41-(0)22-774.20.67
portable +41-(0)79-604.87.52
web: silvain-dupertuis.org <https://perso.silvain-dupertuis.org>

Need help displaying note names in 2.22

2023-08-05 Thread Viktor Mastoridis
Hello,

I have been using the syntax below for several years; the last code update
I did was in December 2022, and it worked well since.
Today I noticed that I can't get the sharp/flat note names properly.
C# & Eb are not displayed.
Can you please help?
---


\version "2.22.1"
chimenames =
#`(
("c" . "C")
("cis" . "C♯")
   ("d" . "D")
  ("es" . "E♭")
   )

ChimeNoteNames =
#(lambda (grob)
(let* ((default-name (markup->string (ly:grob-property grob 'text)))
   (new-name (assoc-get default-name chimenames)))
  (ly:grob-set-property! grob 'text new-name)
(ly:text-interface::print grob)))

music = \relative c { c, cis d es }

\score
{
 <<
\new TabStaff
\with {
  stringTunings = #bass-tuning
}
  { \music  }

\new NoteNames \with {\override NoteName #'stencil = #ChimeNoteNames }
{ \music }
  >>
  \layout { }  \midi { }
}


---
Viktor Mastoridis


  1   2   3   4   5   6   7   8   9   10   >