lilypond-user
[Top][All Lists]
Advanced

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

Re: slash-only chords


From: Flaming Hakama by Elaine
Subject: Re: slash-only chords
Date: Sun, 2 Jan 2022 00:06:24 -0800





On Fri, Dec 31, 2021 at 8:07 AM Thomas Morley <thomasmorley65@gmail.com> wrote:
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
>     }
> >>
>

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


Yes, thanks, this works well if the initial chord is a minor chord.

What would it take to have it work when the initial chord has a 7th?

For other chord types, it seems to hide the root, but print the rest of the chord symbol. 

Perhaps, in this block it would be possible to set additional properties related to other parts of the chord symbol to ""?
I wasn't able to guess what those might be.  
Are they listed somewhere? 

                (begin
                  (ly:context-set-property! ctx 'minorChordModifier "")
                  (ly:context-set-property! ctx 'chordRootNamer
                    (lambda (x y) "")))


Here's an example based on yours, with a few additional chord types.

At present, I am only really interested in getting the dominant 7 and minor 7 to work.


myChords = \chordmode {
  \set chordChanges = ##t
  d2:m d:m/cis

  d2:m7 d:m7/c

  d d/cis

  d:maj7 d:maj7/cis \break

  d:7 d:7/c

  d:m7.5- d:m7.5-/c

  d:aug d:aug/c

  d:aug7 d:aug7/c \break


  \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
>>


Thanks, 

Elaine Alt
415 . 341 .4954                                           "Confusion is highly underrated"
elaine@flaminghakama.com
Producer ~ Composer ~ Instrumentalist ~ Educator
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 

reply via email to

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