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)
MusicXML: Implement Barline styles and repeats in musicxml2ly
-) The <barline> element is now converted to a \bar"...." lilypond
expression. Not all bar styles from MusicXML are supported by lilypond,
though.
-) Convert repeats and alternative endings from MusicXML to lilypond.
While lilypond has a nice hierarchy (i.e. nested music) for repeating
structures, MusicXML only has markers "here starts/ends a repeat or
altern.ending", so I need to somehow build up that repeat hierarchy
from the flat data. I've imlemented this via a loop that looks for
a repeat structure, replaces that one repeat by a proper instance
of musicexp.RepeatedMusic. Since I directly modify the list of
event chords, after replacing one repeat, I have to start the
whole loop from the start (because the iterators are off after
the list is modified).
-) Add some more unit test files for barlines and repeating structures
(some even do not make sense from a musical point of view)
-) Fix typo in the coverage/regression tests make file
Mats Bengtsson [Mon, 15 Oct 2007 13:59:26 +0000 (15:59 +0200)]
Use the collapse-height mechanism also for SystemStartBar.
Makes it possible to get a bar line at the left end of the
stave also for single stave scores.
MusicXML: Fix wrong chord detection with mid-measure attributes
Mid-measure attributes (like clef changes) need to be inserted as
commands, not as music, because that will reset the current measure
position and mess up chord detection for the following notes.
MusicXML: Support for upbeats and partial/implicit measures
-) In the Duration class, don't write out e.g. *3/1 for the factor.
In this case, *3 is much better
-) Add support for implicit measures, i.e. measures in MusicXML that do
not count. These are typically used for upbeats and for places where
a repeat or clef/key change occurs inside a measure. In this case,
the measure is split into to <measure> elements, the second one with
the implicit attribute set to "yes". Now we don't start a measure
in lilypond for those implicit measures.
-) Implicit measures at the very beginning are now converted as \partial X
-) Don't print out | %0 at the very beginning (i.e. for the measure with
number 0)
Signed-off-by: Reinhold Kainhofer <reinhold@kainhofer.com>
Joe Neeman [Fri, 5 Oct 2007 23:55:33 +0000 (09:55 +1000)]
Fix 411, 412 and 445.
Exclude VerticalAxisGroup 'minimum-Y-extent from the skyline, but include it in
align-interface calculations. Reinstate minimum-Y-extent in Staff.
Allow header/footer snippets in test cases, expand lilypond-book to insert versionnumber
-) Add --introduction=.. and --footer=.. options to lys-to-tely.py so that we
can insert custom text form a texi file at the beginning and end of a
regression test page. So far, one had to add a .ly file with a proper name
(so that it gets sorted to the begin/end), which resulted in an ugly empty
image and a link to a dummy .ly file at the top. The header for the
lys-to-tely script must not be called *.texi, because make WWW tries to
run makeinfo on all *.texi files.
-) Change the buildsystem to use these additional parameters. The make variables
HEADER_FILE and FOOTER_FILE are used for this.
-) Change the regression tests to make use of the texi file rather than the
AAA-intro-regression.ly file
-) Since that header contained the lilypond version number, I also expanded
lilypond-book to replace @lilypondversion (or the \lilypondversion and
<lilypondversion> counterparts for latex and html) by the version. The
build must then use the lilypond-book script from scripts/out/ rather
than scripts/lilypond-book.py (which does not have the @VERSION_NUMBER@
replaced by the version by the build system).
-) Add the bass drum instrument
-) Ignore notes with the attribute print-object="no". These are
typically notes that indicate midi output for tremolos and should
not be printed.
-) Use the Musix_xml_node.message method to print out the warning about
missing note types. This also prints out where the problem occurs.
Signed-off-by: Reinhold Kainhofer <reinhold@kainhofer.com>
Instead of keeping an array of grace elements for each chord,
rather use a full SequentialMusic object that holds EventChords
(so we can insert beams, real grace chords, etc.). For this we also
need a method in the SequentialMusic class to get the last chord.
Depending on the slash attribute of the <grace> element, we now
use acciaccatura rather than grace for slashed grace notes.
Signed-off-by: Reinhold Kainhofer <reinhold@kainhofer.com>
If a score does not use any <staff> elements, fool musicxml2ly with
a dummy value of "None". Similarly, don't use dict[staff], but dict.get
to avoid crashes in that case.
Signed-off-by: Reinhold Kainhofer <reinhold@kainhofer.com>
MusicXML: Apply Attributes and Direction only to the staves/voices they apply to
When extracting the voices of a part, first detect all different voices so that
we can assign dynamics to all voices right from the beginning.
Also, assign the dynamics and attributes only to those voices they really apply
to (in particular, if they have a <staff> element, only assign them to the voices
that use that particular staff). For this, I also need to keep a dict for
staff=>[voiceids,...] around. To be able to assign attributes only to the
correct voices, I need to copy the attributes object and erase all clefs, times
and keys that do not apply to the staff (and keep only those objects that either
have no number attribute or have the correct number attribute). This copying
(shallow copying of the relevant parts of the Attributes object) gave me some
major headache, but it should work fine now.
Signed-off-by: Reinhold Kainhofer <reinhold@kainhofer.com>
MusicXML: A grace note at the beginning shall not set staff for the voice
The sample files from Recordare contain a piece where the voice on the
upper staff of a PianoStaff starts with a grace displayed in the second
staff. So far, this put the whole voice on the second staff. Thus, grace
notes are now ignored when determining the voice for a staff.
Signed-off-by: Reinhold Kainhofer <reinhold@kainhofer.com>
MusicXML: Staves with multiple voices get \voiceOne and \voiceTwo
When a staff has more than one voice, we get tons of colliding stems, so
put \voiceOne in the first voice and \voiceTwo in the remaining. This
still breaks with more than two voices, but the majority of cases works
fine now.
Signed-off-by: Reinhold Kainhofer <reinhold@kainhofer.com>
MusicXML: Implement part-group (i.e. StaffGroup in ly) and part-name (instrumentName)
Implementing part-groups and their bracketing and span-bars turned out
harder than I imagined... I build one nested set of StaffGroup and Staff
objects from the part-list, including the instrument names and the bracket
types. However, to be able to distinguish single-staff staves and piano
staves and to assign the correct voices and lyrics to a part, I need
another loop after everything has been processed. In this additional
loop through the whole score structure I extract the voice and lyrics
ids assigned to each part and assign them the StaffGroup nested
objects.
Finally, printing everything out is quite simple.
Signed-off-by: Reinhold Kainhofer <reinhold@kainhofer.com>
MusicXML: Convert grace notes from MusicXML to Lilypond
Grace notes are normal <note> elements in XML, only with a <grace/>
child element. I append these notes to a special array of EventChord
and try to take care of the zero duration of grace notes (which
come before the real note and thus also create the EventChord with
duration zero!)
There is still one problem with things like beams or articulations on
grace notes (they are printed after the whole cord (not inside the
\grace!), but this is a general problem that musicxml2ly inserts
slurs, ties, beams, articulations, etc. as separate events not assigned
to any particular note/EventChord. The code should be changed to
assign these ornaments/settings directly to the note or the chord they
apply to. This would (1) get rid of e.g. triple [ with beamed chords,
(2) make it possible to combine multiple MusicXML articulations into
single lilypond articulations, (3) apply fingerings and ties to notes
inside chords rather than the whole chord, and (4) fix the grace notes.
The other problem is when a chord is used as a grace chord in MusicXML.
Due to the whole structure of musicxml2ly, this problem goes very deep
and I don't know of any way to fix this short of a big rewrite.
Signed-off-by: Reinhold Kainhofer <reinhold@kainhofer.com>
In MusicXML, a rest can also have a pitch, given as
<display-step>A</display-step><display-octave>3</display-octave>
If given, convert these into ordinary lilypond pitches and print them
out as "a4 \rest" instead of "r4".
Signed-off-by: Reinhold Kainhofer <reinhold@kainhofer.com>
MusicXML: Reset measure position on backup elements, print => sys.stderr.write
-) Replace all relevant (i.e. non-testing outputs; these are still in there
in the main() functions for testing) occurrences of print by
sys.stderr.write
-) If a <backup> element is encountered (e.g. when there are two voices in
the measure), correctly reset the measure position to the desired
position after the backup.
Signed-off-by: Reinhold Kainhofer <reinhold@kainhofer.com>
MusicXML: Fix regression when adding expressions like octave shifts
Octave shifts in lilypond (like in MusicXML) are not associated with a
particular note but their position in the measure. So far, I simply
inserted them like a note, but unfortunately that reset the current
starting position in the measure (needed to find the correct position
for chords). So I added a method dedicated to inserting such commands
without resetting the position (of course, pending multi-bar rests
still need to be inserted before the music command).
Signed-off-by: Reinhold Kainhofer <reinhold@kainhofer.com>