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: Valentin Petzel
Subject: Re: How to generate \scaleDurations values procedurally
Date: Mon, 12 Jun 2023 11:02:31 +0200

Hello Lib,

#(ly:music-transpose {\mus} i)

does not make sense. \mus is Lilypond syntax, not scheme. Either do #{ \mus #} 
to parse this as Lilypond expression, or do mus (instead of { \mus }) to scope 
this as Scheme object. Also ly:music-transpose does take a pitch as second 
argument, so if you want to diatonically transpose up do something like

#(ly:music-transpose mus (ly:make-pitch 0 i))

Cheers,
Valentin

Am Montag, 12. Juni 2023, 10:23:14 CEST schrieb Lib Lists:
> On Mon, 12 Jun 2023 at 00:08, Jean Abou Samra <jean@abou-samra.fr> wrote:
> > Le dimanche 11 juin 2023 à 23:55 +0200, Lib Lists a écrit :
> > 
> > Hello, I'm (re)working on a series of pieces for player piano. I'd like to
> > find a way to generate all the \scaleDurations values so that I don't
> > have to type them by hand. In the example below they follow a simple
> > pattern (60/60k 60/59, 60/58, etc.). Unfortunately my knowledge of Scheme
> > is very limited. Moreover, I wouldn't know how to insert the generated
> > values to the right staves. Any hint would be really appreciated!
> > 
> > Like this?
> > 
> > \version "2.25.5"
> > 
> > mus = \repeat unfold 3 { c c c c }
> > 
> > 
> > \score {
> > 
> >   \new StaffGroup  <<
> >   
> >     #@(map (lambda (i)
> >     
> >              #{ \new Staff { \scaleDurations #(cons 60 i) \mus } #})
> >            
> >            (iota 10 60 -1))
> >    
> >    \layout {
> >    
> >     \enablePolymeter
> >     \context {
> >     
> >       \Score
> >       \override SpacingSpanner.base-shortest-duration = #(ly:make-moment
> >       1/4)
> >       proportionalNotationDuration = #(ly:make-moment 1/10)
> >       \override SpacingSpanner.uniform-stretching = ##t
> >       \override SpacingSpanner.strict-note-spacing = ##t
> >       \remove "Timing_translator"
> >       forbidBreakBetweenBarLines = ##f
> >     
> >     }
> >     
> >     \context {
> >     
> >       \Staff
> >       \remove "Time_signature_engraver"
> >       \override BarLine.stencil = ##f
> >       \override BarLine.allow-span-bar = ##f
> >     
> >     }
> >     
> >     \context {
> >     
> >       \Voice
> >       \remove Forbid_line_break_engraver
> >     
> >     }
> >   
> >   }
> > 
> > }
> > 
> > The 60/59 notation is just LilyPond syntax for the Scheme pair (60 . 59).
> > 
> > There is some info about #@ here (and if you didn't know about pairs, you
> > can read this).
> > 
> > Best,
> > 
> > Jean
> 
> Hi Jean,
> thank you so much, that works perfectly! And thank you also for the
> resources. If I may still ask for some help, I now tried to transpose the
> pitches so that the first staff has 'c', the second staff 'b', and so on.
> In other words, each staff's pitch is one semitone lower than the
> previous (or other transposition interval). I tried to add the
> transpose function but got stuck.
> 
> In your example, I changed the line:
> #{ \new Staff { \scaleDurations #(cons 60 i) \mus } #})
> 
> to this:
> #{ \new Staff { \scaleDurations #(cons 60 i)  #(ly:music-transpose
> {\mus} i)  } #})
> 
> but clearly there's something wrong,
> 
> Thank you and
> best regards,
> 
> Lib

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


reply via email to

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