Thomas Morley <[email protected]> writes:

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

Like with \beamExceptions , this should probably be available as a
scheme function.

>   ;; 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)))

Hm?  This looks for text scripts and takes the first one (if any) if
omit-root is set (because of available rest arguments) or otherwise all
scripts.

-- 
David Kastrup

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to