Skip to content

Commit

Permalink
totally revamp synchronization algorithm for significant improvement
Browse files Browse the repository at this point in the history
We now take a radically different approach to synchronization:
rather than brittle heuristics in ly2video, we tweak the .ly source
so that LilyPond gives us all the data we need for synchronization.
For each grob, it outputs paper positions, timing, and origin within
the source file.  Then for each moment in which one or more grobs
occur, the leftmost grob is used to determine the position at which
the video frame will be focused during that moment.

This is far more robust, so we no longer require special handling
for ties, grace notes, chord names, chords which have note heads
on either side of the stem, etc.

A big thank-you to Jan for helping with this!

Fixes the following issues:

  #5  - music written with \partial command can cause a lot of bugs
  #14 - articulate.ly should not have to be disabled
  #16 - ChordNames break synchronization
  #23 - \turn breaks synchronization

#5
#14
#16
#23
  • Loading branch information
aspiers committed Feb 7, 2013
1 parent 1667aa9 commit c2ab06e
Show file tree
Hide file tree
Showing 3 changed files with 288 additions and 493 deletions.
9 changes: 9 additions & 0 deletions README.md
Expand Up @@ -72,6 +72,15 @@ in the `doc/thesis/` subdirectory, or
an English translation has begun but is unlikely to be finished any
time soon unless someone else volunteers to help out.

Very big thanks also to Jan Nieuwenhuizen not only for co-inventing
LilyPond in the first place, but also for helping me implement the
complete revamp of the synchronization algorithm, which should be
much more robust than the previous one.

And finally of course, much gratitude to the many great people who
have contributed to LilyPond over the years. This would not have
been possible without you.

## License

ly2video is released under the [GNU GPL v3](http://www.gnu.org/licenses/gpl.html).
6 changes: 3 additions & 3 deletions ly/tokenize.py
Expand Up @@ -817,7 +817,7 @@ class ChangeList(object):
def __init__(self, text):
self._changes = []
# maps (line, column) tuples to new text
self._token_changes_by_coords = {}
self.token_changes_by_coords = {}
self._text = text

def replace(self, pos, end, text):
Expand All @@ -827,7 +827,7 @@ def replace(self, pos, end, text):
def replaceToken(self, token, text):
if token != text:
self._changes.append((token.pos, token.end, text))
self._token_changes_by_coords[(token.line, token.column)] = text
self.token_changes_by_coords[(token.line, token.column)] = text

def remove(self, pos, end):
self._changes.append((pos, end, None))
Expand Down Expand Up @@ -856,7 +856,7 @@ def newTextForLineColumn(self, line, column):
Return the replacement text for a token at the given line and
column, or None if the token has no change.
"""
return self._token_changes_by_coords.get((line, column))
return self.token_changes_by_coords.get((line, column))

def apply(self):
"""
Expand Down

0 comments on commit c2ab06e

Please sign in to comment.