9

What I'd like to do is define custom, specific chord voicings in lilypond, and to be able to attach note-durations to them, along the lines of

voicing = < g a c e a > % dom7, with 7th in bass 
\new Staff {
    % play the whole chord for two quarters, then a half
    \voicing4 \voicing4 \voicing2 
}

However, this basic approach doesn't work: you can't attach the note durations to the variables.

I'm trying to avoid having to write out all of the notes for all of the instances of using the chords.

Is there any way to achieve this end?

0

1 Answer 1

5

You can, of course, write

< g a c e a >4 q q2

If you want to mix different chords, this is not feasible. With the restriction of always needing a duration, you can write something like

makevoicing = #(define-scheme-function (parser location m) (ly:music?)
                  (define-music-function (parser location d) (ly:duration?)
                    (map-some-music
                      (lambda (m)
                        (and (ly:duration? (ly:music-property m 'duration))
                             (begin
                                (set! (ly:music-property m 'duration) d)
                                m)))
                      (ly:music-deep-copy m))))

voicing = \makevoicing < g a c e a > % dom7, with 7th in bass

\new Staff {
       % play the whole chord for two quarters, then a half
      \voicing4 \voicing4 \voicing2 
}

While it is possible to have the duration be defaulted, you'd still need to write \voicing\default in order to get the default, pretty much defeating the idea of having a default in order to save typing.

1
  • You can combine this with the "q" notation, which serves my purposes well.
    – Dave
    Feb 2, 2014 at 1:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.