lilypond-user
[Top][All Lists]
Advanced

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

Re: customising chords


From: Bailey James E.
Subject: Re: customising chords
Date: Sat, 1 Nov 2008 00:06:47 +0100

Wow. For all intents and purposes, it's syrian to me, but I thank you for your time and diligence, and I will certainly try this out tomorrow.

Am 31.10.2008 um 19:34 schrieb Roman Stawski:

Hi James

I'm not sure if this is what you're looking for but here's a snippet
with examples ranging from the straightforward -- those that _I_ can
understand -- to the more involved (chordRootNamer).

- - - - [START]
\version "2.11.60"
\layout { ragged-right = ##t }


% --------------------------------------------------------------------
% Set up list of customized chord patterns/names in the format
%     <chord>-\markup{...}
% Note that in this example we define chords in the key of C. But
% Lilypond isn't racist ... it will use the name when it finds the
% same patten in any key.
% --------------------------------------------------------------------
myChordDefinitions = {
 <c e>-\markup{\super\circle{\number{3}}}        % c:3
 <c f>-\markup{\sub\hbracket{\number{4}}}        % c:4^3
 <c f bes>-\markup{\super\number{\column{4 7}}}    % c:4.7^3
}
% (Disclaimer -- you may want to use more sensible markup)


% --------------------------------------------------------------------
% Yes, some scheme is needed. But once it's written in an include file
% we can effectively forget about it. All that needs to be updated are
% the chord definitions above whenever we find a new one.
%
% This code translates the music in \myChordDefinitions above to a
% list of exceptions and adds the standard (ignatzek) exception to the
% end to get a complete list of chord exceptions.
% --------------------------------------------------------------------
myChordExceptions = #(append
 (sequential-music-to-chord-exceptions myChordDefinitions #t)
 ignatzekExceptions)


% --------------------------------------------------------------------
% Changing the root name of the chord. YOU REALLY SHOULDN'T NEED TO DO
% THIS, but just for the sake of completeness...!
% --------------------------------------------------------------------
#(define-public ((chord-name->my-markup) pitch)
 "Return pitch markup for PITCH, using my note names. Loosely based
 on chord-name->italian-markup in scm/chord-names.scm"
 (let* ((name (ly:pitch-notename pitch))
    (alt (ly:pitch-alteration pitch)))
   (make-line-markup
     (list
(make-simple-markup (vector-ref #("c" "d" "e" "f" "g" "a" "b") name))
   (if (= alt 0)
     (make-line-markup (list empty-markup))
     (make-line-markup
       (list
         (make-with-color-markup
       (rgb-color 1 0 0)
(make-raise-markup 0.7 (alteration->text-accidental-markup alt))
       ))))))))
% --------------------------------------------------------------------
% That's all right -- you can wake up now...
% --------------------------------------------------------------------



% --------------------------------------------------------------------
% Install the chord exceptions by executing the scheme snippet above.
% Just to be complete, you can add other customisation macros here
% too.
% --------------------------------------------------------------------
myChordInit = {
%\frenchChords % If you want simplicity \set chordRootNamer = #(chord-name->my-markup) % ) If you're a masochist
 \set chordPrefixSpacer = #0.4                    % )

 \set majorSevenSymbol = \markup{"7M"}
 \set chordNameExceptions = #myChordExceptions
}


% --------------------------------------------------------------------
% And now you can chord away to your heart's content
% --------------------------------------------------------------------
preamble  = {\key g \major \time 4/4 }
thechords = \chordmode   { \myChordInit g2:3 g:4^3 | g:4.7^3 gis }
themusic  = \relative c' { e4 e e e | e e e e }
\score { <<
 \new ChordNames { \preamble \thechords }
 \new Staff { \preamble << \thechords \\ \themusic >> }
}
- - - - [END]

Hope that helps

Roman







reply via email to

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