mutwo.ekmelily_converters§

Object

Documentation

mutwo.ekmelily_converters.EkmelilyAccidental

Representation of an Ekmelily accidental.

mutwo.ekmelily_converters.EkmelilyTuningFileConverter

Build Ekmelily tuning files from Ekmelily accidentals.

mutwo.ekmelily_converters.HEJIEkmelilyTuningFileConverter

Build Ekmelily tuning files for Helmholtz-Ellis JI Pitch Notation.

class EkmelilyAccidental(accidental_name, accidental_glyph_tuple, deviation_in_cents, available_diatonic_pitch_index_tuple=None)[source]§

Representation 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_glyph_tuple (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_GLYPH_DICT and TEMPERED_ACCIDENTAL_TO_ACCIDENTAL_GLYPH_DICT.

  • deviation_in_cents (float) – How many cents shall an altered pitch differ from its diatonic / natural counterpart.

  • available_diatonic_pitch_index_tuple (Optional[tuple[int, ...]], optional) – Sometimes one may want to define accidentals which are only available for certain diatonic music_parameters. For this case, one can use this argument and specify all diatonic music_parameters which should know this accidental. If this argument keeps undefined, the accidental will be added to all seven diatonic music_parameters.

Example:

>>> from mutwo.ext.converter.frontends import ekmelily
>>> natural = ekmelily.EkmelilyAccidental('', ("#xE261",), 0)
>>> sharp = ekmelily.EkmelilyAccidental('s', ("#xE262",), 100)
>>> flat = ekmelily.EkmelilyAccidental('f', ("#xE260",), -100)

Public Data Attributes:

available_diatonic_pitch_index_tuple

Public Methods:

__hash__()

Return hash(self).

__init__(accidental_name, ...[, ...])

__repr__()

Return repr(self).

__eq__(other)

Return self==value.

__setattr__(name, value)

Implement setattr(self, name, value).

__delattr__(name)

Implement delattr(self, name).


accidental_glyph_tuple: tuple[str, ...]§
accidental_name: str§
available_diatonic_pitch_index_tuple: Optional[tuple[int, ...]] = None§
deviation_in_cents: float§
class EkmelilyTuningFileConverter(path, ekmelily_accidental_sequence, global_scale=None)[source]§

Build 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_accidental_sequence (Sequence[EkmelilyAccidental]) – A sequence which contains all EkmelilyAccidental that shall be written to the tuning file,

  • global_scale (tuple[fractions.Fraction, ...], optional) – From the Lilypond documentation: “This determines the tuning of music_parameters with no accidentals or key signatures. The first pitch is c. Alterations are calculated relative to this scale. The number of music_parameters 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()

Public Methods:

__init__(path, ekmelily_accidental_sequence)

convert()

Render tuning file to path.

Inherited from Converter

convert()

Render tuning file to path.

__call__(*args, **kwargs)

Call self as a function.

Private Data Attributes:

_abc_impl

Inherited from Converter

_abc_impl

Inherited from ABC

_abc_impl


convert()[source]§

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, set_microtonal_tuning=True)[source]§

Build 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 (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_EXPONENT_DICT for the default mapping.

  • reference_pitch (str, optional) – The reference pitch (1/1). Should be a diatonic pitch name (see DIATONIC_PITCH_CLASS_CONTAINER) in English nomenclature. For any other reference pitch than ‘c’, Lilyponds midi rendering for music_parameters 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 (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_NAME_DICT for the default mapping.

  • otonality_indicator (str, optional) – String which indicates that the respective prime alteration is otonal. See DEFAULT_OTONALITY_INDICATOR for the default value.

  • utonality_indicator (str, optional) – String which indicates that the respective prime alteration is utonal. See DEFAULT_OTONALITY_INDICATOR for the default value.

  • exponent_to_exponent_indicator (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_INDICATOR for the default value.

  • set_microtonal_tuning (bool) – If set to False the converter won’t apply any microtonal music_parameters. In this case all chromatic music_parameters will return normal 12EDO music_parameters. Default to True.

Public Methods:

__init__([path, ...])

Inherited from EkmelilyTuningFileConverter

__init__([path, ...])

convert()

Render tuning file to path.

Inherited from Converter

convert()

Render tuning file to path.

__call__(*args, **kwargs)

Call self as a function.

Private Data Attributes:

_abc_impl

Inherited from EkmelilyTuningFileConverter

_abc_impl

Inherited from Converter

_abc_impl

Inherited from ABC

_abc_impl


convert()§

Render tuning file to path.

mutwo.ekmelily_converters.configurations§

Configure default behaviour of mutwo.ekmelily_converters

DEFAULT_EXPONENT_TO_EXPONENT_INDICATOR(exponent)§

Default function for HEJIEkmelilyTuningFileConverter argument exponent_to_exponent_indicator.

DEFAULT_GLOBAL_SCALE = (Fraction(0, 1), Fraction(1, 1), Fraction(2, 1), Fraction(5, 2), Fraction(7, 2), Fraction(9, 2), Fraction(11, 2))§

Default value for EkmelilyTuningFileConverter argument global_scale.

DEFAULT_OTONALITY_INDICATOR = 'o'§

Default value for HEJIEkmelilyTuningFileConverter argument otonality_indicator.

DEFAULT_PRIME_TO_HEJI_ACCIDENTAL_NAME_DICT = {5: 'a', 7: 'b', 11: 'c', 13: 'd', 17: 'e', 19: 'f', 23: 'g'}§

Default mapping for HEJIEkmelilyTuningFileConverter argument prime_to_heji_accidental_name.

DEFAULT_PRIME_TO_HIGHEST_ALLOWED_EXPONENT_DICT = {5: 3, 7: 2, 11: 1, 13: 1, 17: 1}§

Default value for HEJIEkmelilyTuningFileConverter argument prime_to_highest_allowed_exponent.

DEFAULT_TEMPERED_PITCH_INDICATOR = 't'§

Default value for HEJIEkmelilyTuningFileConverter argument tempered_pitch_indicator.

DEFAULT_UTONALITY_INDICATOR = 'u'§

Default value for HEJIEkmelilyTuningFileConverter argument utonality_indicator.

mutwo.ekmelily_converters.constants§

Constants to be used for and with mutwo.ekmelily_converters.

DIFFERENCE_BETWEEN_PYTHAGOREAN_AND_TEMPERED_FIFTH = 1.955000865387433§

The difference in cents between a just fifth (3/2) and a 12-EDO fifth. This constant is used in HEJIEkmelilyTuningFileConverter.

PRIME_AND_EXPONENT_AND_TRADITIONAL_ACCIDENTAL_TO_ACCIDENTAL_GLYPH_DICT = {(None, None, ''): '#xE261', (None, None, 's'): '#xE262', (None, None, 'ss'): '#xE263', (None, None, 'f'): '#xE260', (None, None, 'ff'): '#xE264', (5, 1, ''): '#xE2C2', (5, 2, ''): '#xE2C2', (5, 3, ''): '#xE2D6', (5, -1, ''): '#xE2C7', (5, -2, ''): '#xE2D1', (5, -3, ''): '#xE2DB', (5, 1, 's'): '#xE2C3', (5, 2, 's'): '#xE2CD', (5, 3, 's'): '#xE2D7', (5, -1, 's'): '#xE2C8', (5, -2, 's'): '#xE2D2', (5, -3, 's'): '#xE2DC', (5, 1, 'ss'): '#xE2C4', (5, 2, 'ss'): '#xE2CE', (5, 3, 'ss'): '#xE2D8', (5, -1, 'ss'): '#xE2C9', (5, -2, 'ss'): '#xE2D3', (5, -3, 'ss'): '#xE2DD', (5, 1, 'f'): '#xE2C1', (5, 2, 'f'): '#xE2CB', (5, 3, 'f'): '#xE2D5', (5, -1, 'f'): '#xE2C6', (5, -2, 'f'): '#xE2D0', (5, -3, 'f'): '#xE2DA', (5, 1, 'ff'): '#xE2C0', (5, 2, 'ff'): '#xE2CA', (5, 3, 'ff'): '#xE2D4', (5, -1, 'ff'): '#xE2C5', (5, -2, 'ff'): '#xE2CF', (5, -3, 'ff'): '#xE2D9', (7, 1, None): '#xE2DE', (7, 2, None): '#xE2E0', (7, -1, None): '#xE2DF', (7, -2, None): '#xE2E1', (11, 1, None): '#xE2E3', (11, -1, None): '#xE2E2', (13, 1, None): '#xE2E4', (13, -1, None): '#xE2E5', (17, 1, None): '#xE2E6', (17, -1, None): '#xE2E7', (19, 1, None): '#xE2E9', (19, -1, None): '#xE2E8', (23, 1, None): '#xE2EA', (23, -1, None): '#xE2EB'}§

Mapping of prime, exponent and pythagorean accidental to accidental glyph name in Ekmelos.

PYTHAGOREAN_ACCIDENTAL_CENT_DEVIATION_SIZE = 113.69§

Step in cents for one pythagorean accidental (# or b).

PYTHAGOREAN_ACCIDENTAL_TO_CENT_DEVIATION_DICT = {'': 0, 'f': -113.69, 'ff': -227.38, 's': 113.69, 'ss': 227.38}§

Step in cents mapping for each pythagorean accidental (# or b).

TEMPERED_ACCIDENTAL_TO_ACCIDENTAL_GLYPH_DICT = {'': '#xE2F2', 'f': '#xE2F1', 'ff': '#xE2F0', 'qf': '#xE2F5', 'qs': '#xE2F6', 's': '#xE2F3', 'ss': '#xE2F4'}§

Mapping of tempered accidental name to glyph name in Ekmelos.

TEMPERED_ACCIDENTAL_TO_CENT_DEVIATION_DICT = {'': 0, 'f': -100, 'ff': -200, 'qf': -50, 'qs': 50, 's': 100, 'ss': 200}§

Mapping of tempered accidental name to cent deviation.