interval method

  1. @override
Interval interval(
  1. PitchClass other
)
override

The IntervalClass expressed as Interval between this PitchClass and other.

Example:

PitchClass.c.interval(PitchClass.e) == Interval.M3
PitchClass.gSharp.interval(PitchClass.d) == Interval.A4

Implementation

@override
// TODO(albertms10): return [IntervalClass]. See #248.
Interval interval(PitchClass other) {
  final diff = difference(other);

  return IntervalClass(diff)
      .resolveClosestSpelling()
      .descending(isDescending: diff.isNegative);
}