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: jump to coda inside repeat with alternative

2024-05-23 Thread David Wright
On Tue 21 May 2024 at 11:43:10 (+1000), Laurie Savage wrote:
> On Tue, 21 May 2024 at 10:35, Paul Scott wrote:
> 
> > Segno repeat structure is like a black box to me.  I have been
> > relatively successful with help and trial and error.
> >
> > I would really appreciate some help with this that I need soon:
> >
> >  From NR 2.25.16 1.4.1, Segno repeat structure/alla coda, how do I add a
> > repeat with alternative so the coda jump is just before the alternative?
> >
> > Here is the manually written MWE:
> >
> > \version "2.25.16"
> >
> > \fixed c' {
> >c1 \segnoMark \default
> >\repeat volta 2 { d \codaMark \default }
> >\alternative{ e f }
> >e_"D.C. al Coda" \bar "||"
> ><>^"Coda" e
> >\bar "|."
> > }
> >
> I have struggled with this one in the past and gave up in the end. There
> are some tweaks I found on the archived threads but I found it easier to
> enter the segnoMark and codaMark manually. Ditto for the"D.S. al Coda"
> (which is what I think you mean in your example. I often edit big band and
> small combo charts so any simple solution would be wonderful.

Sometimes the easiest way of using these repeat constructions is to
copy and paste an example from Notation Reference §1.4 into your
.ly file, and then insert your music in place of the example's.

If you have a repeat structure nested in another, you can cut and
paste a second example at the appropriate point, and then replace
the music (or placeholder text) in the example with your music again.

However, the example given above doesn't have nested repeats, but
overlapping ones. LP has a mechanism for distinguishing which repeat
an \alternative belongs to if two repeats are nested (it chooses
the innermost). But there's no LP mechanism AFAIK that can unpick
two overlapping repeat structures, so a manual solution is required,
as given.

Cheers,
David.



Re: How to transpose?

2024-05-23 Thread David Kastrup
Kenneth Flak  writes:

> Great, thanks to both of you! Very clarifying. \transposition is, thus,
> going in the direction of instrument -> playback,

More like display pitch -> concert pitch.

> whereas \transpose goes in the opposite direction, if I understand it
> correctly.

\transpose changes the display pitch.  It does not touch the relation
between display pitch and concert pitch.

So if you want to change the relation between display pitch and
instrument pitch after already having declared a \transposition, you get
into kind of a bind.

-- 
David Kastrup



Re: How to transpose?

2024-05-23 Thread Kenneth Flak
Timothy Lanfear, May 23, 2024 at 13:19:
> If you already have the music written in concert pitch, use the
> transpose
> function to change displayed pitch.
>
> \transpose bes, c { \clef treble \key c\major g' }
>
> If your brass players prefer not to have a key signature, omit the \key
> statement.
>
> On 23/05/2024 11:10, [1]bobr...@centrum.is wrote:
>
> Kenneth,
>
> If you look here:
> [2]https://lilypond.org/doc/v2.24/Documentation/notation/
> displaying-pitches#instrument-transpositions
>
> You will see that '\transposition' tells the MIDI and cue functions
> what's
> going on so that MIDI output and cues in other instruments are correct.
> It
> is still necessary to enter the notes at displayed pitch as shown in the
> example.
>
> -David
>

Great, thanks to both of you! Very clarifying. \transposition is, thus,
going in the direction of instrument -> playback, whereas \transpose
goes in the opposite direction, if I understand it correctly.

Best,
Kenneth




Re: How to transpose?

2024-05-23 Thread Timothy Lanfear
If you already have the music written in concert pitch, use the 
transpose function to change displayed pitch.


\transpose bes, c { \clef treble \key c\major g' }

If your brass players prefer not to have a key signature, omit the \key 
statement.


On 23/05/2024 11:10, bobr...@centrum.is wrote:

Kenneth,

If you look here: 
https://lilypond.org/doc/v2.24/Documentation/notation/displaying-pitches#instrument-transpositions


You will see that  '\transposition' tells the MIDI and cue functions 
what's going on so that MIDI output and cues in other instruments are 
correct.  It is still necessary to enter the notes at displayed pitch 
as shown in the example.


-David



*From: *"Kenneth Flak" 
*To: *"Lillypond Users Mailing List" 
*Sent: *Thursday, May 23, 2024 6:55:45 AM
*Subject: *How to transpose?

Hi,

Trying my hands on transposing from concert pitch to Trumpet in Bf
and french horn in F, but the displayed notes are still in concert
pitch... How do I make these display the notes I would like the
players to see?


    \new Staff = "trumpet" \with {
      instrumentName = "Trp"
    }
    {
      \clef treble
      \key c \major
      \transposition bf
      g'
    }
    \new Staff = "french horn" \with {
      instrumentName = "Horn"
    }{
      \clef treble
      \key c \major
      \transposition f
      cs'
    }

Best,
Kenneth

-- 
Roosna & Flak - Contemporary Dance & Music

Web: roosnaflak.com
Code: {github,gitlab}.com/kflak
Mastodon: @k...@sonomu.club


--
Timothy Lanfear, Bristol, UK.


Re: How to transpose?

2024-05-23 Thread bobr...@centrum.is
Kenneth, 

If you look here: [ 
https://lilypond.org/doc/v2.24/Documentation/notation/displaying-pitches#instrument-transpositions
 | 
https://lilypond.org/doc/v2.24/Documentation/notation/displaying-pitches#instrument-transpositions
 ] 

You will see that '\transposition' tells the MIDI and cue functions what's 
going on so that MIDI output and cues in other instruments are correct. It is 
still necessary to enter the notes at displayed pitch as shown in the example. 

-David 

> From: "Kenneth Flak" 
> To: "Lillypond Users Mailing List" 
> Sent: Thursday, May 23, 2024 6:55:45 AM
> Subject: How to transpose?

> Hi,

> Trying my hands on transposing from concert pitch to Trumpet in Bf and french
> horn in F, but the displayed notes are still in concert pitch... How do I make
> these display the notes I would like the players to see?

> \new Staff = "trumpet" \with {
> instrumentName = "Trp"
> }
> {
> \clef treble
> \key c \major
> \transposition bf
> g'
> }
> \new Staff = "french horn" \with {
> instrumentName = "Horn"
> }{
> \clef treble
> \key c \major
> \transposition f
> cs'
> }

> Best,
> Kenneth

> --
> Roosna & Flak - Contemporary Dance & Music
> Web: roosnaflak.com
> Code: {github,gitlab}.com/kflak
> Mastodon: @k...@sonomu.club


How to transpose?

2024-05-23 Thread Kenneth Flak
Hi,

Trying my hands on transposing from concert pitch to Trumpet in Bf and french 
horn in F, but the displayed notes are still in concert pitch... How do I make 
these display the notes I would like the players to see?


\new Staff = "trumpet" \with {
  instrumentName = "Trp"
}
{
  \clef treble
  \key c \major
  \transposition bf
  g' 
}
\new Staff = "french horn" \with {
  instrumentName = "Horn"
}{
  \clef treble
  \key c \major
  \transposition f
  cs'
}

Best,
Kenneth

-- 
Roosna & Flak - Contemporary Dance & Music
Web: roosnaflak.com
Code: {github,gitlab}.com/kflak
Mastodon: @k...@sonomu.club