class mingus.containers.track.Track[source]
__add__(self, value)[source]

Enable the ‘+’ operator for Tracks.

Notes, notes as string, NoteContainers and Bars accepted.

__eq__(self, other)[source]

Enable the ‘==’ operator for tracks.

__getitem__(self, index)[source]

Enable the ‘[]’ notation for Tracks.

__init__(self, instrument=None)[source]

Enable the len() function for Tracks.


Return a string representing the class.

__setitem__(self, index, value)[source]

Enable the ‘[] =’ notation for Tracks.

Throw an UnexpectedObjectError if the value being set is not a mingus.containers.Bar object.

add_bar(self, bar)[source]

Add a Bar to the current track.

add_notes(self, note, duration=None)[source]

Add a Note, note as string or NoteContainer to the last Bar.

If the Bar is full, a new one will automatically be created.

If the Bar is not full but the note can’t fit in, this method will return False. True otherwise.

An InstrumentRangeError exception will be raised if an Instrument is attached to the Track, but the note turns out not to be within the range of the Instrument.


Augment all the bars in the Track.


Attribute of type: list []


Diminish all the bars in the Track.

from_chords(self, chords, duration=1)[source]

Add chords to the Track.

The given chords should be a list of shorthand strings or list of list of shorthand strings, etc.

Each sublist divides the value by 2.

If a tuning is set, chords will be expanded so they have a proper fingering.


>>> t = Track().from_chords(['C', ['Am', 'Dm'], 'G7', 'C#'], 1)

Return an iterator that iterates through every bar in the this track.


Return a StringTuning object.

If an instrument is set and has a tuning it will be returned. Otherwise the track’s one will be used.


Attribute of type: NoneType None


Attribute of type: str 'Untitled'

set_tuning(self, tuning)[source]

Set the tuning attribute on both the Track and its instrument (when available).

Tuning should be a StringTuning or derivative object.


Test whether all but the last Bars contained in this track are full.

transpose(self, interval, up=True)[source]

Transpose all the notes in the track up or down the interval.

Call transpose() on every Bar.


Attribute of type: NoneType None

Back to Index