Hi there,
I am not at home ... so here is not a solution, but here is a little
snippet, that includes two functions, that may be helpful:
\version "2.16.1"
musA = \relative c'' {
bes4 a c b
}
musB = #(music-map
(lambda (m)
(let* ((mus m)
(dur (ly:music-property mus 'duration)))
(if (ly:duration? dur)
(ly:music-set-property! mus 'duration
(ly:make-duration
(+ 1 (ly:duration-log dur))
(ly:duration-dot-count dur)
2 1)))
mus)) (ly:music-deep-copy musA))
<<
\new Staff \musA
\new Staff \musB
>>
HTH
Cheers, Jan-Peter
On 13.07.2013 16:03, Urs Liska wrote:
Hi all, the Schemers in particular,
you surely know by now that I am writing a series of posts that
demonstrate how elegantly and efficiently we can recreate a portion of
a book that obviously has been produced with many pains in Finale.
I'm confident that it will be an impressive display of LilyPond's
power :-) but I would love to go even one step further.
In the post published yesterday I showed how easy it is to typeset
that polymetric example from Aldridge's book.
In the second post (finished but scheduled for monday or tuesday) I
show a Python function that generates the LilyPond code for a complete
set of patterns.
The third post will set up the files to finally print the whole set.
I would be happy to include an alternative approach if I can get the
necessary input from the list (of course I will credit it correctly):
Instead of generating the patterns' code with Python I would like to
see a Scheme function that achieves the same directly from within the
LilyPond files. Probably such an approach could even simplify a few
other things.
The Python code I used is here:
https://github.com/openlilylib/aldridge-patterns/blob/master/pattern-generator.py
and the resulting LilyPond file here:
https://github.com/openlilylib/aldridge-patterns/blob/master/pattern-definitions.ily
and you can of course inspect the whole repository if you want.
The task is to print these examples in five parallel metric contexts
(see
http://lilypondblog.org/wp-content/uploads/2013/07/aldridge-ex-19-score.pdf),
therefore I had to do some things about those virtual time signatures.
If the patterns are generated by a Scheme function we can do better
and handle this specification 'at source level'.
I have added a dummy file that should hold that function:
https://github.com/openlilylib/aldridge-patterns/blob/master/pattern-definitions-scheme.ily
So:
The function should take three arguments (as already in the dummy):
- start and
- end of the range (which in my Python function is hardcoded)
- denominator of the time signatures
For each number in the range it should:
- produce a LilyPond pattern corresponding to the binary
representation of the given number
- chose note/rest duration to be 1/denominator (which is an
improvement over my Python approach because we can omit the \shift-
and \scaleDurations process
- beam from the first to the last note if there is more than one note
and if denominator > 4
Additionally the function should:
- Insert a manual break after four patterns or if the length of the
pattern increases (which happens when the number is a power of two)
(don't forget to reset the counter in that case)
- after that break re-print the time signature (calculated from the
length of the pattern and the given denominator) and insert a \mark
\default
Modifications in the main file I would expect:
- The \newExercise function is obsolete (it was necessary because the
patterns themselves weren't aware of the denominator)
- Instead of the \shiftDurations - \scaleDurations steps (which can be
dropped) I'd move the Timing to the individual staves, that is I don't
use the timeSignatureFractions anymore but real time signatures.
- the \noBeamForLongerNotes function would become obsolete (as we
don't generate those beams in the first place)
(Sorry Harm, but it's not in vain because I'd of course also present
my first approach)
- the patterns are called with \patterns start end denominator.
- As the \shiftDurations are obsolete I don't need that I-II-III-IV-V
stuff anymore but can place the call of \patterns directly in the \score
I'm sure this would deliver even one more deep hit in our "notation
battle", therefore I'm really looking forward to your suggestions.
They can be discussed here, or I'd happily accept them as pull requests.
Urs
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user