EasyMIDI.RomanChord

class EasyMIDI.RomanChord(numeral='I', octave=4, duration=0.25, key='C', major=True, volume=100)

The RomanChord class supports Roman chord numerals for creating chord progressions in a relatively easy way. It’s also possible to customize the numerals with intervals or signs and inversions:

  • I6, I7: add 6th or 7th note interval to I chord
  • Isus2, Isus4: the suspended chords relative to the I chord
  • I-, I+: Diminished and augmented I chord
  • Imaj7, Imin7, Idom7: major, minor and dominant 7th chord from I
  • I*, I**: first and second inversion of the I chord, can be combined with the other customizations (ex. Isus2**)

Full code example:

from EasyMIDI import *
mid = EasyMIDI()
track = Track('acoustic grand')
for numeral in ['I', 'IV', 'V', 'I']:
   track.addChord(RomanChord(numeral))
mid.addTrack(track)
mid.writeMIDI('output.mid')

Initializes a RomanChord.

Parameters:
  • numeral (str) – A roman numeral (I, II, III, IV, V, VI or VII)
  • octave (int) – The octave of the RomanChord (1-7).
  • duration (float or int) – The duration of the RomanChord (ex. 1/4).
  • key (str) – The key of the RomanChord (ex. Ab or G# or D).
  • major (bool) – If true, use major scale. If false, use minor scale.
  • volume (int) – The volume of the RomanChord (0-100).
__init__(numeral='I', octave=4, duration=0.25, key='C', major=True, volume=100)

Initializes a RomanChord.

Parameters:
  • numeral (str) – A roman numeral (I, II, III, IV, V, VI or VII)
  • octave (int) – The octave of the RomanChord (1-7).
  • duration (float or int) – The duration of the RomanChord (ex. 1/4).
  • key (str) – The key of the RomanChord (ex. Ab or G# or D).
  • major (bool) – If true, use major scale. If false, use minor scale.
  • volume (int) – The volume of the RomanChord (0-100).

Methods

__init__([numeral, octave, duration, key, ...]) Initializes a RomanChord.
addNote(note) Adds a note to the Chord.
getDuration() Returns the duration of the longest Chord note.
getNotes() Gets the Notes of the chord.
getNumeral() Returns the numeral of the RomanChord.
getVolume() Returns the volume of the loudest Chord note.
removeNote(note) Removes a note from the Chord.
setDuration(duration) Sets the duration of the note to duration.
setKey(key[, major]) Sets the key of the RomanChord, optionally changes scales.
setNotes(noteList) Sets the Chord notes to the Notes in noteList.
setOctave(octave) Sets the octave of the note to octave.
setVolume(volume) Sets the volume of the note to volume.
getNumeral()

Returns the numeral of the RomanChord.

Returns:The numeral.
Return type:str
setKey(key, major=True)

Sets the key of the RomanChord, optionally changes scales.

Parameters:
  • key (str) – The key of the RomanChord (ex. Ab or G# or D).
  • major (bool) – If true, use major scale. If false, use minor scale.