lilypond-user
[Top][All Lists]
Advanced

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

Re: Force \compressFullBarRests


From: Martín Rincón Botero
Subject: Re: Force \compressFullBarRests
Date: Tue, 8 Sep 2020 21:41:12 +0200

actually, this works for me only in the example given here https://lists.gnu.org/archive/html/lilypond-user/2013-12/msg01085.html. Perhaps someone (maybe Kieren) might explain to me how this script is properly used?

Am Di., 8. Sept. 2020 um 21:29 Uhr schrieb Martín Rincón Botero <martinrinconbotero@gmail.com>:
Ah, I found this old script by Kieren that seems to do the trick :-).

#(define (append-merge x l r)
"Add x to the head of list l, merging skips,
and if r is true also merging full measure rests."
  (if (and (pair? l)
           (ly:music? x)
           (ly:music? (car l))
           (or (and (music-is-of-type? x 'skip-event)
                    (music-is-of-type? (car l) 'skip-event))
               (and r
                    (music-is-of-type? x 'multi-measure-rest)
                    (music-is-of-type? (car l) 'multi-measure-rest)))
           (not (pair? (ly:music-property (car l) 'articulations))))
     (let ((total
            (ly:moment-add
            (ly:music-duration-length (car l))
            (ly:music-duration-length x)
            )))
       (set! (ly:music-property x 'duration)
              (make-duration-of-length total))
       (cons x (cdr l)))
    (cons x l)))

mergeSkips = #(define-music-function
 (parser location rests-also music) ((boolean?) ly:music?)
 "Merge successive skips in sequential music,
  optionally merge full-measure rests as well."
 (music-map
   (lambda (m)
      (if (music-is-of-type? m 'sequential-music)
        (ly:music-set-property! m
           'elements
           (fold-right (lambda (x l)
                         (append-merge x l rests-also))
             '()
             (ly:music-property m 'elements))))
     m)
   music))
   
mergeFullBarRests = #(define-music-function
 (parser location music) (ly:music?)
 #{ \mergeSkips ##t $music #})

Am Di., 8. Sept. 2020 um 20:55 Uhr schrieb Martín Rincón Botero <martinrinconbotero@gmail.com>:
Hello again,

my workflow with Lilypond involves using Frescobaldi and its useful point & click. It also involves adding many "empty" measures (explicit measures containing a full bar rest with no "multiplication", so: R1 R1 R1, etc.) so that during composition I can just click on a rest wherever I want and Frescobaldi takes me right to the line of code (I write one full measure rest per line) and I just change the corresponding rests with music. This has the great advantage that I don't have to count anything. I just click where I want the music to be and replace silences with music (much like in Sibelius or Musescore). However, the pending task will be at the end of composing to clean all these repeated full bar rests and write the explicit multiplications (R1*5, etc.), so that \compressFullBarRests works in the parts. This makes me wonder if it's possible to "force" Lilypond to always display full bar rests in a single staff (f. ex. in the parts), or in multiple staves that have several full measure rests simultaneously (percussion parts, for example), without having to explicitly tell it how many measures that is, but instead, to make it calculate that for me while compiling out of several single full measure rests. This would essentially make that last manual task superfluous ;-). 

Best regards,
Martín.

--


--


--
www.martinrinconbotero.com

reply via email to

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