From 322a3a5b826dbc52427daf8a36ffd8edb0fc13d9 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sat, 22 Feb 2003 19:05:49 +0000 Subject: [PATCH] * lily/new-chord-name-engraver.cc (process_music): give original inversion pitch to chord name routine. * input/tutorial/os-score.ly: update to new markup * Documentation/user/appendices.itely: simply include chords-ignatzek. * Documentation/user/refman.itely (Chords mode): add documentation for chord mode. * scm/chord-entry.scm (construct-chord): mark inversion as bass if not present in chord. (construct-chord): add inversion and bass support. --- ChangeLog | 12 ++ Documentation/user/appendices.itely | 106 +---------- Documentation/user/literature.itely | 6 + Documentation/user/refman.itely | 200 ++++++++++----------- Documentation/user/tutorial.itely | 88 ++++----- input/regression/chord-names-bass.ly | 18 ++ input/regression/instrument-name-markup.ly | 5 +- input/test/chord-markup.ly | 3 - input/test/ct-jazz.ly | 23 --- input/test/german-chords.ly | 26 --- input/test/monstrous.ly | 29 --- input/tutorial/flowing.ly | 4 +- input/tutorial/os-score.ly | 16 +- lily/new-chord-name-engraver.cc | 16 +- scm/chord-entry.scm | 31 ++-- scm/chords-ignatzek.scm | 33 ++-- 16 files changed, 244 insertions(+), 372 deletions(-) create mode 100644 input/regression/chord-names-bass.ly delete mode 100644 input/test/ct-jazz.ly delete mode 100644 input/test/german-chords.ly delete mode 100644 input/test/monstrous.ly diff --git a/ChangeLog b/ChangeLog index 27d6637f21..1da8336179 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,19 @@ 2003-02-22 Han-Wen Nienhuys + * lily/new-chord-name-engraver.cc (process_music): give original + inversion pitch to chord name routine. + + * input/tutorial/os-score.ly: update to new markup + + * Documentation/user/appendices.itely: simply include + chords-ignatzek. + + * Documentation/user/refman.itely (Chords mode): add documentation + for chord mode. + * scm/chord-entry.scm (construct-chord): mark inversion as bass if not present in chord. + (construct-chord): add inversion and bass support. * lily/chord.cc: junk contents. diff --git a/Documentation/user/appendices.itely b/Documentation/user/appendices.itely index 7920b2a806..06f5c7486f 100644 --- a/Documentation/user/appendices.itely +++ b/Documentation/user/appendices.itely @@ -37,114 +37,12 @@ rules. @node American Chords @section American Chords - -@lilypond[verbatim, noquote, noindent, notime] -\include "english.ly" - -scheme = \chords { - c % Major triad - cs:m % Minor triad - df:m5- % Diminished triad - c:5^3 % Root-fifth chord - c:4^3 % Suspended fourth triad - c:5+ % Augmented triad - c:2^3 % "2" chord - c:m5-.7- % Diminished seventh - c:7+ % Major seventh - c:7.4^3 % Dominant seventh suspended fourth - c:5+.7 % Augmented dominant seventh - c:m5-.7 % "Half" diminished seventh - c:5-.7 % Dominant seventh flat fifth - c:5-.7+ % Major seventh flat fifth - c:m7+ % Minor-major seventh - c:m7 % Minor seventh - c:7 % Dominant seventh - c:6 % Major sixth - c:m6 % Minor sixth - c:9^7 % Major triad w/added ninth - c:6.9^7 % Six/Nine chord - c:9 % Dominant ninth - c:7+.9 % Major ninth - c:m7.9 % Minor ninth -} - -\score { - \notes < - \context ChordNames { - #(set-chord-name-style 'american) - \scheme } - \context Staff \transpose c c' \scheme - > - \paper { - linewidth = 5.7\in - } -} -@end lilypond +[TODO] @node Jazz chords @section Jazz chords -Similarly, Jazz style chord names are implemented as a variation on -American style names: - -@lilypond[verbatim, noquote, noindent, notime] -scheme = \chords { - % major chords - c - 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: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 -} - -\score { - \notes < - \context ChordNames { - #(set-chord-name-style 'jazz) - \scheme } - \context Staff \transpose c c' \scheme - > - \paper { - linewidth = 5.7\in - } -} -@end lilypond - -@c [barnumbers look silly, fixme.] - - +@lilypondfile{chords-ignatzek.ly} @node MIDI instruments @section MIDI instruments diff --git a/Documentation/user/literature.itely b/Documentation/user/literature.itely index 61586ce44f..1679d134b6 100644 --- a/Documentation/user/literature.itely +++ b/Documentation/user/literature.itely @@ -15,6 +15,12 @@ Harald Banter, Akkord Lexikon. Schott's S@"{o}hne Comprehensive overview of commonly used chords. Suggests (and uses) a unification for all different kinds of chord names. +@item Ignatzek 1995 +Klaus Ignatzek, Die Jazzmethode f@"{u}r Klavier. Schott's S@"{o}hne +1995. Mainz, Germany ISBN 3-7957-5140-3 + +A tutorial introduction to playing Jazz on the piano. One of the first +chapters contains an overview of chords in common use for Jazz music. @item Gerou 1996 diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index 1e4214c470..fed1fb0911 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -3333,107 +3333,118 @@ print them as name. @cindex Chords mode Chord mode is a mode where you can input sets of pitches using common -names. It is introduced by the keyword @code{\chords}. It is similar -to note mode, but words are also looked up in a chord modifier table -(containing @code{maj}, @code{dim}, etc). Dashes and carets are used -to indicate chord additions and subtractions, so articulation scripts -can not be entered in Chord mode. +names. It is introduced by the keyword @code{\chords}. +In chords mode, a chord is entered by the root, which is entered +like a common pitch, for example, +@lilypond[fragment,verbatim] + es4. d8 c2 +@end lilypond +is the notation for an E-flat major chord. -Throughout these examples, chords have been shifted around the staff -using @code{\transpose}. +@cindex chord entry +@cindex chord mode +Other chords may be entered +by suffixing a colon, and introducing a modifier, and optionally, a +number, for example @lilypond[fragment,verbatim] -\transpose c c' { - \chords { - c1 c:3- c:7 c:8 - c:9 c:9-.5+.7+ c:3-.5- - } -} +\chords { e1:m e1:7 e1:m7 } +@end lilypond +The first number following the root is taken to be the `type' of the +chord, thirds are added to the root until it reaches the specified +number, for example. +@lilypond[fragment,verbatim] + \chords { c:3 c:5 c:6 c:7 c:8 c:9 c:10 c:11 } +@end lilypond + +@cindex root of chord +@cindex additions, in chords +@cindex removals, in chords + +More complex chords may also be constructed adding separate steps +to a chord. Additions are added after the number following +the colon, and are separated by dots. For example +@c +@lilypond[verbatim,fragment] + \chords { c:5.6 c:3.7.8 c:3.6.13 } +@end lilypond +Chord steps can be altered by suffixing a @code{-} or @code{+} sign +to the number, for example: +@lilypond[verbatim,fragment] + \chords { c:7+ c:5+.3- c:3-.5-.7- } +@end lilypond +Removals are specified similarly, and are introduced by a caret. They +must come after the additions. +@lilypond[verbatim,fragment] + \chords { c^3 c:7^5 c:9^3.5 } +@end lilypond + +Modifiers can be used to change pitches. The following modifiers are +supported +@table @code +@item m + Minor chord. Lowers the 3rd and (if present) the 7th step. +@item dim + Diminished chord. Lowers the 3rd, 5th and (if present) the 7th step +@item aug + Augmented chord. Raises the 5th step. +@item maj + Major 7th chord. Raises the 7th step, if present. +@item sus + Suspended 4th or 2nd. This modifier removes the 3rd step. Append + either @code{2} or @code{4} to add the 2nd or 4th step to the chord. +@end table +Modifiers can be mixed with additions. +@lilypond[verbatim,fragment] + \chords { c:sus4 c:7sus4 c:dim7 c:m6 } @end lilypond +@cindex modifiers, in chords. @cindex @code{aug} @cindex @code{dim} @cindex @code{maj} @cindex @code{sus} +@cindex @code{m} -The second type of modifier that may appear after the @code{:} is a -named modifier. Named modifiers are listed in the file -@file{chord-modifiers.ly}. The available modifiers are @code{m} and -@code{min} which lower the 3rd half a step, `@code{aug}' which -raises the 5th, `@code{dim}' which lowers the 5th, -`@code{maj}' which adds a raised 7th, and `@code{sus}' -which replaces the 5th with a 4th. - +Since the unaltered 11 does sound well when combined with the +unaltered 3, the 11 is removed in this case, unless it is added +explicitly). For example, @lilypond[fragment,verbatim] -\transpose c c' { - \chords { - c1:m c:min7 c:maj c:aug c:dim c:sus - } -} -@end lilypond - - -Chord subtractions are used to eliminate notes from a chord. The -notes to be subtracted are listed after a @code{^} character, -separated by dots. - -@lilypond[fragment,verbatim,center] - \transpose c c' { - \chords { - c1^3 c:7^5.3 c:8^7 - } - } + \chords { c:13 c:13.11 c:m13 } @end lilypond -@cindex @code{/} -Chord inversions can be specified by appending `@code{/}' and the name -of a single note to a chord. In a chord inversion, the inverted note is -transposed down until it is the lowest note in the chord. If the note -is not in the chord, a warning will be printed. +@cindex @code{/} +An inversion (putting one pitch of the chord on the bottom), as well +as bass notes, can be specified by appending +@code{/}@var{pitch} to the chord. @lilypond[fragment,verbatim,center] - \transpose c c'' { - \chords { - c1 c/e c/g c:7/e - } - } - + \chords { c1 c/g c/f } @end lilypond @cindex @code{/+} - -Bass notes can be added by `@code{/+}' and -the name of a single note to a chord. This has the effect of -adding the specified note to the chord, lowered by an octave, -so it becomes the lowest note in the chord. +If you do not want to remove the bass note from the chord, but rather +add the note, then you can use @code{/+}@var{pitch}. @lilypond[fragment,verbatim,center] - \transpose c c'' { - \chords { - c1 c/+c c/+g c:7/+b - } - } - + \chords { c1 c/+g c/+f } @end lilypond -The formal syntax for named chords is as follows: -@example - @var{tonic}[@var{duration}][@code{-}@var{modifiers}][@code{^}@var{subtractions}][@code{/}@var{inversion}][@code{/+}@var{bass}]. -@end example -@var{tonic} should be the tonic note of the chord, and @var{duration} is -the chord duration in the usual notation. There are two kinds of -modifiers. One type is formed by @emph{chord additions}. Additions are -obtained by listing intervals separated by dots. An interval is written -by its number with an optional @code{+} or @code{-} to indicate raising -or lowering by half a step. Chord additions have two effects: they adds -the specified interval and all lower odd numbered intervals to the -chord, and they may lower or raise the specified interval. +@refbugs + +Each step can only be present in a chord once. The following +simply produces the augmented chord, since @code{5+} is interpreted +last. +@cindex clusters +@lilypond[verbatim,fragment] + \chords { c:5.5-.5+ } +@end lilypond + +In chord mode, dashes and carets are used to indicate chord additions +and subtractions, so articulation scripts can not be entered. -@refbugs -Implementation details are gory. For example @code{c:4} not only adds -a fourth, but also removes the third. @c . {Printing named chords} @@ -3500,41 +3511,10 @@ scheme = \notes { } @end lilypond +The default chord name layout is a system for Jazz music, proposed by +Klaus Ignatzek (See @ref{Literature}). -By default, a chord name system proposed by Harald Banter (See -@ref{Literature}) is used. The system is very regular and predictable. -Typical American style chord names may be selected by setting the -@code{style} property of the @code{ChordNames.ChordName} object to -@code{'american}. Similarly @code{'jazz} selects Jazz chordnames. - -Routines that determine the names to be printed are written in Scheme, -and may be customized by the user. The code can be found in -@file{scm/chord-name.scm}. Here's an example showing the differences in -chord name styles: - -@c too long? -@c maybe just junk verbatim option? -@lilypond[verbatim,singleline,noquote] -scheme = \chords { - c1 c:5^3 c:4^3 c:5+ - c:m7+ c:m5-.7 - c:5-.7 c:5+.7 - c:9^7 -} - -\score { - \notes < - \context ChordNames = banter \scheme - \context ChordNames = american { - \property ChordNames.ChordName \override - #'style = #'american \scheme } - \context ChordNames = jazz { - \property ChordNames.ChordName \override - #'style = #'jazz \scheme } - \context Staff \transpose c c' \scheme - > -} -@end lilypond +[TODO: add description for banter other jazz.] @node Writing parts diff --git a/Documentation/user/tutorial.itely b/Documentation/user/tutorial.itely index b7d81bee19..61c630972b 100644 --- a/Documentation/user/tutorial.itely +++ b/Documentation/user/tutorial.itely @@ -2337,79 +2337,85 @@ for transposing instruments. @subsection The full score -The second file, @file{input/tutorial/os-score.ly}, reads the definitions of the first -(@file{input/tutorial/os-music.ly}), and defines the @code{\score} block for the full -conductor's score. +The second file, @file{input/tutorial/os-score.ly}, reads the +definitions of the first (@file{input/tutorial/os-music.ly}), and +defines the @code{\score} block for the full conductor's score. +@verbatim +\version "1.7.6" -@example -% os-score.ly \include "os-music.ly" \include "paper13.ly" #(ly:set-point-and-click 'line-column) -#(define text-flat '((font-relative-size . -2) - (music "accidentals--1"))) - -\score @{ +textFlat = \markup {\smaller \musicglyph #"accidentals--1"} +\score { < \global \property Score.BarNumber \override #'padding = #3 \context StaffGroup = woodwind < \context Staff = flauti < - \property Staff.midiInstrument = #"flute" - \property Staff.instrument = "2 Flauti" - \property Staff.instr = "Fl." + \property Staff.midiInstrument = #"flute" + \property Staff.instrument = "2 Flauti" + \property Staff.instr = "Fl." \Key - \context Voice=one @{ \voiceOne \flautoI @} - \context Voice=two @{ \voiceTwo \flautoII @} + \context Voice=one { \voiceOne \flautoI } + \context Voice=two { \voiceTwo \flautoII } > > \context StaffGroup = timpani < \context Staff = timpani < - \property Staff.midiInstrument = #"timpani" - \property Staff.instrument = #'(lines "Timpani" "(C-G)") - \property Staff.instr = #"Timp." - \clef bass + \property Staff.midiInstrument = #"timpani" + \property Staff.instrument = \markup { \column << "Timpani" "(C-G)" >> } + \property Staff.instr = #"Timp." + \clef bass \Key - \timpani + \timpani > > \context StaffGroup = brass < \context Staff = trombe < - \property Staff.midiInstrument = #"trumpet" - \property Staff.instrument = #`(lines "2 Trombe" "(C)") - \property Staff.instr = #`(lines "Tbe." "(C)") + \property Staff.midiInstrument = #"trumpet" + \property Staff.instrument = \markup { \column << "2 Trombe" "(C)" >> } + \property Staff.instr = \markup{ \column << "Tbe." "(C)">> } \Key - \context Voice=one \partcombine Voice - \context Thread=one \tromboI - \context Thread=two \tromboII + \context Voice=one \partcombine Voice + \context Thread=one \tromboI + \context Thread=two \tromboII > \context Staff = corni < \property Staff.midiInstrument = #"french horn" - \property Staff.instrument = #`(lines "Corno" - (columns "(E" ,text-flat ")")) - \property Staff.instr = #`(lines "Cor." - (columns "(E" ,text-flat ")")) - \property Staff.transposing = #3 - \notes \key bes \major - \context Voice=one \corno + \property Staff.instrument + = \markup { \column << "Corno" { "(E" \textFlat ")" } >> } + \property Staff.instr = + \markup { \column << "Cor." { "(E" \textFlat ")" } >> } + \property Staff.transposing = #3 + \notes \key bes \major + \context Voice=one \corno > > > - \paper @{ + \paper { indent = 15 * \staffspace - linewidth = 55 * \staffspace + linewidth = 60 * \staffspace textheight = 90 * \staffspace - \translator@{ + \translator{ + \VoiceContext + \consists "Multi_measure_rest_engraver" + } + \translator{ \HaraKiriStaffContext - @} - @} - \midi @{ + \remove "Multi_measure_rest_engraver" + } + } + \midi { \tempo 4 = 75 - @} -@} -@end example + } +} + + + +@end verbatim @center @strong{Zo, goed lieverd?} @sp 1 diff --git a/input/regression/chord-names-bass.ly b/input/regression/chord-names-bass.ly new file mode 100644 index 0000000000..9312f07279 --- /dev/null +++ b/input/regression/chord-names-bass.ly @@ -0,0 +1,18 @@ +\header { + +texidoc = "Test igatzek inversion and bass notes. +Above the staff: computed chord names. Below staff: entered chord name. +" + +} + + +bladidbla = \chords { + f4:maj7/e_":maj7/e" f:maj7/f_":maj7/f" f2:maj7/g_":maj7/g" + f4:maj7/+e_":maj7/+e" f:maj7/+f_":maj7/+f" f2:maj7/+g_":maj7/+g" + } + +\score { +< \context ChordNames \bladidbla + \context Voice \bladidbla > +} diff --git a/input/regression/instrument-name-markup.ly b/input/regression/instrument-name-markup.ly index dce7f0f23b..c367b7f5fd 100644 --- a/input/regression/instrument-name-markup.ly +++ b/input/regression/instrument-name-markup.ly @@ -10,12 +10,13 @@ including alterations. " \version "1.7.6" +textFlat = \markup {\smaller \musicglyph #"accidentals--1"} \score { \notes \context Staff = treble { \property Staff.instrument - = \markup { \column << "Clarinetti" { "in B" \smaller \musicglyph #"accidentals--1" } >> } + = \markup { \column << "Clarinetti" { "in B" \textFlat } >> } \property Staff.instr - = \markup { \smaller { "Cl(B" \smaller \musicglyph #"accidentals--1" ")" } } + = \markup { \smaller { "Cl(B" \textFlat ")" } } { c''1 \break c'' } diff --git a/input/test/chord-markup.ly b/input/test/chord-markup.ly index b88f75174c..1f7f536154 100644 --- a/input/test/chord-markup.ly +++ b/input/test/chord-markup.ly @@ -17,9 +17,6 @@ c^\markup { \column << "" ";" "" >> \column << "1" { \bold "2" "3" } >> } } - \context ChordNames \chords { - c:7+.9-^3.5 - } > } %% new-chords-done %% diff --git a/input/test/ct-jazz.ly b/input/test/ct-jazz.ly deleted file mode 100644 index eb3338fcda..0000000000 --- a/input/test/ct-jazz.ly +++ /dev/null @@ -1,23 +0,0 @@ -\version "1.7.10" -\header { - title="Chord Taxomony of LilyPond -- jazz" - subtitle="Amy's chord tests" -} -scheme = \chords { - c1 - c:4 - c:9 - bes:9^7 - c:11^7 - c:9+ - % TODO - } - -\score { - < - #(set-chord-name-style 'jazz) - \context ChordNames \scheme - \context Staff \notes \transpose c c' \scheme - > -} -%% new-chords-done %% diff --git a/input/test/german-chords.ly b/input/test/german-chords.ly deleted file mode 100644 index 62585f4b9c..0000000000 --- a/input/test/german-chords.ly +++ /dev/null @@ -1,26 +0,0 @@ -\header { - - texidoc = "German chords use H/B iso. B/B-flat. - -FIXME. Most likely broken during namespace reorganisation of early 1.7. - -" - - -} -\version "1.7.10" -\include "german-chords-init.ly" - -% #(set! german-Bb #t) - -ch = \chords { beses1/+beses bes/+bes b/+b bis/+bis ases/+ases as/+as a/+a ais/+ais fisis/+fisis} - -\score { - < - \context ChordNames=chn {\ch} - \context Staff=stf \chords {\ch} - > - \paper {} -} - -%% new-chords-done %% diff --git a/input/test/monstrous.ly b/input/test/monstrous.ly deleted file mode 100644 index 83d4bf65a5..0000000000 --- a/input/test/monstrous.ly +++ /dev/null @@ -1,29 +0,0 @@ -\version "1.7.10" - -\header { - texidoc ="FIXME" - } -%% Chord gurus, is this ok now?? - -monstrous= \chords{ - -%% fixme: -%% \property Score.chordInversion = ##t - - % /c is/was missing: - bes:6/+c - - % Cdim7 - c:dim7 -} - -\score{ - < - \context ChordNames \monstrous - \context Staff \monstrous - > - \paper{ - linelength=-1.0\mm - } -} -%% new-chords-done %% diff --git a/input/tutorial/flowing.ly b/input/tutorial/flowing.ly index c37e016936..e9baa5cd3c 100644 --- a/input/tutorial/flowing.ly +++ b/input/tutorial/flowing.ly @@ -22,8 +22,8 @@ text = \lyrics { accompaniment =\chords { r8 - c2:3- f:3-.7 d:min es4 c8:min r8 - c2:min f:min7 g:7^3.5 c:min } + c2:3- f:3-.7 d:m es4 c8:m r8 + c2:m f:m7 g:7^3.5 c:m } \score { \simultaneous { diff --git a/input/tutorial/os-score.ly b/input/tutorial/os-score.ly index c45584b324..198166af45 100644 --- a/input/tutorial/os-score.ly +++ b/input/tutorial/os-score.ly @@ -1,12 +1,10 @@ - \version "1.7.6" \include "os-music.ly" \include "paper13.ly" #(ly:set-point-and-click 'line-column) -#(define text-flat '((font-relative-size . -2) (music "accidentals--1"))) - +textFlat = \markup {\smaller \musicglyph #"accidentals--1"} \score { < \global @@ -24,7 +22,7 @@ \context StaffGroup = timpani < \context Staff = timpani < \property Staff.midiInstrument = #"timpani" - \property Staff.instrument = #'(lines "Timpani" "(C-G)") + \property Staff.instrument = \markup { \column << "Timpani" "(C-G)" >> } \property Staff.instr = #"Timp." \clef bass \Key @@ -34,8 +32,8 @@ \context StaffGroup = brass < \context Staff = trombe < \property Staff.midiInstrument = #"trumpet" - \property Staff.instrument = #`(lines "2 Trombe" "(C)") - \property Staff.instr = #`(lines "Tbe." "(C)") + \property Staff.instrument = \markup { \column << "2 Trombe" "(C)" >> } + \property Staff.instr = \markup{ \column << "Tbe." "(C)">> } \Key \context Voice=one \partcombine Voice \context Thread=one \tromboI @@ -43,8 +41,10 @@ > \context Staff = corni < \property Staff.midiInstrument = #"french horn" - \property Staff.instrument = #`(lines "Corno" (columns "(E" ,text-flat ")")) - \property Staff.instr = #`(lines "Cor." (columns "(E" ,text-flat ")")) + \property Staff.instrument + = \markup { \column << "Corno" { "(E" \textFlat ")" } >> } + \property Staff.instr = + \markup { \column << "Cor." { "(E" \textFlat ")" } >> } \property Staff.transposing = #3 \notes \key bes \major \context Voice=one \corno diff --git a/lily/new-chord-name-engraver.cc b/lily/new-chord-name-engraver.cc index ca749fba54..00a7215e55 100644 --- a/lily/new-chord-name-engraver.cc +++ b/lily/new-chord-name-engraver.cc @@ -18,6 +18,7 @@ #include "pitch.hh" #include "protected-scm.hh" #include "translator-group.hh" +#include "warn.hh" class New_chord_name_engraver : public Engraver { @@ -60,18 +61,31 @@ New_chord_name_engraver::process_music () SCM inversion = SCM_EOL; SCM pitches = SCM_EOL; + Music* inversion_event = 0; for (int i =0 ; i < notes_.size (); i++) { Music *n = notes_[i]; SCM p = n->get_mus_property ("pitch");; if (n->get_mus_property ("inversion") == SCM_BOOL_T) - inversion = p; + { + inversion_event = n; + inversion = p; + } else if (n->get_mus_property ("bass") == SCM_BOOL_T) bass = p; else pitches = gh_cons (p, pitches); } + if (inversion_event) + { + SCM op = inversion_event->get_mus_property ("original-pitch"); + if (unsmob_pitch (op)) + pitches= gh_cons (op, pitches); + else + programming_error ("Inversion does not have original pitch."); + } + pitches = scm_sort_list (pitches, Pitch::less_p_proc); SCM name_proc = get_property ("chordNameFunction"); diff --git a/scm/chord-entry.scm b/scm/chord-entry.scm index 1101b6d7be..52643961ba 100644 --- a/scm/chord-entry.scm +++ b/scm/chord-entry.scm @@ -81,12 +81,13 @@ Entry point for the parser. (cdr mods))) (else (interpret-removals chord mods)) )) - (define (pitch-octavated-below p root) + + (define (pitch-octavated-strictly-below p root) "return P, but octavated, so it is below ROOT" (ly:make-pitch (+ (ly:pitch-octave root) - (if (>= (ly:pitch-notename root) + (if (> (ly:pitch-notename root) (ly:pitch-notename p)) 0 -1)) (ly:pitch-notename p) @@ -113,7 +114,7 @@ the bass specified. (rest-of-chord (filter-out-list inv? complete-chord)) (inversion-candidates (filter-list inv? complete-chord)) - (down-inversion (pitch-octavated-below inversion root)) + (down-inversion (pitch-octavated-strictly-below inversion root)) ) (if (pair? inversion-candidates) @@ -133,13 +134,6 @@ the bass specified. ; something weird happens when this is removed, ; every other chord is octavated. --hwn... hmmm. (set! root (ly:pitch-transpose root (ly:make-pitch 1 0 0))) - - (if #f - (begin - (write-me "\n*******\n" flat-mods) - (write-me "root: " root) - (write-me "base: " base-chord) - (write-me "bass: " bass))) ;; skip the leading : , we need some of the stuff following it. (if (pair? flat-mods) @@ -165,8 +159,7 @@ the bass specified. (if (= (pitch-step (car flat-mods)) 11) (set! explicit-11 #t)) (set! base-chord - (map (lambda (y) (ly:pitch-transpose y root)) - (stack-thirds (car flat-mods) the-canonical-chord))) + (stack-thirds (car flat-mods) the-canonical-chord)) (set! flat-mods (cdr flat-mods)) )) @@ -200,7 +193,19 @@ the bass specified. (if inversion (set! complete-chord (process-inversion complete-chord))) (if bass - (set! bass (pitch-octavated-below bass root))) + (set! bass (pitch-octavated-strictly-below bass root))) + + (if #f + (begin + (write-me "\n*******\n" flat-mods) + (write-me "root: " root) + (write-me "base chord: " base-chord) + (write-me "complete chord: " complete-chord) + (write-me "inversion: " inversion) + (write-me "bass: " bass))) + + + (if inversion (make-chord (cdr complete-chord) bass duration (car complete-chord) inversion) diff --git a/scm/chords-ignatzek.scm b/scm/chords-ignatzek.scm index 36bdb5bbae..3549a779c6 100644 --- a/scm/chords-ignatzek.scm +++ b/scm/chords-ignatzek.scm @@ -149,7 +149,6 @@ (define-public (ignatzek-chord-names in-pitches bass inversion context) - (define (remove-uptil-step x ps) "Copy PS, but leave out everything below the Xth step." @@ -174,6 +173,7 @@ alteration-pitches addition-pitches suffix-modifiers + bass-pitch ) "Format for the given (lists of) pitches. This is actually more @@ -272,14 +272,20 @@ work than classifying the pitches." alterations suffixes add-markups) sep)) + (base-stuff (if bass-pitch + (list sep (pitch->markup bass-pitch)) + '())) ) - - (make-line-markup - (list - root-markup - (markup-join prefixes sep) - (make-super-markup to-be-raised-stuff)) - ))) + + (set! base-stuff + (append + (list root-markup + (markup-join prefixes sep) + (make-super-markup to-be-raised-stuff)) + base-stuff)) + (make-line-markup base-stuff) + + )) (let* ( @@ -291,6 +297,7 @@ work than classifying the pitches." (suffixes '()) (add-steps '()) (main-name #f) + (bass-note #f) (alterations '()) ) @@ -340,10 +347,16 @@ work than classifying the pitches." ) (set! alterations (append alterations (car split))) (set! add-steps (append add-steps (cdr split))) - (set! alterations (delq main-name alterations)) (set! add-steps (delq main-name add-steps)) + (if (ly:pitch? inversion) + (set! bass-note inversion) + ) + + (if (ly:pitch? bass) + (set! bass-note bass) + ) ;; chords with natural (5 7 9 11 13) or leading subsequence. ;; etc. are named by the top pitch, without any further @@ -360,7 +373,7 @@ work than classifying the pitches." (set! alterations '()) )) - (ignatzek-format-chord-name root prefixes main-name alterations add-steps suffixes) + (ignatzek-format-chord-name root prefixes main-name alterations add-steps suffixes bass-note) ) )))) -- 2.39.2