lilypond-user
[Top][All Lists]
Advanced

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

Re: Bass in Chord Name


From: Marc Hohl
Subject: Re: Bass in Chord Name
Date: Wed, 13 May 2009 20:36:37 +0200
User-agent: Thunderbird 2.0.0.21 (X11/20090318)

Stjepan Brbot schrieb:
Marc Hohl wrote:
Stjepan Brbot schrieb:
Kieren MacMillan wrote:
You have to remove the \germanChords command, then the bass is not
shown as "fis", but as "F#", as you want.

As Mats has written, insert
\override Score.RehearsalMark #'break-align-symbols = #'(clef staff-bar)
at the beginning, then it works (Strangely, \override Score.RehearsalMark #'break-align-symbols = #'clef
doesn't work, but I don't know why.)

Marc



Thanks Marc, indeed if I remove \germanChords I get F# as Bass in chords. OK
in this particular case (song) german chord representation is not needed
because there's no H chord but in general I'd like to have german chords
representation (H instead of B and B instead of Bb) and basses in chords
represented like F#, Gb, H etc. How to achieve this? Also, how to achieve
"dim" instead of "o" in chords?
I searched how and where \germanChords is defined. The definition is in
ly/property-init.ly and looks as follows:

germanChords = {
 \set chordRootNamer = #(chord-name->german-markup #t)
 \set chordNoteNamer = #note-name->german-markup
}

So I searched where "note-name->german-markup" is defined, and it could be found in scm/chord-name.scm. There is also a function called "note-name->markup", which does exactly what you need, only the letter "B" has to be changed to "H". so I copied this definition, changed the letter and renamed it to "note-name->uppercase-semigerman-markup". Furthermore, I pasted the definition of "\germanChords", inserted my function call
and named it "\myGermanChords".

Ok, now checking the file - lilypond complains about "unbound variable: accidental-markup".
This is a function also defined in scm/chord-name.scm, but only locally.
Never mind, I paste the definition in my file - test run, error: "unbound variable: conditional-kern-before". This is defined in scm/chord-generic-names.scm, so I copy this piece of code and pray that it will be the
last snippet I need, and voilĂ : it works!

This is (at least in my opinion) a rather crude method, but as some functions are only locally defined, I don't see another possibility to archieve the desired output. Personally, I also prefer uppercase bass notes for chords, so it would be nice if there will be more chord naming features in the future (or at least an easier way to do some changes, i.e. uppercase/lowercase decisions, alteration styles
etc.)

At the moment, I packed the bits and pieces into a file called mygermanchords.ly, so all you have
to do is adding this  line

\include "mygermanchords.ly"

at the top of your file, change \germanChords to \myGermanChords
and that's it.

Marc

Yes, I inserted:
\override Score.RehearsalMark #'break-align-symbols = #'(clef staff-bar)
and it works. I have problem with understanding the position/scope of these
and similar commands. I inserted it at the very beginning of my lilypond
code and it works here but I have no idea why and when something should be
inside \chords {} \addlyrics {} or other scopes (inside/outside {}).


\version "2.12.2"

% definition from scm/chord-name.scm
#(define (accidental->markup alteration)
  "Return accidental markup for ALTERATION."
  (if (= alteration 0)
      (make-line-markup (list empty-markup))
      (conditional-kern-before
       (alteration->text-accidental-markup alteration)
       (= alteration FLAT) 0.2)))

% definition from scm/ chord-generic-names.scm
#(define (conditional-kern-before markup bool amount)
  "Add AMOUNT of space before MARKUP if BOOL is true."
  (if bool
      (make-line-markup
       (list (make-hspace-markup amount)
             markup))
      markup))

% definition from scm/chord-name.scm, changed to our needs
#(define-public (note-name->uppercase-semigerman-markup pitch)
  "Return pitch markup for PITCH."
  (make-line-markup
   (list
    (make-simple-markup
     (vector-ref #("C" "D" "E" "F" "G" "A" "H") (ly:pitch-notename pitch)))
     (accidental->markup (ly:pitch-alteration pitch)))))

% definition as in ly/property-init.ly
myGermanChords = {
  \set chordRootNamer = #(chord-name->german-markup #t)
  \set chordNoteNamer = #note-name->uppercase-semigerman-markup
}



reply via email to

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