[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Chord name exceptions
From: |
Thomas Morley |
Subject: |
Re: Chord name exceptions |
Date: |
Mon, 6 May 2013 01:24:40 +0200 |
2013/5/5 Nandi <address@hidden>:
> I would like to have a predefined \hungarianChords command, which is
> based on the \germanChords (H instead of B, uppercase sharp and flat
> symbols), but which keeps the default setting E/D instead of E/d. Also,
> I'd need altered chords (es, fis etc.) to end in Hungarian "sz" like this:
> esz, fisz etc., starting with capital letters in such cases like D/Fisz etc.
> (or have the uppercase sharp/flat symbols).
> I've read through the documentation about chordNameExceptions and
> chordRootNamer, but couldn't figure out, how to achieve the desired changes.
> Any help, please? Thanks in advance:
> Nandi
Hi,
although I've no clue about the hungarian language I come up with the
code below.
\version "2.16.2"
#(define
((chord-name->hungarian-markup-text-alteration B-instead-of-Bb)
pitch lowercase?)
(define (pitch-alteration-semitones pitch)
(inexact->exact (round (* (ly:pitch-alteration pitch) 2))))
(define (conditional-string-downcase str condition)
(if condition
(string-downcase str)
str))
(let* ((name (ly:pitch-notename pitch))
(alt-semitones (pitch-alteration-semitones pitch))
(n-a (cond
((equal? (cons name alt-semitones) '(6 . -1))
(cons 7 (+ 1 alt-semitones)))
((equal? (cons name alt-semitones) '(6 . -2))
(cons 7 alt-semitones))
(else (cons name alt-semitones))))
)
(make-line-markup
(list
(make-simple-markup
(conditional-string-downcase
(vector-ref #("C" "D" "E" "F" "G" "A" "H" "B") (car n-a)) lowercase?))
(let ((alteration (/ (cdr n-a) 2)))
(cond
((and (= alteration FLAT) (or (= (car n-a) 5) (= (car n-a) 2)))
(make-simple-markup "sz"))
((= alteration FLAT)
(make-simple-markup "esz"))
((and (= alteration DOUBLE-FLAT)
(= (car n-a) 7))
(make-simple-markup "ebe"))
((and (= alteration DOUBLE-FLAT)
(or (= (car n-a) 5)(= (car n-a) 2)))
(make-simple-markup "szesz"))
((= alteration DOUBLE-FLAT)
(make-simple-markup "eszesz"))
((= alteration SHARP)
(make-simple-markup "isz"))
((= alteration DOUBLE-SHARP)
(make-simple-markup "iszisz"))
(else empty-markup)))))))
hungarianChords =
\set chordRootNamer = #(chord-name->hungarian-markup-text-alteration #f)
%-------------------- Test ---
\layout {
ragged-right = ##f
indent = 0
}
\layout {
\context {
\ChordNames
\hungarianChords
}
}
myMajorChords = \chordmode{
c cis d dis e eis f fis g gis a ais b bis c/dis
\break
c ces b bes a aes g ges f fes e ees d des c
\break
cisis disis eisis fisis gisis aisis bisis
\break
ceses deses eeses feses geses aeses beses
}
myMinorChords = \chordmode{
c:m cis:m d:m dis:m e:m eis:m f:m fis:m g:m gis:m a:m ais:m b:m bis:m c:m/ges
\break
c:m ces:m b:m bes:m a:m aes:m g:m ges:m f:m fes:m e:m ees:m d:m des:m c:m
\break
cisis:m disis:m eisis:m fisis:m gisis:m aisis:m bisis:m
\break
ceses:m deses:m eeses:m feses:m geses:m aeses:m beses:m
}
\score {
\new ChordNames {
\myMajorChords
}
\header {
piece = \markup
\column \bold {
"Major Chords (hungarian?)"
\vspace #2
}
}
}
\score{
\new ChordNames {
\myMinorChords
}
\header {
piece = \markup
\column \bold {
"Minor Chords (hungarian?)"
\vspace #2
}
}
}
Not sure about all settings I've used.
If something's wrong, please shout.
HTH,
Harm
hungarianChordNames.png
Description: PNG image