[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: question about minor + fourth
From: |
Thomas Morley |
Subject: |
Re: question about minor + fourth |
Date: |
Sun, 28 Aug 2016 13:29:01 +0200 |
2016-08-28 10:33 GMT+02:00 Thomas Morley <address@hidden>:
> 2016-08-28 8:19 GMT+02:00 David Kastrup <address@hidden>:
>> Thomas Morley <address@hidden> writes:
>>
>>> 2016-08-28 0:19 GMT+02:00 Benjamin Poly <address@hidden>:
>>>> Thanks for the code you sent me in private Jacques, it's full of useful
>>>> examples but I still can't make this particular chord work.
>>>>
>>>> I want to display a minor chord with a fourth like this: "Am (add4)".
>>>> That's
>>>> all I want to do.
>>>> First I'm surprised that I have to specify the chord (in the variable
>>>> chExceptionMusic) in a note to note format (in this case <a c e d>). Is it
>>>> not possible to specify it in a chord name format ?
>>>
>>> You would need to do it in \chordmode but there the "-"-sign has a
>>> different meaning,
>>
>> One can use _ here I guess. Unpretty, yes.
>
>
> An in-ly-file proof of concept:
[...]
Here a more elaborate code, which could probably replace current
state. Works with default note-mode and chordmode, even mixed.
Though, questions in-line, anyone with some hints?
\version "2.18.2"
%%;; fixme we should standardize on omit-root (or the other one.)
%%;; perhaps the default should also be reversed --hwn
#(define (my-sequential-music-to-chord-exceptions seq . rest)
;; TODO change doc-string
"Transform sequential music SEQ of type <<c d e>>-\\markup{ foobar }
to (cons CDE-PITCHES FOOBAR-MARKUP), or to (cons DE-PITCHES
FOOBAR-MARKUP) if OMIT-ROOT is given and non-false.
"
(define (chord-to-exception-entry m)
(let* ((omit-root (and (pair? rest) (car rest)))
(pitches (event-chord-pitches m))
(sorted (sort pitches ly:pitch<?))
(root (car sorted))
;; ugh?
;;(diff (ly:pitch-diff root (ly:make-pitch -1 0 0)))
;; FIXME. This results in #<Pitch c> ...,
;; but that is what we need because default octave for
;; \chords has changed to c' too?
(diff (ly:pitch-diff root (ly:make-pitch 0 0 0)))
(normalized (map (lambda (x) (ly:pitch-diff x diff)) sorted))
;; Question
;; why this mapping? Obviously `text' selects from this list, but why? --harm
(texts
(map
(lambda (x) (ly:music-property x 'text))
(extract-typed-music m 'text-script-event)))
(text (if (null? texts) #f (if omit-root (car texts) texts))))
(cons (if omit-root (cdr normalized) normalized) text)))
;; Question
;; is it really needed to check for ZERO-MOMENT? --harm
(define (is-sane-ev-chrd? m)
(not (equal? ZERO-MOMENT (ly:music-length m))))
(let* ((elts (filter is-sane-ev-chrd? (extract-typed-music seq 'event-chord)))
(alist (map chord-to-exception-entry elts)))
;; Question
;; why this filtering? Looks strange, and I see no difference --harm
;(filter (lambda (x) (cdr x)) alist)
alist))
%%%%%%%%%%%%%%%%%%%%%%%%
%% EXAMPLE
%%%%%%%%%%%%%%%%%%%%%%%%
%% define the new behaviour
chExceptionMusic = {
<c e g b>1-\markup { \super "7<" }
\chordmode {
a1:m4.5_\markup { m (add 4) }
c1:6_\markup { \super "major plus 6" }
}
<c e g b d'>1-\markup { \super "major9" }
}
%% add it to other exceptional settings
chExceptions =
#(append
(my-sequential-music-to-chord-exceptions
chExceptionMusic
#t)
ignatzekExceptions)
m = \chordmode { c:7+ a:m4.5 c:6 c:7+.9 }
<<
\new ChordNames
%% use the new appearance in this context
\with { chordNameExceptions = #chExceptions }
\m
\new Staff \m
>>
Cheers,
Harm
- question about minor + fourth, Benjamin Poly, 2016/08/27
- Re: question about minor + fourth, Jacques Menu Muzhic, 2016/08/27
- Re: question about minor + fourth, Benjamin Poly, 2016/08/27
- Re: question about minor + fourth, Benjamin Poly, 2016/08/27
- Re: question about minor + fourth, Thomas Morley, 2016/08/27
- Re: question about minor + fourth, David Kastrup, 2016/08/28
- Re: question about minor + fourth, David Kastrup, 2016/08/28
- Re: question about minor + fourth, Thomas Morley, 2016/08/28
- Re: question about minor + fourth, Benjamin Poly, 2016/08/28
- Re: question about minor + fourth,
Thomas Morley <=
- Re: question about minor + fourth, David Kastrup, 2016/08/28
- Re: question about minor + fourth, Thomas Morley, 2016/08/28
- Re: question about minor + fourth, David Kastrup, 2016/08/28
- Re: question about minor + fourth, Thomas Morley, 2016/08/28
- Re: question about minor + fourth, David Kastrup, 2016/08/28