mutwo.converters.frontends.ekmelily¶
Build tuning files for Lilypond extension Ekmelily.
By default the smallest step which Lilypond supports is one quartertone. With the help of Ekmelily it is easily possible to add more complex micro- or macrotonal tunings to Lilypond. The converter in this module aims to make it easier to build tuning files to be used with the ‘ekmel-main.ily’ script from Thomas Richter.
Disclaimer:
For now the converters only support making notation tables for English note names.
Classes:
|
Representation of an Ekmelily accidental. |
|
Build Ekmelily tuning files from Ekmelily accidentals. |
|
Build Ekmelily tuning files for Helmholtz-Ellis JI Pitch Notation. |
- class EkmelilyAccidental(accidental_name, accidental_glyphs, deviation_in_cents, available_diatonic_pitch_indices=None)[source]¶
Bases:
objectRepresentation of an Ekmelily accidental.
- Parameters
accidental_name (str) – The name of the accidental that follows after the diatonic pitch name (e.g. ‘s’ or ‘qf’)
accidental_glyphs (typing.Tuple[str, ...]) – The name of accidental glyphs that should appear before the notehead. For a list of available glyphs, check the documentation of Ekmelos. Furthermore one can find mappings from mutwo data to Ekmelos glyph names in
PRIME_AND_EXPONENT_AND_TRADITIONAL_ACCIDENTAL_TO_ACCIDENTAL_GLYPHandTEMPERED_ACCIDENTAL_TO_ACCIDENTAL_GLYPH.deviation_in_cents (float) – How many cents shall an altered pitch differ from its diatonic / natural counterpart.
available_diatonic_pitch_indices (typing.Optional[typing.Tuple[int, ...]], optional) – Sometimes one may want to define accidentals which are only available for certain diatonic pitches. For this case, one can use this argument and specify all diatonic pitches which should know this accidental. If this argument keeps undefined, the accidental will be added to all seven diatonic pitches.
- Return type
None
Example:
>>> from mutwo.converter.frontends import ekmelily >>> natural = ekmelily.EkmelilyAccidental('', ("#xE261",), 0) >>> sharp = ekmelily.EkmelilyAccidental('s', ("#xE262",), 100) >>> flat = ekmelily.EkmelilyAccidental('f', ("#xE260",), -100)
Attributes:
- accidental_glyphs: Tuple[str, ...]¶
- accidental_name: str¶
- available_diatonic_pitch_indices: Optional[Tuple[int, ...]] = None¶
- deviation_in_cents: float¶
- class EkmelilyTuningFileConverter(path, ekmelily_accidentals, global_scale=None)[source]¶
Bases:
mutwo.converters.abc.ConverterBuild Ekmelily tuning files from Ekmelily accidentals.
- Parameters
path (str) – Path where the new Ekmelily tuning file shall be written. The suffix ‘.ily’ is recommended, but not necessary.
ekmelily_accidentals (typing.Sequence[EkmelilyAccidental]) – A sequence which contains all
EkmelilyAccidentalthat shall be written to the tuning file,global_scale (typing.Tuple[fractions.Fraction, ...], optional) – From the Lilypond documentation: “This determines the tuning of pitches with no accidentals or key signatures. The first pitch is c. Alterations are calculated relative to this scale. The number of pitches in this scale determines the number of scale steps that make up an octave. Usually the 7-note major scale.”
Example:
>>> from mutwo.converter.frontends import ekmelily >>> natural = ekmelily.EkmelilyAccidental('', ("#xE261",), 0) >>> sharp = ekmelily.EkmelilyAccidental('s', ("#xE262",), 100) >>> flat = ekmelily.EkmelilyAccidental('f', ("#xE260",), -100) >>> eigth_tone_sharp = ekmelily.EkmelilyAccidental('es', ("#xE2C7",), 25) >>> eigth_tone_flat = ekmelily.EkmelilyAccidental('ef', ("#xE2C2",), -25) >>> converter = ekmelily.EkmelilyTuningFileConverter( >>> 'ekme-test.ily', (natural, sharp, flat, eigth_tone_sharp, eigth_tone_flat) >>> ) >>> converter.convert()
Methods:
convert()Render tuning file to
path.
- class HEJIEkmelilyTuningFileConverter(path=None, prime_to_highest_allowed_exponent=None, reference_pitch='c', prime_to_heji_accidental_name=None, otonality_indicator=None, utonality_indicator=None, exponent_to_exponent_indicator=None, tempered_pitch_indicator=None)[source]¶
Bases:
mutwo.converters.frontends.ekmelily.EkmelilyTuningFileConverterBuild Ekmelily tuning files for Helmholtz-Ellis JI Pitch Notation.
- Parameters
path (str) – Path where the new Ekmelily tuning file shall be written. The suffix ‘.ily’ is recommended, but not necessary.
prime_to_highest_allowed_exponent (typing.Dict[int, int], optional) – Mapping of prime number to highest exponent that should occur. Take care not to add higher exponents than the HEJI Notation supports. See
DEFAULT_PRIME_TO_HIGHEST_ALLOWED_EXPONENTfor the default mapping.reference_pitch (str, optional) – The reference pitch (1/1). Should be a diatonic pitch name (see
ASCENDING_DIATONIC_PITCH_NAMES) in English nomenclature. For any other reference pitch than ‘c’, Lilyponds midi rendering for pitches with the diatonic pitch ‘c’ will be slightly out of tune (because the first value of global_scale always have to be 0).prime_to_heji_accidental_name (typing.Dict[int, str], optional) – Mapping of a prime number to a string which indicates the respective prime number in the resulting accidental name. See
DEFAULT_PRIME_TO_HEJI_ACCIDENTAL_NAMEfor the default mapping.otonality_indicator (str, optional) – String which indicates that the respective prime alteration is otonal. See
DEFAULT_OTONALITY_INDICATORfor the default value.utonality_indicator (str, optional) – String which indicates that the respective prime alteration is utonal. See
DEFAULT_OTONALITY_INDICATORfor the default value.exponent_to_exponent_indicator (typing.Callable[[int], str], optional) – Function to convert the exponent of a prime number to string which indicates the respective exponent. See
DEFAULT_EXPONENT_TO_EXPONENT_INDICATOR()for the default function.tempered_pitch_indicator (str, optional) – String which indicates that the respective accidental is tempered (12 EDO). See
DEFAULT_TEMPERED_PITCH_INDICATORfor the default value.
Methods:
convert()Render tuning file to
path.- convert()¶
Render tuning file to
path.