lilypond-user
[Top][All Lists]
Advanced

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

Re: slash-only chords


From: Thomas Morley
Subject: Re: slash-only chords
Date: Fri, 31 Dec 2021 17:07:49 +0100

Am Do., 30. Dez. 2021 um 20:29 Uhr schrieb Flaming Hakama by Elaine
<elaine@flaminghakama.com>:
>
> Hi,
>
> I'm looking for a way to print a chord symbol which is a slash chord,
> but where the top part (above the slash) is blank.
>
> So, I only want to print the slash + root note.
>
> The usage for this is when the previous chord repeats,
> and only the bass note changes.
>
> Here is an MWE for a progression where I would like to use it.
>
>
> \version "2.19.83"
>
> myChords = \chordmode {
>     d2:m d:m/cis | d:m/c d:m/b
> }
> melody = \relative c' {
>     \key d \minor
>     f2 a | c d |
> }
>
> <<
>     \new ChordNames  { \myChords }
>     \new Staff {
>         \mark "Default"
>         \melody
>     }
> >>
>
>
>
> Does anyone have suggestions for how to obtain this?
>
> I've tried using <>  and spacers as the chord,
> both of which produce "syntax error, unexpected /"
>
> myChords = \chordmode {
>     d2:m <>/cis | <>/c <>/b
> }
>
> myChords = \chordmode {
>     d2:m s/cis | s/c s/b
> }
>
> Is there some chord syntax notation that allows this?
>
>
>
> I was also considering, since I am already using my own chord exceptions,
> is there a way to define an exception to specify to only print the slash part?
>
> While you can define a chord treatment such that it does not have anything in 
> it,
> it seems that lily always prints the root and slash + bass note,
> as shown in this second example:
>
>
> myChordExceptions = {
>     <c ees g>1-\markup { }
> }
> chordExceptions = #(append (sequential-music-to-chord-exceptions 
> myChordExceptions #t) ignatzekExceptions)
>
> <<
>     \new ChordNames {
>         \set chordNameExceptions = #chordExceptions
>         \myChords
>     }
>     \new Staff {
>         \mark "Empty"
>         \melody
>     }
> >>
>
>
>
> As this second example demonstrates, the chord exceptions
> are only applied to what is before the slash.
>
> Which is to say, I defined the treatment for a minor chord,
> but it is used in all the slash chords that are minor,
> not just the root position chord.
>
> Perhaps then all I need would be to hide the root of the chord?
> Is that approach possible?
>
> If just hiding the root of the chord were possible,
> I would be able to define a chord spec to identify these chords,
> as in the following example where only the first (non-slash) chord has the 
> minor chord symbol.
>
> I realize, and am ok with the fact,
> that defining non-semantic chord types like this
> means it would be a print-only approach,
> since I would need different chords for MIDI.
>
> %}
>
> hackChordExceptions = {
>     <c ees g cis'>1-\markup { }
> }
> chordExceptions = #(append (sequential-music-to-chord-exceptions 
> hackChordExceptions #t) ignatzekExceptions)
>
> hackChords = \chordmode {
>     d2:m d:1.3-.5.8+/cis | d:1.3-.5.8+/c d:1.3-.5.8+/b
> }
>
> <<
>     \new ChordNames {
>         \set chordNameExceptions = #chordExceptions
>         \hackChords
>     }
>     \new Staff {
>         \mark "Hack"
>         \melody
>     }
> >>
>
>
>
> Please let me know if you have any thoughts.
>
> Thanks!
>
>
> Elaine Alt
> 415 . 341 .4954                                           "Confusion is 
> highly underrated"
> elaine@flaminghakama.com
> Producer ~ Composer ~ Instrumentalist ~ Educator
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>
>>

How about:

\version "2.23.5"

#(define Bass_changes_equal_root_engraver
  (lambda (ctx)
  "For sequential ChordNames with same root, but different bass, the root markup
is dropped: D D/C D/B  -> D /C /B
The behaviour may be controlled by setting the chordChanges context-property."
    (define sort-procedure (lambda (p1 p2) (< (car p1) (car p2))))
    (let ((chord-pitches '())
          (last-chord-pitches '())
          (bass-pitch #f))
      (make-engraver
        ((initialize this-engraver)
          (ly:context-set-property! ctx 'chordNoteNamer note-name->markup))
        (listeners
          ((note-event this-engraver event)
            (let* ((pitch (ly:event-property event 'pitch))
                   (pitch-name (ly:pitch-notename pitch))
                   (pitch-alt (ly:pitch-alteration pitch))
                   (bass (ly:event-property event 'bass #f))
                   (inversion (ly:event-property event 'inversion #f))
                   (chord-changes (ly:context-property ctx 'chordChanges #f)))
            (cond (bass (set! bass-pitch pitch-name))
                  (inversion
                    (set! bass-pitch pitch-name)
                    (set! chord-pitches
                          (cons (cons pitch-name pitch-alt) chord-pitches)))
                  (else
                    (set! chord-pitches
                          (cons (cons pitch-name pitch-alt) chord-pitches))))

            (if (and bass-pitch
                     chord-changes
                     (equal?
                       (sort chord-pitches sort-procedure)
                       (sort last-chord-pitches sort-procedure)))
                (begin
                  (ly:context-set-property! ctx 'minorChordModifier "")
                  (ly:context-set-property! ctx 'chordRootNamer
                    (lambda (x y) "")))
                (begin
                  (ly:context-set-property! ctx 'minorChordModifier "m")
                  (ly:context-set-property! ctx 'chordRootNamer
                    note-name->markup))))))
        (acknowledgers
          ((chord-name-interface this-engraver grob source-engraver)
            (set! last-chord-pitches chord-pitches)
            (set! chord-pitches '())
            (set! bass-pitch #f)))
        ((finalize this-engraver)
          (set! last-chord-pitches '()))))))

myChords = \chordmode {
  \set chordChanges = ##t
  d2:m d:m/cis d:m/c
  \set chordChanges = ##f
  d:m/b e1:7
  \set chordChanges = ##t
  e
  \break
  \once \set chordChanges = ##f
  e1/f e2/gis e/+gis e e:m/f d:m d:m/cis d:m/c
  \set chordChanges = ##f
  d:m/b
}

<<
  \new ChordNames
    \with { \consists #Bass_changes_equal_root_engraver }
    \myChords
  \new Staff \myChords
>>

HTH,
  Harm



reply via email to

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