|
From: | Jean Abou Samra |
Subject: | Re: chord.ly to extract notes from chords breaks with new Guile |
Date: | Wed, 31 May 2023 03:04:10 +0200 |
User-agent: | Evolution 3.48.1 (3.48.1-1.fc38) |
Le mardi 30 mai 2023 à 20:39 -0400, mskala@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
signature.asc
Description: This is a digitally signed message part
[Prev in Thread] | Current Thread | [Next in Thread] |