 //
 
 import Foundation
-
-// MARK: - NoteType
-
-/// Calculates the `NoteType` above `Interval`.
-///
-/// - Parameters:
-///   - noteType: The note type being added interval.
-///   - interval: Interval above.
-/// - Returns: Returns `NoteType` above interval.
-public func +(noteType: NoteType, interval: Interval) -> NoteType {
-  return NoteType(midiNote: noteType.rawValue + interval.halfstep)!
-}
-
-/// Calculates the `NoteType` above halfsteps.
-///
-/// - Parameters:
-///   - noteType: The note type being added halfsteps.
-///   - halfstep: Halfsteps above
-/// - Returns: Returns `NoteType` above halfsteps
-public func +(noteType: NoteType, halfstep: Int) -> NoteType {
-  return NoteType(midiNote: noteType.rawValue + halfstep)!
-}
-
-/// Calculates the `NoteType` below `Interval`.
-///
-/// - Parameters:
-///   - noteType: The note type being calculated.
-///   - interval: Interval below.
-/// - Returns: Returns `NoteType` below interval.
-public func -(noteType: NoteType, interval: Interval) -> NoteType {
-  return NoteType(midiNote: noteType.rawValue - interval.halfstep)!
-}
-
-/// Calculates the `NoteType` below halfsteps.
-///
-/// - Parameters:
-///   - noteType: The note type being calculated.
-///   - halfstep: Halfsteps below.
-/// - Returns: Returns `NoteType` below halfsteps.
-public func -(noteType: NoteType, halfstep: Int) -> NoteType {
-  return NoteType(midiNote: noteType.rawValue - halfstep)!
-}
-
-/// Represents 12 base notes in music.
-/// C, D, E, F, G, A, B with their flats.
-/// Raw values are included for easier calculation based on midi notes.
-public enum NoteType: Int {
-  case c = 0
-  case dFlat
-  case d
-  case eFlat
-  case e
-  case f
-  case gFlat
-  case g
-  case aFlat
-  case a
-  case bFlat
-  case b
-
-  /// All the notes in static array.
-  public static let all: [NoteType] = [
-    .c, .dFlat, .d, .eFlat, .e, .f,
-    .gFlat, .g, .aFlat, .a, .bFlat, .b
-  ]
-
-  /// Initilizes the note type with midiNote.
-  ///
-  /// - parameters:
-  ///  - midiNote: The midi note value wanted to be converted to `NoteType`.
-  public init?(midiNote: Int) {
-    let octave = (midiNote / 12) - (midiNote < 0 ? 1 : 0)
-    let raw = octave > 0 ? midiNote - (octave * 12) : midiNote - ((octave + 1) * 12) + 12
-    guard let note = NoteType(rawValue: raw) else { return nil }
-    self = note
-  }
-}
-
-extension NoteType: CustomStringConvertible {
-
-  public var description: String {
-    switch self {
-    case .c: return "C"
-    case .dFlat: return "D♭"
-    case .d: return "D"
-    case .eFlat: return "E♭"
-    case .e: return "E"
-    case .f: return "F"
-    case .gFlat: return "G♭"
-    case .g: return "G"
-    case .aFlat: return "A♭"
-    case .a: return "A"
-    case .bFlat: return "B♭"
-    case .b: return "B"
-    }
-  }
-}
 
 // MARK: - Note Value
 


// MARK: - ChordType

/** Represents chords by note sequences initilized by their intervals.

- maj: Major chord.
- min: Minor chord.
- aug: Augmented chord.
- b5: Power chord.
- dim: Dimineshed chord.
- sus: Suspended chord.
- sus2: Suspended second chord.
- M6: Major sixth chord.
- m6: Minor sixth chord.
- dom7: Dominant seventh chord.
- M7: Major seventh chord.
- m7: Minor seventh chord.
- aug7: Augmented seventh chord.
- dim7: Diminished seventh chord.
- M7b5: Major seventh power chord.
- m7b5: Minor seventh power chord.
- custom: Custom chord with given base key `Note` and intervals.
*/
public enum ChordType {
  case maj
  case min
  case aug
  case b5
  case dim
  case sus
  case sus2
  case dom6
  case m6
  case dom7
  case M7
  case m7
  case aug7
  case dim7
  case M7b5
  case m7b5
  case dom9
  case M9
  case m9
  case dom11
  case M11
  case m11
  case dom13
  case M13
  case m13
  case add9
  case madd9
  case M7b9
  case m7b9
  case M6add9
  case m6add9
  case dom7add11
  case M7add11
  case m7add11
  case dom7add13
  case M7add13
  case m7add13
  case M7a5
  case m7a5
  case M7a9
  case M7a5b9
  case M9a11
  case M9b13
  case M6sus4
  case maj7sus4
  case M7sus4
  case M9sus4
  case maj9sus4
  case mM7
  case mM9
  case mM11
  case mM13
  case mM7add11
  case mM7add13
  case M5
  case custom(intervals: [Interval], description: String)

  /// Intervals of the chord based on the chord's key.

    case .phrygian: return "Phrygian"
    case .lydian: return "Lydian"
    case .locrian: return "Locrian"
    case .dimHalf: return "Half Diminished"
    case .dimWhole: return "Whole Diminished"
    case .whole: return "Whole"
    case .augmented: return "Augmented"
    case .chromatic: return "Chromatic"
