Next: , Previous: Displaying music expressions, Up: Building complicated functions


12.3.2 Music properties

The NoteEvent object is the first object of the 'elements property of someNote.

someNote = c'
\displayMusic \someNote
===>
(make-music
  'EventChord
  'elements
  (list (make-music
          'NoteEvent
          'duration
          (ly:make-duration 2 0 1 1)
          'pitch
          (ly:make-pitch 0 0 0))))

The display-scheme-music function is the function used by \displayMusic to display the Scheme representation of a music expression.

#(display-scheme-music (first (ly:music-property someNote 'elements)))
===>
(make-music
  'NoteEvent
  'duration
  (ly:make-duration 2 0 1 1)
  'pitch
  (ly:make-pitch 0 0 0))

Then the note pitch is accessed through the 'pitch property of the NoteEvent object,

#(display-scheme-music
   (ly:music-property (first (ly:music-property someNote 'elements))
                      'pitch))
===>
(ly:make-pitch 0 0 0)

The note pitch can be changed by setting this 'pitch property,

#(set! (ly:music-property (first (ly:music-property someNote 'elements))
                          'pitch)
       (ly:make-pitch 0 1 0)) ;; set the pitch to d'.
\displayLilyMusic \someNote
===>
d'


Next: , Previous: Displaying music expressions, Up: Building complicated functions

This page is for LilyPond-2.10.33 (stable-branch).

Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.