Tutorial 6 - CompositionΒΆ
A Composition can be used to organize Tracks and to add some metadata such as title, subtitle and author.
>>> from mingus.containers import Composition
Setting AttributesΒΆ
The author, email, title and subtitle attributes can be easily handled with the functions set_author and set_title:
>>> c = Composition()
>>> c.set_author('Author', 'author@email.com')
>>> c.set_title('First Mingus Composition')
This should sound pretty familiar by now:
Adding TracksΒΆ
>>> c = Composition()
>>> t = Track()
>>> c.add_track(t)
Adding NotesΒΆ
This might seem a little strange, and you probably wonβt use it much.
>>> c = Composition()
>>> c.add_note("C")
The note gets added to the tracks in Composition.selected_tracks which is automatically set when you use add_track, but which you can also use yourself.
The Overloaded β+β OperatorΒΆ
This operator accepts Notes, note strings, NoteContainers, Bars and Tracks.
>>> c = Composition()
>>> c + "C"
List NotationΒΆ
>>> c = Composition()
>>> len(c)
0
>>> c + Track()
>>> c[0] = Track
You can learn more about mingus.containers.Composition in the reference section.