musicaiz.harmony.Interval

class musicaiz.harmony.Interval(interval: Optional[Union[musicaiz.harmony.intervals.IntervalSemitones, str]] = None)[source]
__init__(interval: Optional[Union[musicaiz.harmony.intervals.IntervalSemitones, str]] = None)[source]

The Interval object can be initialized with a valid interval name or not. The logic behind this is having methods for generating and analyzing data.

Initialization:
  • By initializing this class with an interval name, the use of this class’ methods

    will be to generate data with the interval information.

  • By initializing this class with no input arguments, the use of this class’ methods

    is more related to analize data.

Raises
ValueError

if input interval name is invalid.

Examples

  • Get interval between 2 notes

>>> interval = Interval()
>>> note1 = "C0"
>>> note2 = "G0"
>>> interval_name = interval.get_interval(note1, note2)

Methods

__init__([interval])

The Interval object can be initialized with a valid interval name or not.

get_possible_intervals(note1, note2)

Calculates the interval for a given pair of notes.

transpose_note(note)

Transposes the input note a given interval.

Attributes

interval

interval_class

quality

semitones

form