I think it should be possible to type in something like
\makerests 2/4. { c4. }
or
\makerests #2 #4. { c4. }
2012/9/5 Stefan Thomas <[email protected]>
> Dear David,
> I'm always astonished what can be done with scheme and lilypond!
> But I think this snippet (which You must have been written quite fast) is
> not 100% perfect.
> For example
> \makerests 4/4 c4
> should produce c4 r4 r2
> and
> \makerests 6/8 { c4. }
> should produce
> c4. r4 r8
> In case of 6/8 the base moment I think is (at least in most cases a dotted
> quarter, not a eigth note). Filling up bars with rests isn't maybee as
> trivial as I thought.
>
>
> 2012/9/5 David Kastrup <[email protected]>
>
>> Stefan Thomas <[email protected]> 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
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user