lilypond-user
[Top][All Lists]
Advanced

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

Re: Changing notes based on fingerings


From: Nicolas Sceaux
Subject: Re: Changing notes based on fingerings
Date: Thu, 17 Jul 2008 15:12:58 +0200

Le 16 juil. 08 à 16:13, Eric Knapp a écrit :

The next issue in trying to extend Lilypond for my instrument is that
I want to change things in the Note based on the text in the
Fingering. Here's an example, this displayMusic call results in the
make-music call that is after it. I have code working that gives me
the "2" from the FingeringEvent that I got from the very helpful Neil
Puttock. Now I need to be able to retrieve the NoteEvent that is in
the same list.

\displayMusic {a''2-2}

(make-music
 'SequentialMusic
 'elements
 (list (make-music
         'EventChord
         'elements
         (list (make-music
                 'NoteEvent  <------ I want to make changes here.
                 'duration
                 (ly:make-duration 1 0 1 1)
                 'pitch
                 (ly:make-pitch 1 5 0))
               (make-music
                 'FingeringEvent
                 'digit
                 2)))))    <----  Based on this.

The NoteEvent part of this expression is the value of the name property.

  (ly:music-property music-object 'name) ==> NoteEvent

If I'm in a function that was delivered a Fingering grob, can I
navigate up to the containing list and then up to the SequentialMusic
object?

Do you mean a FingeringEvent music expression, or a Fingering grob?
Once you have grobs, it's too late for modifying music expressions.
You can navigate down music expressions, but not up. But see below.

Or is this not the direction that will give me a solution? The
other idea I have about this is to override the creation of all music
notes and if there is a Fingering object then rewrite the entire
make-music call. I don't know how to do that, either.

I'm not exactly sure what you're trying to do, but here is my guess.

Based on an input like: a''2-2
you want to produce something like: [fill in the blank]

The process is the following:

 1. \displayMusic a''2-2
as you have done, to be able to recognize how to get the interesting
elements

 2. \displayMusic [fill in the blank]
to see how to programmatically build the result

3. write a basic music function that transforms the input to the desired
result.

If what you're working on is complex, at first implement elementary
transformations. Then, progresseivey merge them in single music function
that does what you aim at.

nicolas





reply via email to

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