|
From: | Mathieu Demange |
Subject: | Re: Introducing "LilyPond HTML Live Score" |
Date: | Mon, 30 Nov 2015 14:56:08 +0100 (CET) |
Hi Richard,
The ideal approach would have been to have a timing information directly inserted in the svg output by LilyPond itself but I tried everything I could to obtain such a result with no luck. I posted here about that topic but I didn't get any clue.
So I figured out I'd do it myself.
I was able to set a grob's ID dynamically and put its "origin" (point and click information) in it : that was a way to later reference a unique notehead or rest.
On the other side, the event listener (based on the event-listener.ly file bundled with LilyPond) allowed me to get an approximate timing information and another "origin" which I could then couple to the first one.
I say "approximate" because the event listener itself seems imperfect to me (even though I'm glad it exist, of course). The "moment" value is always computed on a 4/4 time signature basis, even if specified otherwise. Time signatures events themselves are not reported even though there's a listener for that. Anyway, I got rid of those little things by calculating timing data myself.
In the python script, I'm basically keeping track of a current tempo and use delta-time computations over note and rest events to calculate their real timing.
The script then injects extra HTML5 attributes to the svg code.
The _javascript_ part gather all noteheads and rests <g> tags and creates an array of objects which is then sorted chronologically (svg objects are laid out in a way which is not chronological at all).
Hope this answers even partially to your curiosity :)
I really appreciate your feedback and I'm happy to have reasons to keep working on that tool other than myself only :)
Cheers,
Mathieu
On Sun, 2015-11-29 at 19:08 +0100, Mathieu Demange wrote:
> Hello all,
>
> I've been developing a tool which is at a very early stage now, but I
> humbly guess you should like the idea. Check this very simple page and
> click the "play" button (or you can click any note or rest).
I wonder could you give a brief over-view of how you are finding
locations in the LilyPond typeset score that correspond with times?
I ask because by strange coincidence I have just spent the last few days
exploring this topic: I resorted to specifying the number of bars per
line and systems per page and setting the
Score.proportionalNotationDuration = #(ly:make-moment ...
so as to arrive at a score where I could calculate the location by
dead-reckoning.
Could you say, very roughly, what you are doing?
And, if there has been any further progress in LilyPond to generate a
set of timings for locations in a LilyPond svg or pdf output score which
I may have missed, can anyone else on the list enlighten me.
Richard
[Prev in Thread] | Current Thread | [Next in Thread] |