Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChordNames break synchronization #16

Closed
aspiers opened this issue Jan 19, 2013 · 4 comments
Closed

ChordNames break synchronization #16

aspiers opened this issue Jan 19, 2013 · 4 comments
Assignees
Labels

Comments

@aspiers
Copy link
Owner

aspiers commented Jan 19, 2013

The ChordNames context does not have an impact on MIDI rendering in LilyPond, but it does result in multiple note events being rendered as a single text grob (e.g. "Eb-7") whose PDF annotation links back to a location in the .ly source which looks like a normal note e.g. ef1:m9, which the tokenizer currently cannot distinguish from a normal note.

This makes it almost impossible for the synchronization algorithm to work. It's cleaner just to remove chords from the equation. This can easily be done with the MIDI by creating a separate \score which excludes the chords, but they still appear in the PDF.

@ghost ghost assigned aspiers Jan 19, 2013
@aspiers
Copy link
Owner Author

aspiers commented Jan 19, 2013

I kicked off a thread on lilypond-user about this, and eventually discovered that it's possible to hack the definition of the grob-cause function in LilyPond's output-ps.scm, since

(assoc-get 'name (ly:grob-property grob 'meta))

will return 'ChordName when the grob is a ChordName. This can then be used to avoid generating point-and-click annotations for chord names. It may also be possible to do it by making the tokenizer smarter, but it would probably have to be able to convert chords like ef1:m9 into the full set of notes which would appear in the MIDI, which would require reinventing the LilyPond chord handling wheel.

@aspiers
Copy link
Owner Author

aspiers commented Jan 21, 2013

Moving this to 0.3 due to the available workaround, i.e. exclude the chords from MIDI generation, and hack output-ps.scm to avoid annotating ChordNames. I'll aim to convert the latter hack into a more elegant solution involving \pointAndClickTypes or similar, and push it back upstream.

@aspiers
Copy link
Owner Author

aspiers commented Feb 4, 2013

I have an even better solution cooking, thanks to Jan Nieuwenhuizen who I met at FOSDEM and who helped me implement it! It's in the spacetime branch, but not quite there yet.

aspiers added a commit that referenced this issue Feb 7, 2013
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
@aspiers aspiers closed this as completed Feb 7, 2013
@aspiers
Copy link
Owner Author

aspiers commented Feb 7, 2013

For reference, here's the key Scheme code at the heart of the new algorithm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant