lilypond-devel
[Top][All Lists]
Advanced

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

Trying to evaluate a music expression in scheme


From: Carl D. Sorensen
Subject: Trying to evaluate a music expression in scheme
Date: Wed, 18 Jun 2008 21:44:42 -0600

Now that I've got my git stuff working (thanks Johannes, Patrick, and Reinhold) 
and the
fret-diagram-details refactor in place, I'm ready to start working on my next 
project, which
is to make the FretBoards context print out predefined fret-diagrams instead of 
calculating
them from the notes.

My proposed architecture is to add a property to FretBoards -- 
usePredefinedDiagrams --
that can be true or false.  I will then modify the code in determine-frets 
(found in
scm/translation-functions.scm) to use the notes as a lookup in a hash table of 
fret diagrams.
If a diagram is found, it will use it.  If no diagram is found, determine-frets 
will use the existing
code to calculate a fret-diagram.

Diagrams will be stored in the form of string-fret-finger lists, which are 
currently used in the
FretBoards context.

Diagrams will be loaded into the hash table by an included ly file.  This will 
give the user the
option of defining her own predefined diagrams, and will prevent overhead of 
the hash table
generation unless the user wants it.

I can clearly see how this architecture could work, but I'd welcome any help 
any of you could
give me to improve it.

The one piece I don't know how to do in the architecture is how to convert 
lilypond input into a list of notes.

I need to know the name of the function to call so I can write something like 
this:

(load-predefined-diagram "\chordmode {c}" ((string-fret1) (string-fret2) 
(string-fret3) (string-fret4)))

then

(let ((notes (this-is-the-function-I-need "\chordmode{c}"))

will return the same list of note events as is passed to determine-frets, so I 
can use it as a  hash-index
for writing the diagram to the hash table.

Does this-is-the-function-I-need exist?  I have looked at 
ly:interpret-music-expression, but this looks like
it's aimed at the top-level music expression.  If the function does exist, what 
is it called?  If it doesn't, can
anybody give me a pointer as to where I might go to get some ideas about how to 
create it?

Thanks,

Carl




reply via email to

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