On 15/03/2026 18:13, Luca Fascione wrote:
You're inspiring a follow up question:could one make a function in
scheme that splits on | and transforms my input into your example then?
I don’t think that can work, unless your \parallelMusicExtended function
took a string as its second argument and preprocessed that string before
handing it to the LilyPond parser as LilyPond syntax (using one of the
ly:parser… scheme functions, been ages since I used them). But then this
long string would be extremely unwieldy as input, so I can’t imagine
that being worth it.
Another very quick stab at explaining: In the “pseudo-code” you sent,
the parser would already interpret the whole second argument to the
\parallelMusicExtended function using notemode before the music function
ever got to manipulate it. So in this:
\parallelMusicExtended #'((chordmode . chords) voiceA (lyricmode .
lyricsOne) (lyricmode . lyricsTwo)) {
c2. |
c2 e8 c |
ma -- zing __ _ |
grace that __ _ |
}
the first C would be read as a note C, and then the lyric syllables
would throw errors because they’re not valid note names.
For me, in situations like that (where I’m tempted to write some sort of
function to simplify LilyPond code), I usually end up choosing the
slightly more “wordy”, but standard, input syntax and think about how to
make the inputting itself easier. Depending on your setup, the tools you
use for typing and coding, and other personal preference it could mean
simple copy & paste, search & replace, or more advanced stuff with
regex, macro programming etc.
Best, simon