EasyMIDI.Track

class EasyMIDI.Track(instrument, tempo=120)

Simple Track class which keeps the list of Notes/Chords, the instrument and the tempo. To be used with addTrack() or addTracks() in EasyMIDI.

Initializes a Track object.

Parameters:
  • instrument (str) – A midi instrument name.
  • tempo (int) – The tempo of the track.
__init__(instrument, tempo=120)

Initializes a Track object.

Parameters:
  • instrument (str) – A midi instrument name.
  • tempo (int) – The tempo of the track.

Methods

__init__(instrument[, tempo]) Initializes a Track object.
addChord(chord) Is identical to addNotes().
addChords(chords) Is identical to addNotes().
addNote(note) Is identical to addNotes().
addNotes(notes) Add a list of Notes or Chords to the Track.
getInstrument() Returns the instrument of this Track.
getNotes() Returns a copy of the notes of this Track.
getTempo() Returns the tempo of this Track.
matchInstrument(description) (Fuzzy) matches instrument descriptions to MIDI program numbers.
addChord(chord)

Is identical to addNotes().

addChords(chords)

Is identical to addNotes().

addNote(note)

Is identical to addNotes().

addNotes(notes)

Add a list of Notes or Chords to the Track.

Parameters:notes (Note or Chord in list or single objects) – The list of Notes or Chords, or single Notes or Chords.
getInstrument()

Returns the instrument of this Track.

Returns:The instrument.
Return type:str
getNotes()

Returns a copy of the notes of this Track.

Returns:A list of Chord and Note objects.
Return type:list of Chord or Note.
getTempo()

Returns the tempo of this Track.

Returns:The tempo.
Return type:int
matchInstrument(description)

(Fuzzy) matches instrument descriptions to MIDI program numbers.

Parameters:description (str) – The instrument description (ex. acoustic grand).