Le mardi 30 mai 2023 à 20:39 -0400, msk...@ansuz.sooke.bc.ca a écrit :

> I need, at each point in time, to have at most one note per track, exactly one
> track per note, and silence in any leftover tracks, regardless of the
> voice/chord structure of the music.


That sounds like you want a performer-based approach. Like:

```
\version "2.24.1"

#(define ((Keep_only_engraver i) context)
   (let ((j 0))
     (make-performer
      (listeners
       ((note-event performer event)
        (unless (eqv? i j)
          (ly:event-set-property! event 'pitch #f))
        (set! j (1+ j))))
      ((stop-translation-timestep performer)
       (set! j 0)))))

#(define (scores n music)
   (apply values
          (map (lambda (i)
                 #{
                   \score {
                     \midi { \context { \Score \consists #(Keep_only_engraver 
i) } }
                     #music
                   }
                 #})
               (iota n))))

mus = <<
  \new Staff { c'1 d'2 d'4 e'4 }
  \new Staff << { g'1 a'2 a'4 b'4 } \\ { g1 g1 } >>
>>

{ \mus }

$(scores 3 mus) % 3 is the max number of simutaneous notes
```

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to