mutwo.music_events¶
Event classes which are designated for musical usage.
Object |
Documentation |
|---|---|
|
- class NoteLike(pitch_list=[], duration=1, volume='mf', grace_note_consecution=None, after_grace_note_consecution=None, playing_indicator_collection=None, notation_indicator_collection=None, lyric=DirectLyric(), instrument_list=[], *, tempo=None, tag=None)[source]¶
Bases:
ChrononNoteLikecan be a tone, chord, percussion note or rest.- Parameters:
pitch_list (music_parameters.abc.PitchList.Type) – The pitch or pitches of the event. This can be a pitch object (any class that inherits from
Pitch) or a list of pitch objects. Furthermoremutwosupports syntactic sugar to convert other objects on the fly to pitch objects: A string can be read as pitch class names to buildmutwo.music_parameters.WesternPitchobjects or as ratios to buildmutwo.music_parameters.JustIntonationPitchobjects. Fraction will also buildmutwo.music_parameters.JustIntonationPitchobjects. Other numbers (integer and float) will be read as pitch class numbers to makemutwo.music_parameters.WesternPitchobjects.duration (mutwo.core_parameters.abc.Duration.Type) – The duration of
NoteLike.volume (music_parameters.abc.Volume.Type) – The volume of the event. Can either be a object of
mutwo.music_parameters.abc.Volume, a number or a string. If the number ranges from 0 to 1,mutwoautomatically generates amutwo.music_parameters.AmplitudeVolumeobject (and the number is interpreted as the amplitude). If the number is smaller than 0,mutwoautomatically generates amutwo.music_parameters.volumes.DecibelVolume(and the number is interpreted as decibel). If the argument is a string, mutwo initialises amutwo.music_parameters.volumes.WesternVolume.grace_note_consecution (core_events.Consecution[NoteLike]) – Specify grace notes which are played before the
NoteLike. If theConsecutionis empty, no grace notes are present.after_grace_note_consecution (core_events.Consecution[NoteLike]) –
Specify grace notes which are played after the
NoteLike. If theConsecutionis empty, no grace notes are present.playing_indicator_collection (music_parameters.abc.IndicatorCollection.Type) – A
PlayingIndicatorCollection. Playing indicators alter the sound ofNoteLike(e.g. tremolo, fermata, pizzicato).notation_indicator_collection (music_parameters.abc.IndicatorCollection.Type) – A
NotationIndicatorCollection. Notation indicators alter the visual representation ofNoteLike(e.g. ottava, clefs) without affecting the resulting sound.lyric (core_parameters.abc.Lyric) – If with this
NoteLikea text is to be sung or spoken, this text can be specified here. Default tomusic_parameters.DirectLyric("").instrument_list (list[music_parameters.abc.Instrument]) – If an event is played with one or more specifc
mutwo.music_parameters.abc.Instrument, these instruments can be assigned here. Default is an empty list.tempo (Optional[Tempo]) –
tag (Optional[str]) –
mutwo.musicdoesn’t differentiate between tones, chords and rests, but rather simply implements one general class that can represent any of the mentioned definitions (e.g. a NoteLike with several pitches may be called a ‘chord’ and a NoteLike with only one pitch may be called a ‘tone’).Example:
>>> from mutwo import music_parameters >>> from mutwo import music_events >>> tone = music_events.NoteLike(music_parameters.WesternPitch('a'), 1, 1) >>> other_tone = music_events.NoteLike('3/2', 1, 0.5) >>> chord = music_events.NoteLike( ... [music_parameters.WesternPitch('a'), music_parameters.JustIntonationPitch('3/2')], 1, 1 ... ) >>> other_chord = music_events.NoteLike('c4 dqs3 10/7', 1, 3)
Public Data Attributes:
pitch_listThe pitch or pitches of the event.
volumeThe
Volumeof the event.grace_note_consecutionConsecutionbeforeNoteLikeafter_grace_note_consecutionConsecutionafterNoteLikeplaying_indicator_collectionnotation_indicator_collectionInherited from
Chrononparameter_to_exclude_from_representation_tupledurationThe duration of an event.
Public Methods:
Inherited from
Chronondestructive_copy()Adapted deep copy method that returns a new object for every leaf.
get_parameter(parameter_name[, flat, ...])Return event attribute with the entered name.
set_parameter(*args, **kwargs)Sets event parameter to new value.
metrize()Apply tempo of event on itself
cut_out(start, end)Time-based slicing of the respective event.
cut_off(start, end)Time-based deletion / shortening of the respective event.
Inherited from
EventAdapted deep copy method that returns a new object for every leaf.
set(attribute_name, value)Set an attribute of the object to a specific value
get_parameter(parameter_name[, flat, ...])Return event attribute with the entered name.
set_parameter(parameter_name, object_or_function)Sets parameter to new value for all children events.
mutate_parameter(parameter_name, function)Mutate parameter with a function.
Set events tempo so that one beat equals one second (tempo 60).
metrize()Apply tempo of event on itself
cut_out(start, end)Time-based slicing of the respective event.
cut_off(start, end)Time-based deletion / shortening of the respective event.
split_at(*absolute_time[, ...])Split event into n events at
absolute_time.Inherited from
MutwoObjectcopy()Return a deep copy of mutwo object.
- property after_grace_note_consecution: Consecution[Chronon]¶
ConsecutionafterNoteLike
- property grace_note_consecution: Consecution[Chronon]¶
ConsecutionbeforeNoteLike
- property notation_indicator_collection: NotationIndicatorCollection¶
- property pitch_list: Any¶
The pitch or pitches of the event.
- property playing_indicator_collection: PlayingIndicatorCollection¶
mutwo.music_events.configurations¶
Set default values for mutwo.music_events.NoteLike.
- DEFAULT_NOTATION_INDICATORS_COLLECTION_CLASS¶
Default value for
mutwo.music_events.NoteLike.notation_indicator_collectioninNoteLike
- DEFAULT_PLAYING_INDICATORS_COLLECTION_CLASS¶
Default value for
mutwo.music_events.NoteLike.playing_indicator_collectioninNoteLike