lilypond-user
[Top][All Lists]
Advanced

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

Re: Helper macros for music analysis


From: Thomas Morley
Subject: Re: Helper macros for music analysis
Date: Thu, 1 Nov 2018 16:21:03 +0100

Am Do., 1. Nov. 2018 um 14:44 Uhr schrieb Jérôme Plût <address@hidden>:
>
>
> I wrote some macros to help write analysis of musical pieces.
> Here is an example file (on Bach's Invention I).
>
> Structural analysis is (of course) performed by hand, and displayed on
> a Lyrics structure on top of the music. (This part is only a set of
> very simple macros).
>
> Harmonic analysis is performed mostly by hand (I also have some code
> that does harmonic analysis, but it works mostly on chorales; the code
> here only detects octave-drop cadences) and displayed on a Lyrics
> structure below the music.
>
> The code also does a bit of motif analysis, which is done
> automatically (motives are declared once by hand, then later
> occurrences and inversions are identified automatically).
>
> The enclosed files:
>   motif.scm  contains most of the parentheses
>   bwv772.ly  is the example for Invention I
>
> TThe code compiles with both v2.18 (Debian stable; this is the only
> version I have access to on some of my systems) and v2.19.
>
> I am interested in any feedback you would have on this code!
>
> --
>         Jérôme

Hi Jérôme,

I've only started looking at it...

Very nice!
Some observations, though:

Right from looking at the output of bwv772.ly it bugged me that "Ainv"
(with it's arrow-head) is not in the same way aligned to the
NoteColumn like the simple "A".
So I changed 'mark-motif-leaf ' to:
(define (mark-motif-leaf leaf name first trans) (let* (
  (p (ly:music-property leaf 'pitch))
  (color (color-variant (get-motif-color name) trans))
  (grobs '(NoteHead Stem Dots Flag Script Accidental))
  )
  (if first
    (ly:music-set-property! leaf 'articulations
      (cons (make-music 'TextScriptEvent
                        'direction 1
                        'tweaks
                        (list (cons (quote parent-alignment-X) 0)
                              (cons (quote self-alignment-X) 0))

                        'text (motif-markup name))
            (ly:music-property leaf 'articulations))))
  (make-sequential-music (append
    (map (lambda (g) (prop-override `(Staff ,g color) color)) grobs)
    (list leaf)
    (map (lambda (g) (prop-revert `(Staff ,g color))) grobs)))
))

Iirc, 'parent-alignment-X is a 2.19.-feature, though.

I then intended to do similar with 'structural-corner'. But I failed.
Part of the problem is you use 'structure as a music-property without
declaring it. As a consequence using the option -dcheck-internal-types
makes the compilation fail. Even not using this option, \tweaks etc
can't be apllied in a reasonable way. One could change the basic
markup, ofcourse, but I'd recommend to better cope with the
'structure-music-property.

Furthermore, compiling your code with my guilev2-setup fails right
from the beginning with:
error: GUILE signaled an error for the expression beginning here
#
 (load "motif.scm")
Unable to find file "./motif.scm" in load path

Maybe creating a module is more promising than using 'load', but now
I'm guessing ...

Didn't investigate further, though.


So far, many thanks for sharing your code,
  Harm



reply via email to

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