---------- Forwarded message ----------
From: Thomas Morley <thomasmorley65@gmail.com>
To: Randy Josleyn <randy.josleyn@gmail.com>
Cc: lilypond-user <lilypond-user@gnu.org>
Bcc:
Date: Mon, 7 Sep 2020 21:47:55 +0200
Subject: Re: adding chordmode chord modifiers
Am Mo., 7. Sept. 2020 um 18:32 Uhr schrieb Randy Josleyn
<randy.josleyn@gmail.com>:
>
> Hi list,
>
> Using my extremely limited general programming knowledge, I found in the scheme file chord-entry.scm that the chord modifiers m, maj, sus, and so on are defined. Is it possible to add to this list? I want to write "add9" chords like `c:add9`, which would be equivalent to writing `<c e g d'>` or `c:3.5.9` in chordmode (plus the chord exceptions snippet in the NM to add the "add"). However, the latter methods are too verbose for me.
>
> My use case is for printing chord symbols above the staff in a lead sheet.
>
> I checked the snippets repository for "chord modifier", "chord*", and "add9", but I didn't see anything relevant.
>
> Is there a way to create the "c:add9" syntax to get "Cadd9" to print as a chord symbol? Any help would be appreciated!
>
> Regards,
>
>
> Randy
Speaking only for me I'd be fine with:
mus = \chordmode {
\set additionalPitchPrefix = "add"
c:3.5.9
}
<<
\new ChordNames \mus
\new Staff \mus
>>
But of course you can go for c:add9, see p.e. Aaron's reply.
My own take is a little different.
It's restricted to "add9", which will _remove_ a 7th pitch-step and no
need for chord-exceptions
%% c/p from chord-ignatzek-names.scm
#(define (pitch-step p)
"Musicological notation for an interval. Eg. C to D is 2."
(+ 1 (ly:pitch-steps p)))
%% c/p from chord-ignatzek-names.scm
#(define (remove-step x ps)
"Copy PS, but leave out the Xth step."
(if (null? ps)
'()
(let* ((t (remove-step x (cdr ps))))
(if (= (- x 1) (ly:pitch-steps (car ps)))
t
(cons (car ps) t)))))
%% proc to _remove_ 7
#(define (add9-modifier pitches)
(remove-step (pitch-step (ly:make-pitch 0 6 0)) pitches))
%% let lily know about it
chordmodifiers = #(cons (cons 'add add9-modifier) default-chord-modifier-list)
mus = \chordmode {
\set additionalPitchPrefix = "add"
c:3.5.9
c:add9
}
<<
\new ChordNames \mus
\new Staff \mus
>>
Cheers,
Harm
Thank you so much Harm and Aaron for your code and suggestions. I'll give them a try and see how it goes. These code examples are informative to me — I do appreciate them!
(By the way, I switched to a daily digest for lilypond-user emails and I'm not sure about how replies work from them. I've made mistakes with how replies to a list work before, so I apologize if I've done it again.)
Randy