What's the test for differentiating between non-chord notes and notes
within a chord, when iterating through events in music? I can examine
the notes within a chord individually, but I can't been able to find the
way to capture notes that don't belong to a chord (or alternatively, to
discard note events do belong to a chord).
Leaning heavily on code from Giles T, here's a simple routine that
displays pitches of note events when they are encountered as such, and
also when they occur within a chord. If the goal is to process non-chord
notes only, how can I pick them out? In the listing below I've marked
relevant places with "<<--"
Thanks,
Steve
\version "2.19"
#(use-modules (ice-9 receive)) %% so 'receive' can be used
#(define (noteEvent? music)
(eq? (name-of music) 'NoteEvent))
#(define (name-of music)
" (display-scheme-music (ly:music-property music 'name))"
(ly:music-property music 'name)
)
#(define* (music-to-console music #:optional (strict-comp? #t))
(music-map
(lambda(mus)
(display (name-of mus))
(newline)
(cond
((eq? 'EventChord (name-of mus))
(display "Chord")(newline)
(receive (notes others)
(partition noteEvent? (ly:music-property mus 'elements))
<<--Examine different music property?
(map(lambda(note)(display (ly:music-property note 'pitch)))
notes) (newline)))
((eq? 'NoteEvent (name-of mus)) <<----- Test here?
(display "A note event, but does it stand alone, or is it part
of a chord?") <<----- or here?
(newline) (display (ly:music-property mus 'pitch))(newline))
(else (display "(Not a note or a chord)")(newline))
)
(newline)
#{
#mus
#})
music))
showNotesAndChords = #(define-music-function (music) (ly:music?)
(music-to-console music #t))
someNotes = \transpose c f { <g b d'>4 c'4 d'4 \transpose f c {<f' a'
c''>2 c'}}
\showNotesAndChords \someNotes