Skip to content

muukii/MusicalScaleKit

Repository files navigation

MusicalScaleKit

CI Status Version License Platform

Example

Create from ScaleDegree

public struct Scale {

    public let degrees: [Degree]

    public let key: Note

    public init(key: Note, degrees: [Degree])    

    public var notes: [Note] { get }
}

Get IonianScale(MajorScale)

let ionianScale = Scale(
    key: .C(.natural),
    degrees: [
        .one(.natural),
        .two(.natural),
        .three(.natural),
        .four(.natural),
        .five(.natural),
        .six(.natural),
        .seven(.natural),
    ]
)

print(ionianScale)
key: C
degrees: [1, 2, 3, 4, 5, 6, 7]
notes: [C, D, E, F, G, A, B]

Get DorianScale

let dorianScale = Scale(
    key: .C(.natural),
    degrees: [
        .one(.natural),
        .two(.natural),
        .three(.flat),
        .four(.natural),
        .five(.natural),
        .six(.natural),
        .seven(.flat),
    ]
)

print(dorianScale)
key: C
degrees: [1, 2, ♭3, 4, 5, 6, ♭7]
notes: [C, D, D#, F, G, A, A#]

Create Note

let a = Note.a(.natural)
let a_flat = Note.a(.flat)
let a_sharp = Note.a(.sharp)

or

let a = Note.a(.natural)
let a_flat = a.flat()
let a_sharp = a.sharp()

Requirements

Installation

MusicalScaleKit is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "MusicalScaleKit"

Author

muukii, [email protected]

License

MusicalScaleKit is available under the MIT license. See the LICENSE file for more info.