Functions

The following functions are available globally.

  • Checks the equability between two Scales by their base key and notes.

    Declaration

    Swift

    public func == (left: Scale, right: Scale) -> Bool

    Parameters

    left

    Left handside of the equation.

    right

    Right handside of the equation.

    Return Value

    Returns Bool value of equation of two given scales.

  • Checks if two Key types are equal in terms of their int values.

    Declaration

    Swift

    public func == (lhs: Key, rhs: Key) -> Bool

    Parameters

    lhs

    Left hand side of the equation.

    rhs

    Right hand side of the equation.

    Return Value

    Returns the equation value.

  • Checks if two Key types are equal in terms of their type and accidental values.

    Declaration

    Swift

    public func === (lhs: Key, rhs: Key) -> Bool

    Parameters

    lhs

    Left hand side of the equation.

    rhs

    Right hand side of the equation.

    Return Value

    Returns the equation value.

  • Returns a new accidental by adding up two accidentals in the equation.

    Declaration

    Swift

    public func + (lhs: Accidental, rhs: Accidental) -> Accidental

    Parameters

    lhs

    Left hand side of the equation.

    rhs

    Right hand side of the equation.

    Return Value

    Returns the sum of two accidentals.

  • Returns a new accidental by substracting two accidentals in the equation.

    Declaration

    Swift

    public func - (lhs: Accidental, rhs: Accidental) -> Accidental

    Parameters

    lhs

    Left hand side of the equation.

    rhs

    Right hand side of the equation.

    Return Value

    Returns the difference of two accidentals.

  • Returns a new accidental by adding up an int to the accidental in the equation.

    Declaration

    Swift

    public func + (lhs: Accidental, rhs: Int) -> Accidental

    Parameters

    lhs

    Left hand side of the equation.

    rhs

    Right hand side of the equation.

    Return Value

    Returns the sum of two accidentals.

  • Returns a new accidental by substracting an int from the accidental in the equation.

    Declaration

    Swift

    public func - (lhs: Accidental, rhs: Int) -> Accidental

    Parameters

    lhs

    Left hand side of the equation.

    rhs

    Right hand side of the equation.

    Return Value

    Returns the difference of two accidentals.

  • Multiples an accidental with a multiplier.

    Declaration

    Swift

    public func * (lhs: Accidental, rhs: Int) -> Accidental

    Parameters

    lhs

    Accidental you want to multiply.

    rhs

    Multiplier.

    Return Value

    Returns a multiplied acceident.

  • Divides an accidental with a multiplier

    Declaration

    Swift

    public func / (lhs: Accidental, rhs: Int) -> Accidental

    Parameters

    lhs

    Accidental you want to divide.

    rhs

    Multiplier.

    Return Value

    Returns a divided accidental.

  • Checks if the two accidental is identical in terms of their halfstep values.

    Declaration

    Swift

    public func == (lhs: Accidental, rhs: Accidental) -> Bool

    Parameters

    lhs

    Left hand side of the equation.

    rhs

    Right hand side of the equation.

    Return Value

    Returns true if two accidentalals is identical.

  • Checks if the two accidental is exactly identical.

    Declaration

    Swift

    public func === (lhs: Accidental, rhs: Accidental) -> Bool

    Parameters

    lhs

    Left hand side of the equation.

    rhs

    Right hand side of the equation.

    Return Value

    Returns true if two accidentalals is identical.

  • Returns the pitch above target interval from target pitch.

    Declaration

    Swift

    public func + (lhs: Pitch, rhs: Interval) -> Pitch

    Parameters

    lhs

    Target Pitch.

    rhs

    Target Interval.

    Return Value

    Returns new pitch above target interval from target pitch.

  • Returns the pitch below target interval from target pitch.

    Declaration

    Swift

    public func - (lhs: Pitch, rhs: Interval) -> Pitch

    Parameters

    lhs

    Target Pitch.

    rhs

    Target Interval.

    Return Value

    Returns new pitch below target interval from target pitch.

  • Calculates the interval between two pitches. Doesn’t matter left hand side and right hand side note places.

    Declaration

    Swift

    public func - (lhs: Pitch, rhs: Pitch) -> Interval

    Parameters

    lhs

    Left hand side of the equation.

    rhs

    Right hand side of the equation.

    Return Value

    Intreval between two pitches. You can get the halfsteps from interval as well.

  • Calculates the Pitch above halfsteps.

    Declaration

    Swift

    public func + (pitch: Pitch, halfstep: Int) -> Pitch

    Parameters

    note

    The pitch that is being added halfsteps.

    halfstep

    Halfsteps above.

    Return Value

    Returns Pitch above halfsteps.

  • Calculates the Pitch below halfsteps.

    Declaration

    Swift

    public func - (pitch: Pitch, halfstep: Int) -> Pitch

    Parameters

    note

    The pitch that is being calculated.

    halfstep

    Halfsteps below.

    Return Value

    Returns Pitch below halfsteps.

  • Compares the equality of two pitches by their MIDI note value. Alternative notes passes this equality. Use === function if you want to check exact equality in terms of exact keys.

    Declaration

    Swift

    public func == (left: Pitch, right: Pitch) -> Bool

    Parameters

    left

    Left handside Pitch to be compared.

    right

    Right handside Pitch to be compared.

    Return Value

    Returns the bool value of comparisation of two pitches.

  • Compares the exact equality of two pitches by their keys and octaves. Alternative notes not passes this equality. Use == function if you want to check equality in terms of MIDI note value.

    Declaration

    Swift

    public func === (left: Pitch, right: Pitch) -> Bool

    Parameters

    left

    Left handside Pitch to be compared.

    right

    Right handside Pitch to be compared.

    Return Value

    Returns the bool value of comparisation of two pitches.

  • Compares two Pitches in terms of their semitones.

    Declaration

    Swift

    public func < (lhs: Pitch, rhs: Pitch) -> Bool

    Parameters

    lhs

    Left hand side of the equation.

    rhs

    Right hand side of the equation.

    Return Value

    Returns true if left hand side Pitch lower than right hand side Pitch.

  • Calculates how many notes of a single NoteValueType is equivalent to a given NoteValue.

    Declaration

    Swift

    public func / (noteValue: NoteValue, noteValueType: NoteValueType) -> Double

    Parameters

    noteValue

    The note value to be measured.

    noteValueType

    The note value type to measure the length of the note value.

    Return Value

    Returns how many notes of a single NoteValueType is equivalent to a given NoteValue.

  • Checks the equality of two Intervals in terms of their semitones.

    Declaration

    Swift

    public func == (lhs: Interval, rhs: Interval) -> Bool

    Parameters

    lhs

    Left hand side of the equation.

    rhs

    Right hand side of the equation.

    Return Value

    Returns true if two Intervals are equal.

  • Checks the equality of two Intervals in terms of their quality, degree and semitones.

    Declaration

    Swift

    public func === (lhs: Interval, rhs: Interval) -> Bool

    Parameters

    lhs

    Left hand side of the equation.

    rhs

    Right hand side of the equation.

    Return Value

    Returns true if two Intervals are equal.

  • Checks the equability between two ChordTypes by their intervals.

    Declaration

    Swift

    public func == (left: ChordType?, right: ChordType?) -> Bool

    Parameters

    left

    Left handside of the equation.

    right

    Right handside of the equation.

    Return Value

    Returns Bool value of equation of two given chord types.

  • Checks the equability between two chords by their base key and notes.

    Declaration

    Swift

    public func == (left: Chord?, right: Chord?) -> Bool

    Parameters

    left

    Left handside of the equation.

    right

    Right handside of the equation.

    Return Value

    Returns Bool value of equation of two given chords.