mutwo.mbrola_converters§

Object

Documentation

mutwo.mbrola_converters.EventToPhonemeList

Convert mutwo event to voxpopuli.PhonemeList.

mutwo.mbrola_converters.EventToSpeakSynthesis

Render event to soundfile with speak synthesis engine mbrola.

mutwo.mbrola_converters.SimpleEventToPitch

Convert a simple event to a pitch.

mutwo.mbrola_converters.SimpleEventToPhonemeString

Convert a simple event to a phoneme string.

class EventToPhonemeList(simple_event_to_pitch=<mutwo.mbrola_converters.mbrola.SimpleEventToPitch object>, simple_event_to_phoneme_string=<mutwo.mbrola_converters.mbrola.SimpleEventToPhonemeString object>)[source]§

Convert mutwo event to voxpopuli.PhonemeList.

Parameters:

Warning:

This converter assumes that the duration attribute of the input event is in seconds. It multiplies the input duration by a factor of 1000 and parses it to the voxpopuli.Phoneme object which expects duration in milliseconds. It is the responsibility of the user to ensure that the duration has the right format.

Public Methods:

__init__([simple_event_to_pitch, ...])

convert(event_to_convert)

Inherited from Converter

convert(event_to_convert)

__call__(*args, **kwargs)

Call self as a function.

Private Data Attributes:

_abc_impl

Inherited from EventConverter

_abc_impl

Inherited from Converter

_abc_impl

Inherited from ABC

_abc_impl


convert(event_to_convert)[source]§
Parameters:

event_to_convert (Event) –

Return type:

PhonemeList

class EventToSpeakSynthesis(voice=<voxpopuli.main.Voice object>, event_to_phoneme_list=<mutwo.mbrola_converters.mbrola.EventToPhonemeList object>)[source]§

Render event to soundfile with speak synthesis engine mbrola.

Parameters:
  • voice (voxpopuli.Voice) – The voice object which is responsible in rendering the soundfile.

  • event_to_phoneme_list (Callable[[core_events.abc.Event], voxpopuli.PhonemeList]) – A converter or function which transforms an event to a voxpopuli.PhonemeList. By default this is a mutwo.mbrola_converters.EventToPhonemeList object..

Warning:

You need to install the non-python dependencies for voxpopuli, otherwise the converter won’t work.

Public Methods:

__init__([voice, event_to_phoneme_list])

convert(event_to_convert, sound_file_name)

Inherited from Converter

convert(event_to_convert, sound_file_name)

__call__(*args, **kwargs)

Call self as a function.

Private Data Attributes:

_abc_impl

Inherited from Converter

_abc_impl

Inherited from ABC

_abc_impl


convert(event_to_convert, sound_file_name)[source]§
Parameters:
  • event_to_convert (Event) –

  • sound_file_name (str) –

class SimpleEventToPitch(attribute_name=None, exception_value=[])[source]§

Convert a simple event to a pitch.

Public Methods:

convert(*args, **kwargs)

Extract from a mutwo.core_events.SimpleEvent an attribute.

Inherited from SimpleEventToPitchList

__init__([attribute_name, exception_value])

Inherited from SimpleEventToAttribute

__init__([attribute_name, exception_value])

convert(*args, **kwargs)

Extract from a mutwo.core_events.SimpleEvent an attribute.

Inherited from Converter

convert(*args, **kwargs)

Extract from a mutwo.core_events.SimpleEvent an attribute.

__call__(*args, **kwargs)

Call self as a function.

Private Data Attributes:

_abc_impl

Inherited from SimpleEventToPitchList

_abc_impl

Inherited from SimpleEventToAttribute

_abc_impl

Inherited from Converter

_abc_impl

Inherited from ABC

_abc_impl


Parameters:
convert(*args, **kwargs)[source]§

Extract from a mutwo.core_events.SimpleEvent an attribute.

Parameters:

simple_event_to_convert (mutwo.core_events.SimpleEvent) – The mutwo.core_events.SimpleEvent from which an attribute shall be extracted.

Return type:

Optional[Pitch]

Example:

>>> from mutwo import core_converters
>>> from mutwo import core_events
>>> simple_event = core_events.SimpleEvent(duration=10)
>>> simple_event_to_duration = core_converters.SimpleEventToAttribute(
        'duration', 0
    )
>>> simple_event_to_duration.convert(simple_event)
10
>>> simple_event_to_pasta = core_converters.SimpleEventToAttribute(
        'pasta', 'spaghetti'
    )
>>> simple_event_to_pasta.convert(simple_event)
'spaghetti'
>>> simple_event.pasta = 'tagliatelle'
>>> simple_event_to_pasta.convert(simple_event)
'tagliatelle'
class SimpleEventToPhonemeString(attribute_name='phoneme', exception_value='_')[source]§

Convert a simple event to a phoneme string.

Public Methods:

__init__([attribute_name, exception_value])

Inherited from SimpleEventToAttribute

__init__([attribute_name, exception_value])

convert(simple_event_to_convert)

Extract from a mutwo.core_events.SimpleEvent an attribute.

Inherited from Converter

convert(simple_event_to_convert)

Extract from a mutwo.core_events.SimpleEvent an attribute.

__call__(*args, **kwargs)

Call self as a function.

Private Data Attributes:

_abc_impl

Inherited from SimpleEventToAttribute

_abc_impl

Inherited from Converter

_abc_impl

Inherited from ABC

_abc_impl


Parameters:
  • attribute_name (str) –

  • exception_value (str) –

convert(simple_event_to_convert)§

Extract from a mutwo.core_events.SimpleEvent an attribute.

Parameters:

simple_event_to_convert (mutwo.core_events.SimpleEvent) – The mutwo.core_events.SimpleEvent from which an attribute shall be extracted.

Return type:

Any

Example:

>>> from mutwo import core_converters
>>> from mutwo import core_events
>>> simple_event = core_events.SimpleEvent(duration=10)
>>> simple_event_to_duration = core_converters.SimpleEventToAttribute(
        'duration', 0
    )
>>> simple_event_to_duration.convert(simple_event)
10
>>> simple_event_to_pasta = core_converters.SimpleEventToAttribute(
        'pasta', 'spaghetti'
    )
>>> simple_event_to_pasta.convert(simple_event)
'spaghetti'
>>> simple_event.pasta = 'tagliatelle'
>>> simple_event_to_pasta.convert(simple_event)
'tagliatelle'