Interval
struct Interval: Hashable, Sendable, CustomStringConvertible
The structure for an interval
-
Quality of the interval
Declaration
Swift
var quality: Quality -
Degree of the interval
Declaration
Swift
var degree: Int -
Semitones interval affect on a pitch
Declaration
Swift
var semitones: Int -
Unison
Declaration
Swift
static let P1 = Interval(quality: .perfect, degree: 1, semitones: 0) -
Perfect fourth
Declaration
Swift
static let P4 = Interval(quality: .perfect, degree: 4, semitones: 5) -
Perfect fifth
Declaration
Swift
static let P5 = Interval(quality: .perfect, degree: 5, semitones: 7) -
Octave
Declaration
Swift
static let P8 = Interval(quality: .perfect, degree: 8, semitones: 12) -
Perfect eleventh
Declaration
Swift
static let P11 = Interval(quality: .perfect, degree: 11, semitones: 17) -
Perfect twelfth
Declaration
Swift
static let P12 = Interval(quality: .perfect, degree: 12, semitones: 19) -
Perfect fifteenth, double octave
Declaration
Swift
static let P15 = Interval(quality: .perfect, degree: 15, semitones: 24) -
Minor second
Declaration
Swift
static let m2 = Interval(quality: .minor, degree: 2, semitones: 1) -
Minor third
Declaration
Swift
static let m3 = Interval(quality: .minor, degree: 3, semitones: 3) -
Minor sixth
Declaration
Swift
static let m6 = Interval(quality: .minor, degree: 6, semitones: 8) -
Minor seventh
Declaration
Swift
static let m7 = Interval(quality: .minor, degree: 7, semitones: 10) -
Minor ninth
Declaration
Swift
static let m9 = Interval(quality: .minor, degree: 9, semitones: 13) -
Minor tenth
Declaration
Swift
static let m10 = Interval(quality: .minor, degree: 10, semitones: 15) -
Minor thirteenth
Declaration
Swift
static let m13 = Interval(quality: .minor, degree: 13, semitones: 20) -
Minor fourteenth
Declaration
Swift
static let m14 = Interval(quality: .minor, degree: 14, semitones: 22) -
Major second
Declaration
Swift
static let M2 = Interval(quality: .major, degree: 2, semitones: 2) -
Major third
Declaration
Swift
static let M3 = Interval(quality: .major, degree: 3, semitones: 4) -
Major sixth
Declaration
Swift
static let M6 = Interval(quality: .major, degree: 6, semitones: 9) -
Major seventh
Declaration
Swift
static let M7 = Interval(quality: .major, degree: 7, semitones: 11) -
Major ninth
Declaration
Swift
static let M9 = Interval(quality: .major, degree: 9, semitones: 14) -
Major tenth
Declaration
Swift
static let M10 = Interval(quality: .major, degree: 10, semitones: 16) -
Major thirteenth
Declaration
Swift
static let M13 = Interval(quality: .major, degree: 13, semitones: 21) -
Major fourteenth
Declaration
Swift
static let M14 = Interval(quality: .major, degree: 14, semitones: 23) -
Diminished first
Declaration
Swift
static let d1 = Interval(quality: .diminished, degree: 1, semitones: -1) -
Diminished second
Declaration
Swift
static let d2 = Interval(quality: .diminished, degree: 2, semitones: 0) -
Diminished third
Declaration
Swift
static let d3 = Interval(quality: .diminished, degree: 3, semitones: 2) -
Diminished fourth
Declaration
Swift
static let d4 = Interval(quality: .diminished, degree: 4, semitones: 4) -
Diminished fifth
Declaration
Swift
static let d5 = Interval(quality: .diminished, degree: 5, semitones: 6) -
Diminished sixth
Declaration
Swift
static let d6 = Interval(quality: .diminished, degree: 6, semitones: 7) -
Diminished seventh
Declaration
Swift
static let d7 = Interval(quality: .diminished, degree: 7, semitones: 9) -
Diminished eighth
Declaration
Swift
static let d8 = Interval(quality: .diminished, degree: 8, semitones: 11) -
Diminished ninth
Note
Changed 12 to 13Declaration
Swift
static let d9 = Interval(quality: .diminished, degree: 9, semitones: 13) -
Diminished tenth
Declaration
Swift
static let d10 = Interval(quality: .diminished, degree: 10, semitones: 14) -
Diminished eleventh
Declaration
Swift
static let d11 = Interval(quality: .diminished, degree: 11, semitones: 16) -
Diminished twelfth
Declaration
Swift
static let d12 = Interval(quality: .diminished, degree: 12, semitones: 18) -
Diminished thirteenth
Declaration
Swift
static let d13 = Interval(quality: .diminished, degree: 13, semitones: 19) -
Diminished fourteenth
Declaration
Swift
static let d14 = Interval(quality: .diminished, degree: 14, semitones: 21) -
Diminished fifteenth
Declaration
Swift
static let d15 = Interval(quality: .diminished, degree: 15, semitones: 23) -
Augmented first
Declaration
Swift
static let A1 = Interval(quality: .augmented, degree: 1, semitones: 1) -
Augmented second
Declaration
Swift
static let A2 = Interval(quality: .augmented, degree: 2, semitones: 3) -
Augmented third
Declaration
Swift
static let A3 = Interval(quality: .augmented, degree: 3, semitones: 5) -
Augmented fourth
Declaration
Swift
static let A4 = Interval(quality: .augmented, degree: 4, semitones: 6) -
Augmented fifth
Declaration
Swift
static let A5 = Interval(quality: .augmented, degree: 5, semitones: 8) -
Augmented sixth
Declaration
Swift
static let A6 = Interval(quality: .augmented, degree: 6, semitones: 10) -
Augmented seventh
Declaration
Swift
static let A7 = Interval(quality: .augmented, degree: 7, semitones: 12) -
Augmented octave
Declaration
Swift
static let A8 = Interval(quality: .augmented, degree: 8, semitones: 13) -
Augmented ninth
Declaration
Swift
static let A9 = Interval(quality: .augmented, degree: 9, semitones: 15) -
Augmented tenth
Declaration
Swift
static let A10 = Interval(quality: .augmented, degree: 10, semitones: 17) -
Augmented eleventh
Declaration
Swift
static let A11 = Interval(quality: .augmented, degree: 11, semitones: 18) -
Augmented twelfth
Declaration
Swift
static let A12 = Interval(quality: .augmented, degree: 12, semitones: 20) -
Augmented thirteenth
Declaration
Swift
static let A13 = Interval(quality: .augmented, degree: 13, semitones: 22) -
Augmented fourteenth
Declaration
Swift
static let A14 = Interval(quality: .augmented, degree: 14, semitones: 24) -
Augmented fifteenth
Declaration
Swift
static let A15 = Interval(quality: .augmented, degree: 15, semitones: 25)
-
Returns the name of the interval.
Declaration
Swift
var description: String -
The quality of the interval
See moreDeclaration
Swift
enum Quality: Sendable
View on GitHub