mutwo.mbrola_converters§
Object |
Documentation |
|---|---|
Convert mutwo event to |
|
Render event to soundfile with speak synthesis engine mbrola. |
|
Convert a simple event to a pitch. |
|
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:
simple_event_to_pitch (Callable[[core_events.SimpleEvent], Optional[music_parameters.abc.Pitch]]) – Function or converter which receives a
mutwo.core_events.SimpleEventas an input and has to return a :class`mutwo.music_parameters.abc.Pitch` or None.simple_event_to_phoneme_string (Callable[[core_events.SimpleEvent], str]) – Function or converter which receives a
mutwo.core_events.SimpleEventas an input and has to return a string which belongs to the phonetic alphabet SAMPA.
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
Converterconvert(event_to_convert)__call__(*args, **kwargs)Call self as a function.
Private Data Attributes:
_abc_implInherited from
EventConverter_abc_implInherited from
Converter_abc_implInherited from
ABC_abc_impl
- 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 amutwo.mbrola_converters.EventToPhonemeListobject..
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
Converterconvert(event_to_convert, sound_file_name)__call__(*args, **kwargs)Call self as a function.
Private Data Attributes:
_abc_implInherited from
Converter_abc_implInherited from
ABC_abc_impl
- 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.SimpleEventan 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.SimpleEventan attribute.Inherited from
Converterconvert(*args, **kwargs)Extract from a
mutwo.core_events.SimpleEventan attribute.__call__(*args, **kwargs)Call self as a function.
Private Data Attributes:
_abc_implInherited from
SimpleEventToPitchList_abc_implInherited from
SimpleEventToAttribute_abc_implInherited from
Converter_abc_implInherited from
ABC_abc_impl
- Parameters:
attribute_name (Optional[str]) –
exception_value (list[mutwo.music_parameters.abc.Pitch]) –
- convert(*args, **kwargs)[source]§
Extract from a
mutwo.core_events.SimpleEventan attribute.- Parameters:
simple_event_to_convert (mutwo.core_events.SimpleEvent) – The
mutwo.core_events.SimpleEventfrom 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.SimpleEventan attribute.Inherited from
Converterconvert(simple_event_to_convert)Extract from a
mutwo.core_events.SimpleEventan attribute.__call__(*args, **kwargs)Call self as a function.
Private Data Attributes:
_abc_implInherited from
SimpleEventToAttribute_abc_implInherited from
Converter_abc_implInherited from
ABC_abc_impl
- Parameters:
attribute_name (str) –
exception_value (str) –
- convert(simple_event_to_convert)§
Extract from a
mutwo.core_events.SimpleEventan attribute.- Parameters:
simple_event_to_convert (mutwo.core_events.SimpleEvent) – The
mutwo.core_events.SimpleEventfrom 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'