lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to generate \scaleDurations values procedurally


From: Jean Abou Samra
Subject: Re: How to generate \scaleDurations values procedurally
Date: Mon, 12 Jun 2023 12:44:04 +0200
User-agent: Evolution 3.48.3 (3.48.3-1.fc38)

[Adding back the list]

Le lundi 12 juin 2023 à 12:23 +0200, Lib Lists a écrit :

> On Mon, 12 Jun 2023 at 10:58, Jean Abou Samra 
> <[jean@abou-samra.fr](mailto:jean@abou-samra.fr)> wrote:
> Dear Jean, all clear, thank you so much! I was exactly trying to
> figure out the accidental issue and realised there was a problem
> there.
> Thank you for the help with the Scheme/Lily syntax, it's now obvious
> what was wrong in my attempt.
> 
> 
> > By the way, \remove'ing Timing_translator sounds a bit... scary, it's a 
> > kind of
> > fundamental translator, I don't know if we really support removing it 
> > entirely.
> > Also, your method of removing bar lines will still make LilyPond insert 
> > them.
> > I think it's better to just use \cadenzaOn.
> 
> 
> Thank you for the tip. Reading the docs and various online examples I
> automatically associated removing Timing_translator to a requisite for
> every polyrhythmic / polymetric music notation, and kept it there (I
> admit that I don't always accurately understand the meaning of all the
> lilypond options,  at times I just experiment until it works)


Basically, for polymeter, you move it from Score level to Staff level.
Namely, you remove it from Score and you add it to Staff. That is also
exactly what \enablePolymeter does (it is a relatively recent command,
which explains why you might still find online examples that move
Timing_translator explicitly).

Now I realize that you did in fact have \enablePolymeter, so
Timing_translator was present in Staff, not completely removed, and
\remove Timing_translator in Score was simply redundant.

For unmetered music, I maintain that \cadenzaOn is the easiest solution.


> > \version "2.25.5"
> > [...]
> 
> That's fabulous, thank you!
> I'm trying to add ottava signs to only some of the pitches (the top
> staff is the piano's highest note). I changed mus = {\ottava #2
> \repeat unfold 1 \relative c'''''  { c c c c }}, which obviously prints
> the ottava on all the pitches.
> The solution I found is to have multiple map loops,
> depending on the pitch's need for ottava sign (15, 8, 8b, 15b) and
> clef. It works, but I'm wondering if there's a
> smarter solution.
> Thank you again for your help!
> 
> mus = {\ottava #2 \repeat unfold 1 \relative c'''''  { c c c c }}
> musLower = { \repeat unfold 1 \relative c'  { c c c c }}
> musLowest = { \clef bass \repeat unfold 1 \relative c,  { c c c c }}
> 
> #(define my-semitone->pitch
>    (make-semitone->pitch
>     (music-pitches #{ { c cis d ees e f fis g gis a bes b } #})))
> 
> \score {
>   \new StaffGroup  <<
>     #@(map (lambda (i)
>              #{
>                 \new Staff {
>                   \scaleDurations #(cons 60 i) {
>                     \transpose c' #(my-semitone->pitch (- (- 60 i))) {
>                       \mus
>                     }
>                   }
>                 }
>               #})
>            (iota 3 60 -1))
>            #@(map (lambda (i)
>              #{
>                 \new Staff {
>                   \scaleDurations #(cons 63 i) {
>                     \transpose c' #(my-semitone->pitch (- (- 60 i))) {
>                       \musLower
>                     }
>                   }
>                 }
>               #})
>            (iota 3 60 -1))
>            #@(map (lambda (i)
>              #{
>                 \new Staff {
>                   \scaleDurations #(cons 66 i) {
>                     \transpose c' #(my-semitone->pitch (- (- 60 i))) {
>                       \musLowest
>                     }
>                   }
>                 }
>               #})
>            (iota 3 60 -1))
>   >>


Sure, use a cond form:

\version "2.25.5"


mus = {\repeat unfold 5 \relative c'''''  { c c c c }}

#(define my-semitone->pitch
   (make-semitone->pitch
    (music-pitches #{ { c cis d ees e f fis g gis a bes b } #})))

\layout {
  \context {
    \Score
    \cadenzaOn
  }
}

\new StaffGroup  <<
  #@(map (lambda (i)
           #{
              \new Staff {
                \scaleDurations #(cons 60 i) {
                  \transpose c' #(my-semitone->pitch (- (- 60 i))) {
                    #(cond
                      ((<= 55 i 60) #{ \ottava 3 #})
                      ((<= 51 i 54) #{ \ottava 2 #})
                      (else #{ #}))
                    \mus
                  }
                }
              }
            #})
         (iota 10 60 -1))
>>





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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]