[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Repeated durations: pitches vs rests
From: |
David Bellows |
Subject: |
Re: Repeated durations: pitches vs rests |
Date: |
Mon, 22 Feb 2021 13:42:15 -0800 |
Hello Jean,
That works basically like I was hoping it would! Thank you very much
for the effort you put into this. I suppose the only issue is that it
spits out a warning when a tilde is used: "r8~ 16" but still prints it
out properly.
I know absolutely nothing about Scheme coding in LilyPond so I have no
idea how correct your code is, hopefully someone will take a closer
look at it?
Thank you very much!
Dave
On Mon, Feb 22, 2021 at 1:25 PM Jean Abou Samra <jean@abou-samra.fr> wrote:
>
> Hello,
>
> For what it's worth, you can do the following.
>
> Please be aware, however, that not being fully
> knowledgeable about LilyPond's representation of
> music, I cannot guarantee the correctness of this
> code in all cases.
>
> Best,
> Jean
>
> \version "2.22.0"
>
> implicitRests =
> #(define-music-function (music) (ly:music?)
> (map-some-music
> (lambda (m)
> (ly:music-set-property!
> m
> 'elements
> (let loop ((remaining-elements (ly:music-property m 'elements))
> (last-rhythmic-event #f)
> (acc '()))
> (if (null? remaining-elements)
> (reverse acc)
> (let ((next-event (car remaining-elements))
> (other-events (cdr remaining-elements)))
> (if (and (music-is-of-type? next-event 'note-event)
> (null? (ly:music-property next-event 'pitch)))
> (loop other-events
> last-rhythmic-event
> (cons
> (make-music (ly:music-property
> last-rhythmic-event 'name)
> 'pitch
> (ly:music-property
> last-rhythmic-event 'pitch)
> 'duration
> (ly:music-property next-event
> 'duration))
> acc))
> (loop other-events
> (if (music-is-of-type? next-event
> 'rhythmic-event)
> next-event
> last-rhythmic-event)
> (cons next-event acc)))))))
> #f)
> music))
>
> \implicitRests \new Voice \relative {
> c'4 4 r4 4
> c'4 4 r8 8 4
> c d8 r8 8 r4 8
> << { c'4 4 r8 4 8 } \\ { r8 8 16 16 16. 32 2 } >>
> }
>
- Re: Repeated durations: pitches vs rests, (continued)
- Re: Repeated durations: pitches vs rests, Timothy Lanfear, 2021/02/22
- Re: Repeated durations: pitches vs rests, David Bellows, 2021/02/22
- Re: Repeated durations: pitches vs rests, David Kastrup, 2021/02/22
- Re: Repeated durations: pitches vs rests, David Bellows, 2021/02/22
- Re: Repeated durations: pitches vs rests, Martín Rincón Botero, 2021/02/22
- Re: Repeated durations: pitches vs rests, David Bellows, 2021/02/22
- Re: Repeated durations: pitches vs rests, Martín Rincón Botero, 2021/02/22
- Re: Repeated durations: pitches vs rests, David Kastrup, 2021/02/22
- Re: Repeated durations: pitches vs rests, Martín Rincón Botero, 2021/02/23
- Re: Repeated durations: pitches vs rests, Jean Abou Samra, 2021/02/22
- Re: Repeated durations: pitches vs rests,
David Bellows <=
- Re: Repeated durations: pitches vs rests, Jean Abou Samra, 2021/02/22
Re: Repeated durations: pitches vs rests, antlists, 2021/02/22
Re: Repeated durations: pitches vs rests, Flaming Hakama by Elaine, 2021/02/22