Though I remain baffled by Scheme and its use in LilyPond, my hope is to
build one or more functions/procedures that would transpose input music
and for each chord display the transposed chord's note names, with
control over the way the names are represented (as in Cb or F# instead
of ces and fis).
Here, I'm just asking for help with one part of the function-to-be: how
to turn notes in LilyPond music into note names as text (schematic of
the complete imagined function below).
Here's what I've tried so far, in LilyPond 2.19.8x, based closely on
working procedures found on this list. Once this is running right for
single notes I'll (hope to) get it to loop through all input music.
#(define-scheme-function
(pitchin)
(ly:music?)
(let* (
(note-datum (car (ly:music-property pitchin 'elements)))
(pitch-datum (ly:music-property note-datum 'pitch))
(out-notename (ly:pitch-notename pitch-datum)))
#{ \markup
\bold
$out-notename
#}
))
I get "syntax error, unexpected NUMBER_IDENTIFIER" on the $out-notename
line when calling notenamer with a note wrapped in braces, as in:
\notenamer {a}
Without the braces around the music, the error is "In procedure car in
expression (car (ly:music-property pitchin #)):Wrong type (expecting
pair): ()
Results are the same if I do "define-music-function" instead of
"define-scheme-function."
Many thanks for your attention and help,
Steve
PS: I have a working NoteNames reformatter but it seems to require
listing in a substitution table the specific notes of each and every
chord in each transposition. A custom function would allow display of
the chord note names in a columnar stack so if these markups were used
as text scripts they wouldn't either take too much space or collide with
the names of adjacent notes. Alternatively, chord note names could be
placed beneath ChordNames.