John Mandereau [Sat, 22 Sep 2007 15:33:25 +0000 (17:33 +0200)]
Copy notation.itely into translated docs
'make web' is expected to fail, because I haven't reorganized actual
contents of translated docs. I'll most probably do this tomorrow;
then the translated docs will be hopefully synced.
-) Depending on the staff attributes, create TabStaff/TabVoice,
DrumStaff/DrumVoice, RhythmicStaff/Voice or ordinary Staff/Voice
staves.
-) From the staff attributes, create the list of string tunings
for tab staves.
These two points were all that was missing for proper tablature support.
As an implementation detail, I changed all the keys in the dicts from
the full part objects to the part ID (which is also used in the part-list
element in Lilypond, so we can do proper assignments now).
Implement some more conversions for articulations, make \context Staff
actually use the type attribute instead of hard-coded "Staff", fix crashes
due to empty type attributes in articulations.
For tab staves and voices, we will need to convert the <string> number
to lilypond to lilypond's \1, ..., \6 commands. So far, the tab staff
is not yet created, so these commands do not have any effect yet, but
they will be needed in the near future.
MusicXML: Correctly convert nested staff/part groups
In MusicXML, part group nesting is done simply by inserting
start/stop markers in the list of parts, where the part groups
might even overlap. In Lilypond, we want the real hierarchy (so
that we can assign group names etc.). To achieve this, we need
to loop through all parts, trying to detect the correct start/stop
markers. What makes things even more complicated is the fact
that the group IDs don't have to the unique in the whole score,
just unique enough to describe overlapping part groups. The other
issue are overlapping part groups, which we need to split up into
a part, which fits into the hierarchy and the remaining part, which
we simply ignore.
MusicXML: Cleanup voice handling and fix lyrics order for multiple stanzas
So far, multiple stanzas were handled by a dict, indexed by the voice ID.
However, the order of the elements in a dict is not defined (in particular,
the order is not preserved), so the stanzas got reordered and lost their
sorting.
Furthermore, each voice (with the associated lyrics and the raw data) was
handled by nested lists, which were really complicated to work with (since
one always had to remember the structure of these lists). I now use a
class/struct instead for each voice, which is much more intuitive!
MusicXML: Fix problem with lyrics on notes with grace notes
When a note had grace notes (and it was tied or part of a slur), sometimes
the lyrics for that note were completely ignored and all subsequent
lyrics were one note off. Now I simply ignore all slurs/ties of grace notes
and everything works just fine.
Also, clean up the staff change code. Now a staff change is not only applied
before a note, but also before other stuff (like clef change).
When we encounter a note with a different staff value than the
previous note in that voice, simply add the \change Staff=.. event
into the notes. However, this does not work inside chords, so we
ignore all staff changes inside chords. I'll have to find a different
way to print some notes of a chord on one staff and the other notes
on the other staff...
MusicXML: Fix problems with chord detection and pickup measures
Pickup measures messed up chord detection and voice start positions
for multi-voice parts, because I erroneously reset the position after
a pickup measure to 1, while in fact it should have been the length
of the pickup measure!
Also, fix some typos and only ignore skips in pickup measures intended
for padding to a full measure. Explicitly adde skips need to be honored.
-) Sometimes the contents of the first volta was duplicated (once
before and the second time inside the first volta). The cause
was theat I forgot an if clause to mark the repeat's body finished
when the first volta ending is encountered
-) I messed up the order of the repeat/ending markers in the output.
MusicXML: Fix small problems with assignment <harmony> <=> voice
Oops, I didn't want to treat <direction > elements like <harmony>.
The direction elements should still be asssigned to all voices (or
all voices of the staff).
Also, at the end of the loop, assign all remaining <harmony> elements
to the voice of the previous note and don't simply discard it.
Instead of assigning <harmony> elements to every voice or only the very
first voice (in the frist case, we'll have duplicated frets, in the
second one the fretboards will often be inserted at the completely
wrong position), simply insert the fretboard into the next note that
we encounter in the MusicXML file.
I suppose we could also do something similar for text markup (i.e.
<direction><words>...</word></direction>), but there we need to
distinguish direction elements with words-only subelements and with
dynamics subelements.
MusicXML: Convert fretboards from MusicXML to Lilypond
In MusicXML, fretboards are inside <harmony> elements, assigned
to a particular staff, while in lilypond the \fret-diagram is a
text markup assigned to a particular note. So we run into the same
problems as we do with dynamics (i.e. we need to find a proper
note to assign the element to, which is not very robust). For
single-voice harmony, this works quite well so far.
I forgot to reset the is_tied flag, so after a tie, no lyrics would be
printed out any more (the second note of a tie is in a melisma and does
not use any lyrics syllables in lilypond - Of course only if it is
really a tied note...).
MusicXML: Also finish repeats that do not have an explicit ending bar
Some musicXML examples just display the first page of a multi-page score.
Sometimes a repeat occurs on these pages with no ending bar (which would
follow on a subsequent page). Simply finish the \repeat sequence at the
very end of the page.
MusicXML: Fix lyrics on chords, ignore lyrics for notes inside melismata
The lyrics detection code so far ignored chords (ie. it added a \skip for
every additional note in the chord). Now I simply ignore all subsequent
notes and the corresponding syllables for the lyrics.
By default, lilypond does not add lyrics to notes in melismata (i.e.
tied notes and notes inside slurs), so while walking through all notes,
we need to check whether we are inside a slur, a tie or a grace note
and simply ignore the lyrics on these notes.
There are some scores, which still put lyrics on notes inside slurs, so
in the future, I'll also add a way to set/unset ignoreMelismata, but
that's left for the future.
MusicXML: Convert colors in text markup using \with-color #(rgb-color ...)
Now that we have the rgb-color scheme function in git, make use of it in
text markup conversion. In MusicXML, the color is given as #AARRGGBB
or #RRGGBB, we simply ignore the alpha channel, extract the r, g and b
values and scale them to the 0.0 - 1.0 range
MusicXML: Convert some more text markup attributes
Convert italics, better font sizes. Unfortunately, I don't know
how to convert RGB colors to x-colors used by lilypond, so colors
are not converted. Similarly, font families are not converted, mainly
because I don'tknow the correct lilypond expression for this.
Underline, overline and strike-through don't seem to be supported
by lilypond at all :-(
MusicXML: Convert words, assigned to staves => assign to notes in Lilypond
In MusicXML, words are represented in direction elements, in Lilypond, they
are assigned to notes....
Also try to convert as many font attributes as possible (several are still
missing, currently only text-size and text-wight are supported)