CompoundDiatonicInterval

public struct CompoundDiatonicInterval : DiatonicIntervalProtocol

A descriptor for intervals between two Pitch values which takes into account octave displacement.

  • Creates a CompoundDiatonicInterval with the given interval and the amount of octaves of displacement.

    Declaration

    Swift

    public init(_ interval: DiatonicInterval, displacedBy octaves: Int = 0)
  • Creates a CompoundDiatonicInterval with the given quality and the given number, with no octave displacement.

    Declaration

    Swift

    public init(_ quality: Quality, _ ordinal: DiatonicInterval.Number)
  • Declaration

    Swift

    public var semitones: Int { get }

    Return Value

    The amount of semitones in this CompoundIntervalDescriptor.

  • Declaration

    Swift

    public var steps: Int { get }

    Return Value

    The amount of letter name steps in this CompoundIntervalDescriptor.

  • The unison is the zero for the CompoundIntervalDescriptor AdditiveGroup.

    Declaration

    Swift

    public static let zero: CompoundDiatonicInterval
  • Example Usage:

    let perfectFifth: CompoundDiatonicInterval = .P5
    let minorThird: CompoundDiatonicInterval = .m3
    let minorSeventh = perfectFifth + minorThird // => .m7
    

    Declaration

    Swift

    public static func + (lhs: CompoundDiatonicInterval, rhs: CompoundDiatonicInterval)
        -> CompoundDiatonicInterval

    Return Value

    The sum of the given CompoundIntervalDescriptors.

  • Mutates the left-hand-side by adding the right-hand-side.

    Declaration

    Swift

    public static func += (lhs: inout CompoundDiatonicInterval, rhs: CompoundDiatonicInterval)
  • Example Usage:

    let perfectFifth: CompoundDiatonicInterval = .P5
    let minorThird: CompoundDiatonicInterval = .m3
    let majorThird = perfectFifth - minorThird // => .M3
    

    Declaration

    Swift

    public static func - (lhs: CompoundDiatonicInterval, rhs: CompoundDiatonicInterval)
        -> CompoundDiatonicInterval

    Return Value

    The sum of the given CompoundIntervalDescriptors.

  • Mutates the left-hand-side by subtracting the right-hand-side.

    Declaration

    Swift

    public static func -= (lhs: inout CompoundDiatonicInterval, rhs: CompoundDiatonicInterval)
  • Declaration

    Swift

    public prefix static func - (element: CompoundDiatonicInterval) -> CompoundDiatonicInterval

    Return Value

    The inverse of a CompoundDiatonicInterval.

  • Declaration

    Swift

    public var inverse: CompoundDiatonicInterval { get }

    Return Value

    The inverse of a CompoundIntervalDescriptor.

  • d1

    Diminished Unison.

    Declaration

    Swift

    public static let d1: CompoundDiatonicInterval
  • Unison.

    Declaration

    Swift

    public static let unison: CompoundDiatonicInterval
  • d2

    Diminished second.

    Declaration

    Swift

    public static let d2: CompoundDiatonicInterval
  • A1

    Augmented unison.

    Declaration

    Swift

    public static let A1: CompoundDiatonicInterval
  • m2

    Minor second.

    Declaration

    Swift

    public static let m2: CompoundDiatonicInterval
  • M2

    Major second.

    Declaration

    Swift

    public static let M2: CompoundDiatonicInterval
  • d3

    Diminished third.

    Declaration

    Swift

    public static let d3: CompoundDiatonicInterval
  • A2

    Augmented second.

    Declaration

    Swift

    public static let A2: CompoundDiatonicInterval
  • m3

    Minor third.

    Declaration

    Swift

    public static let m3: CompoundDiatonicInterval
  • M3

    Major third.

    Declaration

    Swift

    public static let M3: CompoundDiatonicInterval
  • d4

    Diminished fourth.

    Declaration

    Swift

    public static let d4: CompoundDiatonicInterval
  • A3

    Augmented third.

    Declaration

    Swift

    public static let A3: CompoundDiatonicInterval
  • P4

    Perfect fourth.

    Declaration

    Swift

    public static let P4: CompoundDiatonicInterval
  • A4

    Augmented fourth.

    Declaration

    Swift

    public static let A4: CompoundDiatonicInterval
  • d5

    Diminished fifth.

    Declaration

    Swift

    public static let d5: CompoundDiatonicInterval
  • P5

    Perfect fifth.

    Declaration

    Swift

    public static let P5: CompoundDiatonicInterval
  • d6

    Diminished sixth.

    Declaration

    Swift

    public static let d6: CompoundDiatonicInterval
  • A5

    Augmented fifth.

    Declaration

    Swift

    public static let A5: CompoundDiatonicInterval
  • m6

    Minor sixth.

    Declaration

    Swift

    public static let m6: CompoundDiatonicInterval
  • M6

    Major sixth.

    Declaration

    Swift

    public static let M6: CompoundDiatonicInterval
  • d7

    Diminished seventh.

    Declaration

    Swift

    public static let d7: CompoundDiatonicInterval
  • A6

    Augmented sixth.

    Declaration

    Swift

    public static let A6: CompoundDiatonicInterval
  • m7

    Minor seventh.

    Declaration

    Swift

    public static let m7: CompoundDiatonicInterval
  • M7

    Major seventh.

    Declaration

    Swift

    public static let M7: CompoundDiatonicInterval
  • Octave.

    Declaration

    Swift

    public static let octave: CompoundDiatonicInterval
  • A7

    Augmented seventh.

    Declaration

    Swift

    public static let A7: CompoundDiatonicInterval
  • d8

    Diminished octave.

    Declaration

    Swift

    public static let d8: CompoundDiatonicInterval
  • d9

    Diminished ninth.

    Declaration

    Swift

    public static let d9: CompoundDiatonicInterval
  • A8

    Augmented octave.

    Declaration

    Swift

    public static let A8: CompoundDiatonicInterval
  • m9

    Minor ninth.

    Declaration

    Swift

    public static let m9: CompoundDiatonicInterval
  • M9

    Major ninth.

    Declaration

    Swift

    public static let M9: CompoundDiatonicInterval
  • d10

    Diminished tenth.

    Declaration

    Swift

    public static let d10: CompoundDiatonicInterval
  • A9

    Augmented ninth.

    Declaration

    Swift

    public static let A9: CompoundDiatonicInterval
  • m10

    Minor tenth.

    Declaration

    Swift

    public static let m10: CompoundDiatonicInterval
  • M10

    Major tenth.

    Declaration

    Swift

    public static let M10: CompoundDiatonicInterval
  • d11

    Diminished eleventh.

    Declaration

    Swift

    public static let d11: CompoundDiatonicInterval
  • P11

    Perfect eleventh.

    Declaration

    Swift

    public static let P11: CompoundDiatonicInterval
  • A11

    Augmented eleventh.

    Declaration

    Swift

    public static let A11: CompoundDiatonicInterval
  • d12

    Diminished twelfth.

    Declaration

    Swift

    public static let d12: CompoundDiatonicInterval
  • P12

    Perfect twelfth.

    Declaration

    Swift

    public static let P12: CompoundDiatonicInterval
  • d13

    Diminished thirteenth.

    Declaration

    Swift

    public static let d13: CompoundDiatonicInterval
  • A12

    Augmented twelfth.

    Declaration

    Swift

    public static let A12: CompoundDiatonicInterval
  • m13

    Minor thirteenth.

    Declaration

    Swift

    public static let m13: CompoundDiatonicInterval
  • M13

    Major thirteenth.

    Declaration

    Swift

    public static let M13: CompoundDiatonicInterval
  • d14

    Diminished fourteenth.

    Declaration

    Swift

    public static let d14: CompoundDiatonicInterval
  • A13

    Augmented thirteenth.

    Declaration

    Swift

    public static let A13: CompoundDiatonicInterval
  • m14

    Minor fourteenth.

    Declaration

    Swift

    public static let m14: CompoundDiatonicInterval
  • M14

    Major fourteenth.

    Declaration

    Swift

    public static let M14: CompoundDiatonicInterval
  • A14

    Augmented fourteenth.

    Declaration

    Swift

    public static let A14: CompoundDiatonicInterval
  • Declaration

    Swift

    public static func distanceToIdealInterval(for steps: Int, from interval: Double) -> Double

    Return Value

    The distance from the given interval to the ideal interval for the given amount of steps.

  • Printable description of CompoundIntervalDescriptor.

    Declaration

    Swift

    public var description: String { get }