ChordDescriptor

public struct ChordDescriptor

Description of a simultaneity of pitches wherein the intervals between the pitches are described.

Example Usage

let major: ChordDescriptor = [.M3, .m3]
let minor: ChordDescriptor = [.m3, .M3]
let diminished: ChordDescriptor = [.m3, .m3]
let augmented: ChordDescriptor = [.M3, .M3]
  • Example Usage:

    let major: ChordDescriptor = [.M3, .m3]
    let firstInversion = major.inversion(1) // => [.m3, .P4]
    let secondInversion = major.inversion(2) // => [.P4, .M3]
    
    let majorSeventh: ChordDescriptor = [.M3, .m3, .M3]
    let thirdInversion = majorSeventh.inversion(3) // => [.m2, .M3, .m3]
    

    Declaration

    Swift

    public func inversion(_ value: Int) -> ChordDescriptor

    Return Value

    A ChordDescriptor which is the nth inversion of this ChordDescriptor.

  • Undocumented

    Declaration

    Swift

    public static let major: ChordDescriptor
  • Undocumented

    Declaration

    Swift

    public static let minor: ChordDescriptor
  • Undocumented

    Declaration

    Swift

    public static let diminished: ChordDescriptor
  • Undocumented

    Declaration

    Swift

    public static let augmented: ChordDescriptor
  • Declaration

    Swift

    public var base: [CompoundDiatonicInterval] { get }

    Return Value

    The RandomAccessCollection base of a ChordDescriptor.

  • Undocumented

    Declaration

    Swift

    public typealias Base = [CompoundDiatonicInterval]
  • Start index.

    Complexity

    O(1)

    Declaration

    Swift

    public var startIndex: Base.Index { get }
  • End index.

    Complexity

    O(1)

    Declaration

    Swift

    public var endIndex: Base.Index { get }
  • First element, if there is at least one element. Otherwise, nil.

    Complexity

    O(1)

    Declaration

    Swift

    public var first: Base.Element? { get }
  • Last element, if there is at least one element. Otherwise, nil.

    Complexity

    O(1)

    Declaration

    Swift

    public var last: Base.Element? { get }
  • Amount of elements.

    Complexity

    O(1)

    Declaration

    Swift

    public var count: Int { get }
  • Complexity

    O(1)

    Declaration

    Swift

    public var isEmpty: Bool { get }

    Return Value

    true if there are no elements contained herein. Otherwise, false.

  • Complexity

    O(1)

    Declaration

    Swift

    public subscript(position: Base.Index) -> Base.Element { get }

    Return Value

    The element at the given index.

  • Complexity

    O(1)

    Declaration

    Swift

    public func index(after index: Base.Index) -> Base.Index

    Return Value

    Index after the given index.

  • Complexity

    O(1)

    Declaration

    Swift

    public func index(before index: Base.Index) -> Base.Index

    Return Value

    Index before the given index.