Stefan Thomas <kontrapunktste...@gmail.com> writes: > What is it supposed to do? > Dear David, > I would like to do something like this: > %%%snippet %%%%%% > % fully written out example > \relative c' { > \time 4/4 > c8 r8 r4 r2 > r2 fis8 r8 r4 > \time 3/4 > c8 r8 r4 r4 > r8 e r4 r > } > %% desired form of how to input code > \relative c' { > \time 4/4 > \makerests 4/4 c8 > \makerests 4/4 {r8 fis } > \time 3/4 > \makerests 3/4 c8 > \makerests 3/4 { r8 e} > } > %%%%% > Off course, one should have a shortcut for makerhythm (eventually > defined in frescobaldi or selsewhere). This could save a lot of > typesetting and it would be harder to write too many or less rests.
It does not make much sense to call this with \makerests 4/4 unless your unit of completion is supposed to be 1/4. So I'd just go with something like
makerests = #(define-music-function (parser location frac mus) (fraction? ly:music?) (cond ((<= (/ (car frac) (cdr frac)) (ly:moment-main (ly:music-length mus))) mus) ((>= (/ (1- (car frac)) (cdr frac)) (ly:moment-main (ly:music-length mus))) #{ \makerests #(cons (1- (car frac)) (cdr frac)) #mus r$(ly:make-duration (ly:intlog2 (cdr frac)) 0) #}) (else #{ \makerests #(cons (* 2 (car frac)) (* 2 (cdr frac))) #mus #}))) \new Voice { \time 3/4 \makerests 3/4 { c4. } \makerests 6/8 { c4. } \makerests 6/4 { c4. } \time 4/4 \makerests 2/1 { c4. } \makerests 4/2 { c4. } }
-- David Kastrup
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user