|
From: | Matthew Probst |
Subject: | Need some guidance from a Lilypond Scheme expert |
Date: | Mon, 11 Jun 2012 11:43:12 -0500 |
However, the data structure created by my second Lilypond example looks more like this:
In the first example, it sees an 'EventChord, so we properly fetch a list of all its children's 'pitch properties. In the second example, it's 'SequentialMusic, not an 'EventChord. What I want to do is walk down the data structure and find the first EventChord or NoteEvent.
That doesn't seem too hard, actually. Need to define a function first-non-sequence, and conditionally drill farther into the data structure until I find the first non-sequence. Understanding that this is pseudocode instead of proper syntax, I'd need to do something roughly like the following:
Also have to potentially recurse farther into nested levels of 'SequentialMusic or down each item in the 'elements list, I am comfortable fleshing it out to that level.
What I'm wondering, is what (if any) Lilypond scheme function do I use to determine the type of a music data structure? I could certainly just say (car mus) but I'm wondering if there's a function I should use for the sake of encapsulation. I see that one can get properties of a music element with (ly:music-property mus 'SYMBOL), the existing snippet code grabs the 'elements list using (ly:music-property mus 'elements).
If it's just a matter of use (car mus) and comparing the symbol against a given list of options, fine, I just don't know if I'm going the right way. I've been looking at the docs for several days now, and have done so at several times in the past, and I'm just not quickly finding what I need.
My goal is to finally immerse myself into the Scheme side of Lilypond, and start implementing some fixes to the various rhythm-pitch template snippets that I've been wishing for, instead of complaining.
[Prev in Thread] | Current Thread | [Next in Thread] |