                 frac = 0
                 ttOctaveFactor += 1
             }
-            let nfIndex = Int(floor(frac * Element(numberField.count)))
+            let nfIndex = Int(round(frac * Element(numberField.count)))
             let tone = Element(exp2(numberField[nfIndex]))
-            let oamc = pow(2.0, Element(octaveAtMiddleC))
-            let lp2 = pow(oamc, ttOctaveFactor)
+            let lp2 = pow(2, ttOctaveFactor)
             var f = tone * lp2 * frequencyAtMiddleC
             
             if f > AKTuningTable.NYQUIST {

        
        // octave reduce
        let nfOctaveReduce = inputNumberField.map({(number:Element)->Element in
            let l2 = log2(number)
            let m = fmod(l2, 1)
            return m
        })
        
        // sort
        let nfOctaveReducedSorted = nfOctaveReduce.sorted {$0 > $1}
        numberField = nfOctaveReducedSorted

        updateTuningTable()

    private func updateTuningTable() {
        AKLog("Updating tuning table from numberField:\(numberField)")
        for i in 0..<AKTuningTable.numberOfMidiNotes {
            let ff = Element(i - Int(noteNumberAtMiddleC)) / Element(numberField.count)
            var ttOctaveFactor = Element(trunc(ff))
            if ff < 0 {
                ttOctaveFactor -= 1
