nCoda Lychee Docs

Abjad

Convert a Lychee-MEI document to an Abjad document.

Warning

This module is intended for internal Lychee use only, so the API may change without notice. If you wish to use this module outside Lychee, please contact us to discuss the best way.

Tip

We recommend that you use the converters indirectly. Refer to How to Use the Converters for more information.

Note

This is an outbound converter that does not emit signals directly. Refer to the lychee.signals.outbound module for more information.

lychee.converters.outbound.__abjad.append_accidental(mei_note)[source]

Create an MEI note’s corresponding Lilypond accidental string.

Parameters:mei_note (lxml.etree.ElementTree.Element) – the MEI note to interrogate for accidental information.
Returns:the corresponding Lilypond accidental string.
Return type:string
lychee.converters.outbound.__abjad.chord_to_chord(mei_chord)[source]

Convert an MEI chord Element into an Abjad Chord.

Parameters:mei_chord (lxml.etree.ElementTree.Element) – the MEI chord Element to convert.
Returns:the corresponding Abjad Chord.
Return type:abjad.tools.scoretools.Chord.Chord
lychee.converters.outbound.__abjad.convert(document, **kwargs)[source]

Convert an MEI document into an Abjad document.

Parameters:document (lxml.etree.ElementTree.Element or lxml.etree.ElementTree.ElementTree) – The MEI document.
Returns:The corresponding MEI document.
Return type:object
Raises:lychee.exceptions.OutboundConversionError when there is a forseeable error.
lychee.converters.outbound.__abjad.convert_accidental(mei_accidental_string)[source]

Convert an MEI accidental string into an Abjad accidental string.

Parameters:mei_accidental_string (string) – the MEI accidental string to convert.
Returns:the corresponding Abjad accidental string.
Return type:string
lychee.converters.outbound.__abjad.element_to_leaf(mei_element)[source]

Convert an MEI leaf Element to the corresponding Abjad leaf.

Parameters:mei_element (lxml.etree.ElementTree.Element) – the MEI Element to convert.
Returns:the corresponding Abjad leaf.
Return type:abjad.tools.scoretools.Leaf.Leaf
lychee.converters.outbound.__abjad.get_tuplet_duration(mei_tupletspan)[source]

Generate an Abjad Duration by querying information from an MEI tupletspan Element.

Parameters:mei_tupletspan (lxml.etree.ElementTree.Element) – the MEI tupletspan Element to query for duration.
Returns:an Abjad Duration with mei_tupletspan’s duration.
Return type:abjad.tools.scoretools.Duration.Duration
lychee.converters.outbound.__abjad.layer_to_voice(mei_layer)[source]

Convert an MEI layer Element into an Abjad Voice container.

Parameters:mei_layer (lxml.etree.ElementTree.Element) – the MEI layer Element to convert.
Returns:the corresponding Abjad Voice.
Return type:abjad.tools.scoretools.Voice.Voice
lychee.converters.outbound.__abjad.make_abjad_note_from_string(the_string, mei_note)[source]

Append duration informtion from an MEI note to a Lilypond pitch-octave string to create an Abjad Note.

Parameters:
  • the_string (string) – the Lilypond pitch-octave string to append duration information to.
  • mei_note (lxml.etree.ElementTree.Element) – the MEI note to query for duration information.
Returns:

an Abjad Note.

Return type:

abjad.tools.scoretools.Note.Note

lychee.converters.outbound.__abjad.note_to_note(mei_note)[source]

Convert an MEI note Element into an Abjad Note.

Parameters:mei_note (lxml.etree.ElementTree.Element) – the MEI note Element to convert.
Returns:the corresponding Abjad Note.
Return type:abjad.tools.scoretools.Note.Note
lychee.converters.outbound.__abjad.octave_integer_to_string(octave_integer)[source]

Convert an octave integer to the corresponding Lilypond tick string. See the Lilypond docs for explanation octave representation via apostrophes and commas.

Parameters:octave_integer (integer) – the octave integer to convert.
Returns:the corresponding Lilypond tick string (either apostrophes, empty, or commas).
Return type:string
lychee.converters.outbound.__abjad.rest_to_rest(mei_rest)[source]

Convert an MEI rest Element into an Abjad Rest.

Parameters:mei_rest (lxml.etree.ElementTree.Element) – the MEI rest Element to convert.
Returns:the corresponding Abjad Rest.
Return type:abjad.tools.scoretools.Rest.Rest
lychee.converters.outbound.__abjad.section_to_score(mei_section)[source]

Convert an MEI section Element into an Abjad Score container.

Parameters:mei_section (lxml.etree.ElementTree.Element) – the MEI section Element to convert.
Returns:the corresponding Abjad Score container.
Return type:abjad.tools.scoretools.Score.Score
lychee.converters.outbound.__abjad.set_cautionary(abjad_note, mei_note)[source]

Set an Abjad Note’s cautionary accidental attribute to true if the MEI note parents a child, assumed to be an accidental Element; returns the Note.

Parameters:
  • abjad_note (abjad.tools.scoretools.Note.Note) – the Abjad Note to consider setting.
  • mei_note (lxml.etree.ElementTree.Element) – the MEI note to interrogate for a child.
Returns:

the modified Abjad Note.

Return type:

abjad.tools.scoretools.Note.Note

lychee.converters.outbound.__abjad.set_forced(abjad_note, mei_note)[source]

Set an Abjad Note’s forced accidental attribute to true if the MEI note has an ‘accid’ attribute; returns the Note.

Parameters:
  • abjad_note (abjad.tools.scoretools.Note.Note) – the Abjad Note to consider setting.
  • mei_note (lxml.etree.ElementTree.Element) – the MEI note to interrogate for an ‘accid’ attribute.
Returns:

the modified Abjad Note.

Return type:

abjad.tools.scoreetools.Note.Note

lychee.converters.outbound.__abjad.space_to_skip(mei_space)[source]

Convert an MEI space Element into an Abjad Skip.

Parameters:mei_space (lxml.etree.ElementTree.Element) – the MEI space Element to convert.
Returns:the corresponding Abjad Skip.
Return type:abjad.tools.scoretools.Skip.Skip
lychee.converters.outbound.__abjad.staff_to_staff(mei_staff)[source]

Convert an MEI staff Element into an Abjad Staff container.

Parameters:mei_staff (lxml.etree.ElementTree.Element) – the MEI staff Element to convert.
Returns:the corresponding Abjad Staff.
Return type:abjad.tools.scoretools.Staff.Staff
lychee.converters.outbound.__abjad.tupletspan_element_to_empty_tuplet(mei_tupletspan)[source]

Convert an MEI tupletspan Element into an empty Abjad Tuplet. An MEI tupletspan with ‘num’ and ‘numBase’ attributes but no duration yields a Tuplet object. A durated MEI tupletspan without ‘num’ and ‘numBase’ attributes yields a Tuplet object.

Parameters:mei_tupletspan (lxml.etree.ElementTree.Element) – the MEI tupletspan Element to convert.
Returns:the corresponding empty Abjad Tuplet.
Return type:abjad.tools.scoretools.Tuplet.Tuplet
lychee.converters.outbound.__abjad.tupletspan_to_tuplet(mei_tupletspan)[source]

Convert an MEI tupletspan to an Abjad Tuplet object. A tupletspan Element converts into an empty Tuplet, while a list beginning with a tupletspan element and followed by some number of leaf Elements converts into an Abjad Tuplet object full of the following components.

Parameters:mei_tupletspan (list or lxml.etree.ElementTree.Element) – the MEI tupletspan to convert.
Returns:corresponding Abjad Tuplet.
Return type:abjad.tools.scoretools.Tuplet.Tuplet