]> git.donarmstrong.com Git - lilypond.git/commitdiff
(construct-chord): mark inversion as bass if
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 22 Feb 2003 12:54:46 +0000 (12:54 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 22 Feb 2003 12:54:46 +0000 (12:54 +0000)
not present in chord.

13 files changed:
ChangeLog
NEWS
input/regression/chord-name-entry.ly
input/regression/chord-name-styles.ly
input/regression/chord-names.ly
input/regression/chords-funky-ignatzek.ly
input/regression/chords-ignatzek.ly
input/test/Cc-chords.ly [deleted file]
input/test/chord-changes.ly [deleted file]
input/test/chord-inversion.ly [deleted file]
input/test/chord-table.ly [deleted file]
input/test/chord-taxonomy.ly [deleted file]
scm/chord-entry.scm

index 266dca26a5100bac9c47b139fe500c2fa94857e7..27d6637f21f736586c5073784d3aff8ebb8323d8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2003-02-22  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
+       * scm/chord-entry.scm (construct-chord): mark inversion as bass if
+       not present in chord.
+
        * lily/chord.cc: junk contents.
 
 2003-02-17  Heikki Junes <hjunes@cc.hut.fi>
diff --git a/NEWS b/NEWS
index 9c0cbc3ab2b50ec3e002ef8219bb487ebf6ca911..8ee9458265d5a159ffc4d10f4a54e9a8dd1957c4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@ New features in 1.7 since 1.6
 
 * INPUT
 
+** Completely rewritten support for chord entry. Cleaner and more flexible.
+
 ** Text entry is now done in a separate mode, and is more ergonomic
 than the previous Scheme texts.
 
@@ -41,7 +43,7 @@ for a beamed slurred pair of eighth notes.
 ** Completely rewritten text formatting support. It is implemented in a
 completely modular way.
 
-** Better chord names. 
+** Chord name formatting completely rewritten.
 
 ** Texts on multimeasure rests can be set by the user.
 
index d6daa3d85ee4b606502b3388fa3821c8d5452b0d..bf08d58994ab0a36cdc608576fc7c48cb013b95e 100644 (file)
@@ -1,14 +1,15 @@
 \header {
 
-texidoc = "Test file for the new chordname entry code: the suffixes are printed below the pitches."
+texidoc = "Test file for the new chordname entry code (@code{\chords}
+mode): the suffixes are printed below the pitches."
 
 }
 
 \score
 {
 \notes  { \context Voice \chords {
-c1_"1"
-c:7_"7"
+c1_"(nothing)"
+c:7_":7"
 c:m_":m"
 c:m7_":m7"
 c:aug_":aug"
@@ -19,6 +20,7 @@ c:sus4_":sus4"
 c:sus2_":sus2"
 c:6_":6"
 c:m6_":m6"
+c:7sus4_":7sus4"
 c:3-_":3-"
 c:3+_":3+"
 c:5+.3-_":5+.3-"
@@ -30,7 +32,10 @@ c:m13_":m13"
 c:7^5_":7\\^{ }5"
 c^3_"\\^{ }3"
 c/g_"/g"
+c/gis_"/gis"
+c/a_"/a"
 c/+f_"/+f"
+c/+g_"/+g"
 }
 }
 }
index 63ed44f19ced99665bb9f97466a5da20be46a382..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,89 +0,0 @@
-\header {
- texidoc = " show different naming conventions"
-}
-
-\version "1.7.10"
-
-scheme = \chords {
-  % major chords
-  c1
-  c:6          % 6 = major triad with added sixth
-  c:maj                % triangle = maj
-  c:6.9^7      % 6/9 
-  c:9^7                % add9
-
-  % minor chords
-  c:m          % m = minor triad
-  c:m.6                % m6 = minor triad with added sixth
-  c:m.7+       % m triangle = minor major seventh chord
-  c:3-.6.9^7   % m6/9 
-  c:m.7                % m7
-  c:3-.9       % m9
-  c:3-.9^7     % madd9
-
-  % dominant chords
-  c:7          % 7 = dominant
-  c:7.5+       % +7 = augmented dominant
-  c:7.5-       % 7b5 = hard diminished dominant
-  c:7+.5-      %
-  c:7+.5+      %
-
-  % ninth chords
-  c:9          % 7(9)
-  c:9-         % 7(b9)
-  c:9+         % 7(#9)
-  c:13^9.11    % 7(13)
-  c:13-^9.11   % 7(b13)
-  c:13^11      % 7(9,13)
-  c:13.9-^11   % 7(b9,13)
-  c:13.9+^11   % 7(#9,13)
-  c:13-^11     % 7(9,b13)
-  c:13-.9-^11  % 7(b9,b13)
-  c:13-.9+^11  % 7(#9,b13)
-
-  % half diminished chords
-  c:m5-.7              % slashed o = m7b5
-  c:9.3-.5-    % o/7(pure 9)
-
-  % diminished chords
-  c:m5-.7-     % o = diminished seventh chord
-
-
-  % suspended (?) 4ths
-  c:sus c:m.sus c:m7.sus
-  c:m7.sus^3   
-  c:7.4.3
-  c:7.4^3.5
-  c:2^3
-  c:2.7^3
-  c:4^5.3
-
-}
-
-\score {
-  \notes <
-    \context ChordNames = bn {
-       #(set-chord-name-style 'banter)
-       \property ChordNames.instrument = # "Banter"
-       \property ChordNames.instr = #"Bn"
-       \scheme }
-    \context ChordNames = jz {
-       #(set-chord-name-style 'jazz)
-       \property ChordNames.instrument = #"Jazz"
-       \property ChordNames.instr = #"Jz"
-       \scheme }
-    \context ChordNames = am {
-       #(set-chord-name-style 'american)
-       \property ChordNames.instr = #"Am"
-       \property ChordNames.instrument = #"American"
-       \scheme }
-    \context Staff \transpose c c' \scheme
-  >
-\paper {
-linewidth = 16.0\cm
-
-\translator {
-  \ChordNamesContext \consists Instrument_name_engraver }
-}
-}
-%% new-chords-done %%
index a352c3da2fa05824b2ccdb85ab65ce2d516c8863..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,39 +0,0 @@
-\version "1.7.10"
-\header{
-texidoc="
-Chord names are generated from a list pitches, and are customisable
-from guile.  For some unlogical names, guile customisation is used
-by default.
-"
-}
-
-chord =  \notes\transpose c c'\chords{
-   c1
-   c:m
-   c:m5-
-   c:m5-.7-
-   c:7+
-   c:m5-.7
-   c:5-.7+
-   c:m7
-   c:7
-   d
-   d/a
-   d/+gis
-}
-
-\score{
-    <
-           \context ChordNames \chord
-           \context Staff \chord
-    >
-    \paper{
-
-               \translator { 
-                       \ChordNamesContext
-                       ChordName \override #'word-space = #1 
-               }
-    }
-}
-
-%% new-chords-done %%
\ No newline at end of file
index d585c906657a27b1f532ba6a69e11340c9f8ec36..1e77c4fd3a8b800766184f37800844796be96a40 100644 (file)
@@ -12,6 +12,7 @@ chs = \notes
 <<c d e f g bes c'  d' e'>>1
 <<c e g bes c'  d' e'>>1
 <<c e g a bes>>1
+<<c e g a d'>>1
 }
 
 
index 4d7e939bb163833e4a8c917b19cee7d82e6ef7f5..cf104c39689bef34e5e003cec9991b42c4b50f28 100644 (file)
@@ -1,28 +1,29 @@
 \header {
 
-texidoc = "Jazz chords, following [Ignatzek1995], page 17 and 18."
+texidoc = " Chord names are generated from a list pitches.  The
+functions constructing the names are customisable. This file shows
+Jazz chords, following [Ignatzek1995], page 17 and 18."
 
 }
 
-
 chs = \notes \transpose c' c' 
 {
        <<c e g>>1
-       <<c es g>>
+       <<c es g>>% m = minor triad
        <<c e gis>>
        <<c es ges>> \break
        <<c e g bes>>
        <<c es g bes>>
-       <<c e g b>>
+       <<c e g b>>             % triangle = maj
        <<c es ges beses>> 
        <<c es ges b>> \break
        <<c e gis bes>>
        <<c es g b>>
        <<c e gis b>> 
        <<c es ges bes>>\break
-       <<c e g a>>
-       <<c es g a>>
-       <<c e g bes d'>> % ?? 
+       <<c e g a>>   % 6 = major triad with added sixth
+       <<c es g a>>  % m6 = minor triad with added sixth
+       <<c e g bes d'>> 
        <<c es g bes d'>> \break
        <<c es g bes d' f' a' >>
        <<c es g bes d' f' >>
@@ -49,7 +50,7 @@ chs = \notes \transpose c' c'
        <<c f g>>
        <<c f g bes>>\break
        <<c f g bes d'>>
-       <<c e g d'>>
+       <<c e g d'>>    % add9
        <<c es g f'>>
 }
 
diff --git a/input/test/Cc-chords.ly b/input/test/Cc-chords.ly
deleted file mode 100644 (file)
index 4d760aa..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-\version "1.7.10"
-\header {
-  texidoc="Jazz chord names, but with lower case names for minor chords
-
-BROKEN. FIXME.
-"
-}
-
-
-%%%
-%%  UGH UH GUG UHGUHGHGH GHG
-% -- this is fucking up global name space.
-%
-% imagine doing
-% 
-%   lilypond Cc-chords.ly ..other-files-testing-chords...
-%
-% then the other files will get messed up.
-%%
-
-%{
-
-FIXME:
-
-%#(assoc-set! chord::names-alist-jazz
-%  '((0 . 0) (2 . -1)) '(""))
-
-%#(assoc-set! chord::names-alist-jazz
-%   '((0 . 0) (2 . -1) (4 . 0) (6 . -1)) '("7"))
-
-#(define (pitch->chord-name-text-banter pitch additions)
-  (let ((name (pitch->text-banter pitch)))
-    (if (member '(2 . -1) (map pitch->note-name additions))
-       (cons (string-append
-              (string-downcase (substring (car name) 0 1))
-              (substring (car name) 1))
-              (cdr name))
-       name)))
-%}
-
-
-\score {
-  <
-    #(set-chord-name-style 'jazz)
-    \context ChordNames \chords { c1 c:m c:m7 }
-  >
-}
-%% new-chords-done %%
diff --git a/input/test/chord-changes.ly b/input/test/chord-changes.ly
deleted file mode 100644 (file)
index 131561c..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-\version "1.7.10"
-
-\header{
-texidoc="property chordChanges: only display chord names when
-there's a change in the chords scheme, but always display the
-chord name after a line break.
-"
-}
-
-scheme = \chords {
- % ugh ugh: this breaks the output of notes in the regular staff 
-%  \property ChordNamesVoice.chordChanges = ##t
-  c1:m \break c:m c:m c:m d
-}
-
-\score {
-  \notes <
-    \context ChordNames \scheme
-    \context Staff \transpose c c' \scheme
-  >
-  \paper{
-    linewidth = 40 * \staffspace
-    \translator {
-      \ChordNamesContext
-      chordChanges = ##t
-    }
-  }
-}
-%% new-chords-done %%
diff --git a/input/test/chord-inversion.ly b/input/test/chord-inversion.ly
deleted file mode 100644 (file)
index 7a1c1a6..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-\version "1.7.10"
-\header{
-enteredby =     "jcn"
-copyright =     "public domain"
-TestedFeatures =        "chord inversions"
-}
-
-inversions =  \notes\transpose c c'\chords{
-       % inversions
-       c1 c:sus c:6 c/e c/g
-       c/d % this triggers a warning: no 'd' in chord of c
-
-       % added bass 
-       c/+e c/+c c/+b
-}
-
-\score{
-       <
-               \context ChordNames \inversions
-               \context Staff \inversions
-       >
-}
-
-
-%% new-chords-done %%
diff --git a/input/test/chord-table.ly b/input/test/chord-table.ly
deleted file mode 100644 (file)
index e91c0cf..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-\version "1.7.10"
-\header{
-filename =     "chord-table.ly"
-copyright =    "public domain"
-enteredby =    "jcn"
-}
-
-tab =  \notes\transpose c c''\chords{
-       c1 c:m c:4 c:m4 c:5+ c:5- c:dim c:5-.5+ c:6\break %c:m6\break
-}
-
-\score{
-       \context StaffGroup <
-               \context Staff=c \notes\transpose c' c\tab
-               \context ChordNames=c \notes\transpose c' c\tab
-               \context Staff=cis \notes\transpose c' cis\tab
-               \context ChordNames=cis \notes\transpose c' cis\tab
-               \context Staff=des \notes\transpose c' des\tab
-               \context ChordNames=des \notes\transpose c' des\tab
-               \context Staff=d \notes\transpose c' d\tab
-               \context ChordNames=d \notes\transpose c' d\tab
-               \context Staff=es \notes\transpose c' es\tab
-               \context ChordNames=es \notes\transpose c' es\tab
-               \context Staff=e \notes\transpose c' e\tab
-               \context ChordNames=e \notes\transpose c' e\tab
-%{ FIXME: remove some, gs barfs                
-               \context Staff=fis \notes\transpose c' fis\tab
-               \context ChordNames=fis \notes\transpose c' fis\tab
-               \context Staff=g \notes\transpose c' g\tab
-               \context ChordNames=g \notes\transpose c' g\tab
-               \context Staff=as \notes\transpose c' as\tab
-               \context ChordNames=as \notes\transpose c' as\tab
-               \context Staff=a \notes\transpose c' a\tab
-               \context ChordNames=a \notes\transpose c' a\tab
-               \context Staff=bes \notes\transpose c' bes,\tab
-               \context ChordNames=bes \notes\transpose c' bes,\tab
-               \context Staff=b \notes\transpose c' b,\tab
-               \context ChordNames=b \notes\transpose c' b,\tab
-%}             
-       >
-       \paper{
-               textheight = \vsize - 4.0 * \staffheight
-       }
-
-}
-
-
-%% new-chords-done %%
diff --git a/input/test/chord-taxonomy.ly b/input/test/chord-taxonomy.ly
deleted file mode 100644 (file)
index 8f84058..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-\version "1.7.10"
-\header {
-  title="Chord Taxonomy of LilyPond -- jazz"
-}
-scheme = \chords {
-      c1
-      c:4
-      c:9
-      bes:9^7
-      c:11^7
-      c:9+
-      % TODO
-      c:m5-.7
-      c:m5-.7-
-      c:7+
-      c:m7+
-    }
-    
-\score {
-  <
-    #(set-chord-name-style 'jazz)
-    \context ChordNames \scheme
-    \context Staff \notes \transpose c c' \scheme
-  >
-}
-%% new-chords-done %%
index c4ea088b483a1db4d27bc69af8c70feb6be917d7..1101b6d7beb4ca28c5c5adbc7a02b613f77909ea 100644 (file)
@@ -81,35 +81,51 @@ Entry point for the parser.
         (cdr mods)))
        (else (interpret-removals  chord mods))
       ))
+    (define (pitch-octavated-below p root)
+      "return P, but octavated, so it is below  ROOT"
+      (ly:make-pitch
+       (+
+       (ly:pitch-octave root)
+       (if (>= (ly:pitch-notename root)
+               (ly:pitch-notename p))
+           0 -1))
+       (ly:pitch-notename p)
+       (ly:pitch-alteration p)))
     
     (define (process-inversion complete-chord)
       "Take out inversion from COMPLETE-CHORD, and put it at the bottom.
 Return (INVERSION . REST-OF-CHORD).
 
 Side effect: put original pitch in INVERSION.
+If INVERSION is not in COMPLETE-CHORD, it will be set as a BASS, overriding
+the bass specified.  
+
 "
       (let*
          (
           (root (car complete-chord))
           (inv? (lambda (y)
-                  (= (ly:pitch-notename y)
-                     (ly:pitch-notename inversion))))
+                  (and (= (ly:pitch-notename y)
+                          (ly:pitch-notename inversion))
+                       (= (ly:pitch-alteration y)
+                          (ly:pitch-alteration inversion))
+                       )))
+                
           (rest-of-chord (filter-out-list inv? complete-chord))
           (inversion-candidates (filter-list inv? complete-chord))
-          (down-inversion (ly:make-pitch
-                           (+
-                            (ly:pitch-octave root)
-                            (if (>= (ly:pitch-notename root)
-                                   (ly:pitch-notename inversion))
-                                0 -1))
-                          (ly:pitch-notename inversion)
-                          (ly:pitch-alteration inversion)))
+          (down-inversion (pitch-octavated-below inversion root))
           )
 
        (if (pair? inversion-candidates)
-           (set! inversion (car inversion-candidates)))
-       
-       (cons down-inversion rest-of-chord)
+           (set! inversion (car inversion-candidates))
+           (begin
+             (set! bass inversion)
+             (set! inversion #f))
+           )
+       (if inversion
+           (cons down-inversion rest-of-chord)
+           rest-of-chord
+           )
       ))
 
     ;; root is always one octave too low.
@@ -125,7 +141,7 @@ Side effect: put original pitch in INVERSION.
          (write-me "base: " base-chord)
          (write-me "bass: " bass)))
 
-    ;; skip the leading : , we need some of the   stuff following it.
+    ;; skip the leading : , we need some of the stuff following it.
     (if (pair? flat-mods)
        (if (eq? (car flat-mods)  'chord-colon)
            (set! flat-mods (cdr flat-mods))
@@ -182,11 +198,12 @@ Side effect: put original pitch in INVERSION.
        )
 
     (if inversion
-       (begin
-         (set! complete-chord (process-inversion complete-chord))
-         (make-chord (cdr complete-chord) bass duration (car complete-chord)
-                     inversion
-                     ))
+       (set! complete-chord (process-inversion complete-chord)))
+    (if bass
+       (set! bass (pitch-octavated-below bass root)))
+    (if inversion
+       (make-chord (cdr complete-chord) bass duration (car complete-chord)
+                   inversion)
        (make-chord complete-chord bass duration #f #f))
   ))