 //  Copyright © 2017 AudioKit. All rights reserved.
 //
 
+/// Tuning table stores frequencies at which to play MIDI notes
 @objc open class AKTuningTable: NSObject {
 
+    /// For clarity, typealias Frequency as a Double
     public typealias Frequency = Double
 
+    /// Standard Nyquist frequency
     private static let NYQUIST: Frequency = AKSettings.sampleRate / 2
 
+    /// Total number of MIDI Notes available to play
     public static let midiNoteCount = 128
 
+    /// Note number for standard reference note
     public var middleCNoteNumber: MIDINoteNumber = 60 {
         didSet {
             updateTuningTable()
         }
     }
 
+    /// Frequency of standard reference note
     public var middleCFrequency: Frequency = 261.0 {
         didSet {
             updateTuningTable()
         }
     }
 
-    // Musically useful for instrument register
-    // ..., -2, -1, 0, 1, 2, ...
+    /// Octave number for standard reference note.  Can be negative
+    /// ..., -2, -1, 0, 1, 2, ...
     public var middleCOctave: Int = 0 {
         didSet {
             updateTuningTable()

        tuningTable(fromFrequencies: equalTempermentFrequencies)
    }

    // create the tuning using the input frequencies
    public func tuningTable(fromFrequencies inputFrequencies: [Frequency]) {
        if inputFrequencies.isEmpty {
            AKLog("No input frequencies")

    private var content = [Frequency](repeating: 1.0, count: midiNoteCount)
    private var frequencies = [Frequency]()

    /// Initialization for standard default 12 tone equal temperament
    public override init() {
        super.init()
        twelveToneEqualTemperament()
    }

    /// Pull out frequency information for a given note number
    public func frequency(forNoteNumber noteNumber: MIDINoteNumber) -> Frequency {
        return content[Int(noteNumber)]
    }
    
    /// Set frequency of a given note number
    public func setFrequency(_ frequency: Frequency, at noteNumber: MIDINoteNumber) {
        content[Int(noteNumber)] = frequency
    }

    /// Default tuning table is 12ET.
    /// Note this is [nearly] equivalent to 440.0*exp2((noteNumber - 69.0)/12.0))
    public func twelveToneEqualTemperament() {
        var equalTempermentFrequencies = [Frequency](repeatElement(1.0, count: 12))
        for i in 0 ... 11 {
