lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating Chorded Notes


From: Jonathan Kulp
Subject: Re: Creating Chorded Notes
Date: Sat, 12 Jul 2008 09:48:32 -0500
User-agent: Thunderbird 2.0.0.14 (X11/20080505)

Maybe you could adjust something in this macro to do it for you. This one makes octaves (it's awesome!!).

Jon


\version "2.11.47"

%LSR This function was contributed by Jay Anderson.

#(define (octave-up m t)
 (let* ((octave (1- t))
      (new-note (ly:music-deep-copy m))
      (new-pitch (ly:make-pitch
        octave
        (ly:pitch-notename (ly:music-property m 'pitch))
        (ly:pitch-alteration (ly:music-property m 'pitch)))))
  (set! (ly:music-property new-note 'pitch) new-pitch)
  new-note))

#(define (octavize-chord elements t)
 (cond ((null? elements) elements)
     ((eq? (ly:music-property (car elements) 'name) 'NoteEvent)
       (cons (car elements)
             (cons (octave-up (car elements) t)
                   (octavize-chord (cdr elements) t))))
     (else (cons (car elements) (octavize-chord (cdr elements ) t)))))

#(define (octavize music t)
 (if (eq? (ly:music-property music 'name) 'EventChord)
       (ly:music-set-property! music 'elements (octavize-chord
(ly:music-property music 'elements) t)))
 music)

octaves = #(define-music-function (parser location arg mus) (integer? ly:music?)
 (music-map (lambda (x) (octavize x arg)) mus))


\relative c' { d e \octaves #-1 { \times 2/3 {f g c }}} % this is an example of the macro in practice


Eric Knapp wrote:
Hi, all.

I'm trying to write a music function that creates chorded notes. I'm
starting simply and I'm stumped. How would I create this simple music
expression in a function?

  <a c>2

Is there a grob for these? What I'm working on is being able to
customize the individual NoteHead and Stem grobs for each note.

Thanks,

-Eric


_______________________________________________
lilypond-user mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/lilypond-user


--
Jonathan Kulp
http://www.jonathankulp.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]