*TL;DR:*

Thanks to everyone for your replies! Timothy: your code was pure magic —
thank you! David: all my scripts are public, though not reusable; they're
just experimental scaffolding.
------------------------------

Dear all,

I'm very grateful for the thoughtful responses to my message — thank you
for taking the time to read, reply, and even share code.
To *Timothy Lanfear*

Your attached example was *pure magic* — sincerely, thank you.

The elegance of your solution (adding id attributes to note heads
corresponding to MIDI time) is exactly the kind of minimal intervention I
had in mind. Reading your code was a joy — and a moment of humility. You
were right: there's a lot to learn to extend LilyPond meaningfully.

Still, I didn’t give up entirely. With plenty of trial and error (and some
help from ChatGPT and Claude AI), I managed to build on your idea to add
similar output properties to *bar lines*, so I could dynamically highlight
the currently playing measure — just as a learning exercise.

That said… hours into the rabbit hole, I *accidentally* discovered that
LilyPond already has a *Staff_highlight_engraver* that might have saved me
all that effort — though I still haven’t quite figured out how to use it
properly.
To *David Pirotte*

All the scripts I wrote are public here:

📂 https://github.com/cthiebaud/bwv1006

A word of caution, though: they’re not meant for general use or reuse.
They’re not structured, documented, or even consistently sane — more like
rough "exercise notebooks" I used to test ideas and workflows. They might
be useful as raw reference, but not as a clean base to build from.

That said, if you want to see how I wired MIDI and SVG together in the
browser, I’d be glad to walk you through the basics. It’s all fairly hacky
— but possibly inspirational.

Thanks again to everyone — it’s been a pleasure to exchange with this
community.

Warm regards from Bologna,
*Christophe Thiebaud*
------------------------------

📀 *Project site:* https://bwv1006.cthiebaud.com
🧪 *Codebase:* https://github.com/cthiebaud/bwv1006

On Wed, May 21, 2025 at 5:43 PM David Pirotte <[email protected]> wrote:

> Hello,
>
> > I would say your first instinct was right, although there is a lot to
> > learn and understand when extending LilyPond. The attached example
> > adds an id attribute to note heads, where the id value corresponds to
> > the midi time. More information could be added to the id, such as the
> > staff or voice where the note appears. Maybe this is enough for you
> > to correlate the SVG and MIDI files.
>
> What script do you use to play the midi file and animate the svg 'in
> parallel'?
>
> I am a 'total newbie' wrt this domain, but I'd like to learn about how
> to implement such a functionality, for a tiny app I am currently
> writing, using guile and gtk: hints, and/or tutorial links welcome ...
>
> Thanks,
> David
>

Reply via email to